public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Add compile testing to glibc test framework.
@ 2016-06-07  7:37 Carlos O'Donell
  2016-06-07  7:44 ` Andreas Schwab
  2016-06-07 17:28 ` Joseph Myers
  0 siblings, 2 replies; 10+ messages in thread
From: Carlos O'Donell @ 2016-06-07  7:37 UTC (permalink / raw)
  To: GNU C Library, Joseph S. Myers

The goal of this patch is to add compile testing to the glibc
test framework.

The changes allow you to add C source files that the test framework
can compile and verify the compiler exits with a zero exit status for
PASS. While a non-zero exit status by the compiler indicates a FAIL.
The support for UNSUPPORTED is handled in the normal way for other
tests that are conditionally disabled (can't be run and thus can't
exit with code 77). Only C source files are currently supported
because that's all I needed to support today, but it could be extended
to compile any type of source target. I wanted to approach the work
incrementally.

The test is being compiled under the glibc test framework, which
is as close as we currently get to building real user applications.

For example I use the test to compile various glibc/linux header
order combinations e.g.

cat sysdeps/unix/sysv/linux/tst-ipv6-compat1.c
#include <netinet/in.h>
#include <linux/in6.h>

int
main (void)
{
  return 0;
}

git diff sysdeps/unix/sysv/linux/Makefile
diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
index c57575f..dad556c 100644
--- a/sysdeps/unix/sysv/linux/Makefile
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -203,3 +203,9 @@ tests += tst-setgetname tst-align-clone tst-getpid1 \
        tst-thread-affinity-pthread tst-thread-affinity-pthread2 \
        tst-thread-affinity-sched
 endif
+
+ifeq ($(subdir),inet)
+# Add tests for Linux and glibc header compatibility.
+tests-compile += tst-ipv6-compat1 tst-ipv6-compat2 tst-ipv6-compat3
+TEST_SRC_DIR = ../sysdeps/unix/sysv/linux/
+endif

Previously these kinds of tests would result in the testsuite failing
to run to completion because compiler errors are treated as harness
failures.

I tried a variety of solutions to implement this, but settled on the
present set of two variables: tests-compile and TESTS_SRC_DIR as a way
to avoid needing anything like sysd-rules to find the test sources.
I did not want to unduly slow down build test cycles. The static
pattern rule is pretty concise and optimal.

Thoughts?

-- 
Cheers,
Carlos.

2015-06-06  Carlos O'Donell  <carlos@redhat.com>

	* Rules [ifeq ($(run-built-tests),no)] (tests): Add $(tests-compile).
	[ifneq ($(run-built-tests),no)] (tests): Add $(tests-compile:%=$(objpfx)%.out).
	(tests): Add $(tests-compile) to merge result list.
	[ifeq ($(build-programs),yes)] (binaries-all-tests): Add $(tests-compile).
	[ifneq "$(strip $(tests-compile))" ""] (tc-OUTPUT_OPTION-file): Define.
	(tc-OUTPUT_OPTION): Define.
	(tc-compile-mkdeps-flags): Define.
	(tc-compile.c): Define.
	($(tests-compile:%=$(objpfx)%.out)): Define static pattern rule.

diff --git a/Rules b/Rules
index 8306d36..e92a9ff 100644
--- a/Rules
+++ b/Rules
@@ -91,10 +91,10 @@ else
 others: $(addprefix $(objpfx),$(extra-objs))
 endif
 ifeq ($(run-built-tests),no)
-tests: $(addprefix $(objpfx),$(tests) $(test-srcs)) $(tests-special)
+tests: $(addprefix $(objpfx),$(tests) $(test-srcs)) $(tests-compile) $(tests-special)
 xtests: tests $(xtests-special)
 else
-tests: $(tests:%=$(objpfx)%.out) $(tests-special)
+tests: $(tests:%=$(objpfx)%.out) $(tests-compile:%=$(objpfx)%.out) $(tests-special)
 xtests: tests $(xtests:%=$(objpfx)%.out) $(xtests-special)
 endif
 
@@ -102,7 +102,7 @@ tests-special-notdir = $(patsubst $(objpfx)%, %, $(tests-special))
 xtests-special-notdir = $(patsubst $(objpfx)%, %, $(xtests-special))
 tests:
 	$(..)scripts/merge-test-results.sh -s $(objpfx) $(subdir) \
-	  $(sort $(tests) $(tests-special-notdir:.out=)) \
+	  $(sort $(tests) $(tests-special-notdir:.out=) $(tests-compile)) \
 	  > $(objpfx)subdir-tests.sum
 xtests:
 	$(..)scripts/merge-test-results.sh -s $(objpfx) $(subdir) \
@@ -111,7 +111,7 @@ xtests:
 
 ifeq ($(build-programs),yes)
 binaries-all-notests = $(others) $(sysdep-others)
-binaries-all-tests = $(tests) $(xtests) $(test-srcs)
+binaries-all-tests = $(tests) $(xtests) $(test-srcs) $(tests-compile)
 binaries-all = $(binaries-all-notests) $(binaries-all-tests)
 binaries-static-notests = $(others-static)
 binaries-static-tests = $(tests-static) $(xtests-static)
@@ -198,6 +198,45 @@ $(objpfx)%.out: /dev/null $(objpfx)%	# Make it 2nd arg for canned sequence.
 	$(make-test-out) > $@; \
 	$(evaluate-test)
 
+# tests-compile provides a way for developers to test compiling a singular
+# C source file under the environment of the glibc build.  This is useful
+# when testing system invariants like compatibility between headers files
+# provided by the linux kernel headers (--with-headers).  While it is
+# arguable that such tests, as invariants, should go in configure scripts,
+# that would lead to a large number of unruly tests in configure.ac.
+# Having the compatibility tests as part of the regression testsuite is far
+# more manageable from a maintenance perspective.
+#
+# There are three things you need to do to add a compilation test to glibc:
+# * Create the source file to compile.
+#   - It should compile without error in order for the test to PASS.
+#   - It should compile with error in order for the test to FAIL.
+#
+# * Add the test name to 'tests-compile'
+#   - e.g.
+#     ifeq ($(subdir),inet)
+#     tests-compile += tst-ipv6-compat
+#     ...
+#
+# * Set 'TEST_SRC_DIR' to the relative path to the test sources (no trailing
+#   slash):
+#     ...
+#     TEST_SRC_DIR = ../sysdeps/unix/sysv/linux
+#     endif
+#
+# You will now have an additional test that is compiled during 'make check',
+# with compiler output to $(objpfx)/<test name>.out as you would expect for
+# a normal test.
+ifneq "$(strip $(tests-compile))" ""
+tc-OUTPUT_OPTION-file = $(objpfx)$(notdir $(@:%.out=%.o))
+tc-OUTPUT_OPTION = -o $(tc-OUTPUT_OPTION-file)
+tc-compile-mkdep-flags = -MD -MP -MF $(tc-OUTPUT_OPTION-file).dt -MT $(tc-OUTPUT_OPTION-file)
+tc-compile.c = $(CC) $(TEST_SRC_DIR)/$(notdir $(@:%.out=%.c)) -c $(CFLAGS) $(CPPFLAGS)
+$(tests-compile:%=$(objpfx)%.out): $(objpfx)%.out : $(TEST_SRC_DIR)/%.c Makefile
+	$(tc-compile.c) $(tc-OUTPUT_OPTION) $(tc-compile-mkdep-flags) \
+	>& $@; $(evaluate-test)
+endif
+
 # tests-unsupported lists tests that we will not try to build at all in
 # this configuration.  Note this runs every time because it does not
 # actually create its target.  The dependency on Makefile is meant to

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Add compile testing to glibc test framework.
  2016-06-07  7:37 [PATCH] Add compile testing to glibc test framework Carlos O'Donell
@ 2016-06-07  7:44 ` Andreas Schwab
  2016-06-07  8:13   ` Carlos O'Donell
  2016-06-07 17:28 ` Joseph Myers
  1 sibling, 1 reply; 10+ messages in thread
From: Andreas Schwab @ 2016-06-07  7:44 UTC (permalink / raw)
  To: Carlos O'Donell; +Cc: GNU C Library, Joseph S. Myers

Carlos O'Donell <carlos@redhat.com> writes:

> +ifeq ($(subdir),inet)
> +# Add tests for Linux and glibc header compatibility.
> +tests-compile += tst-ipv6-compat1 tst-ipv6-compat2 tst-ipv6-compat3
> +TEST_SRC_DIR = ../sysdeps/unix/sysv/linux/

test-source-dir = ...

How do multiple occurrences of test-compile interact with each other in
relation to test-source-dir?

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Add compile testing to glibc test framework.
  2016-06-07  7:44 ` Andreas Schwab
@ 2016-06-07  8:13   ` Carlos O'Donell
  2016-06-07  8:40     ` Carlos O'Donell
  0 siblings, 1 reply; 10+ messages in thread
From: Carlos O'Donell @ 2016-06-07  8:13 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: GNU C Library, Joseph S. Myers

On 06/07/2016 03:44 AM, Andreas Schwab wrote:
> Carlos O'Donell <carlos@redhat.com> writes:
> 
>> +ifeq ($(subdir),inet)
>> +# Add tests for Linux and glibc header compatibility.
>> +tests-compile += tst-ipv6-compat1 tst-ipv6-compat2 tst-ipv6-compat3
>> +TEST_SRC_DIR = ../sysdeps/unix/sysv/linux/
> 
> test-source-dir = ...

Changed to 'tests-source-dir' following other plural uses of 'tests'.

> How do multiple occurrences of test-compile interact with each other in
> relation to test-source-dir?

They don't work.

You can't have a compile test in inet/ and one in sysdeps/unix/sysv/linux/
which adds to inet/ without breaking the source<->test mapping for the
inet/ test. I can document that.

It's a limitation of the simplicity of the static pattern
rule and my desire to keep the impact minimal on the build cost.

-- 
Cheers,
Carlos.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Add compile testing to glibc test framework.
  2016-06-07  8:13   ` Carlos O'Donell
@ 2016-06-07  8:40     ` Carlos O'Donell
  0 siblings, 0 replies; 10+ messages in thread
From: Carlos O'Donell @ 2016-06-07  8:40 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: GNU C Library, Joseph S. Myers

On 06/07/2016 04:13 AM, Carlos O'Donell wrote:
> On 06/07/2016 03:44 AM, Andreas Schwab wrote:
>> Carlos O'Donell <carlos@redhat.com> writes:
>>
>>> +ifeq ($(subdir),inet)
>>> +# Add tests for Linux and glibc header compatibility.
>>> +tests-compile += tst-ipv6-compat1 tst-ipv6-compat2 tst-ipv6-compat3
>>> +TEST_SRC_DIR = ../sysdeps/unix/sysv/linux/
>>
>> test-source-dir = ...
> 
> Changed to 'tests-source-dir' following other plural uses of 'tests'.
> 
>> How do multiple occurrences of test-compile interact with each other in
>> relation to test-source-dir?
> 
> They don't work.
> 
> You can't have a compile test in inet/ and one in sysdeps/unix/sysv/linux/
> which adds to inet/ without breaking the source<->test mapping for the
> inet/ test. I can document that.
> 
> It's a limitation of the simplicity of the static pattern
> rule and my desire to keep the impact minimal on the build cost.
> 

I also missed some of the cleanup rules, but I'll get to them in v2.

-- 
Cheers,
Carlos.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Add compile testing to glibc test framework.
  2016-06-07  7:37 [PATCH] Add compile testing to glibc test framework Carlos O'Donell
  2016-06-07  7:44 ` Andreas Schwab
@ 2016-06-07 17:28 ` Joseph Myers
  2016-06-17  3:15   ` Carlos O'Donell
  2016-06-17 11:27   ` Florian Weimer
  1 sibling, 2 replies; 10+ messages in thread
From: Joseph Myers @ 2016-06-07 17:28 UTC (permalink / raw)
  To: Carlos O'Donell; +Cc: GNU C Library

On Tue, 7 Jun 2016, Carlos O'Donell wrote:

> Previously these kinds of tests would result in the testsuite failing
> to run to completion because compiler errors are treated as harness
> failures.

I don't actually see this as a problem - that is, I don't see why any 
compile failure should be hard to fix for some system-specific reason.  
I'd rather just add such tests as normal tests, that break the build if 
they fail.

> 	* Rules [ifeq ($(run-built-tests),no)] (tests): Add $(tests-compile).
> 	[ifneq ($(run-built-tests),no)] (tests): Add $(tests-compile:%=$(objpfx)%.out).

If .out is compiler output, I see no good reason for this to depend on 
run-built-tests; such tests should run unconditionally.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Add compile testing to glibc test framework.
  2016-06-07 17:28 ` Joseph Myers
@ 2016-06-17  3:15   ` Carlos O'Donell
  2016-06-17  9:18     ` Joseph Myers
  2016-06-17 11:27   ` Florian Weimer
  1 sibling, 1 reply; 10+ messages in thread
From: Carlos O'Donell @ 2016-06-17  3:15 UTC (permalink / raw)
  To: Joseph Myers; +Cc: GNU C Library

On 06/07/2016 01:28 PM, Joseph Myers wrote:
> On Tue, 7 Jun 2016, Carlos O'Donell wrote:
> 
>> Previously these kinds of tests would result in the testsuite failing
>> to run to completion because compiler errors are treated as harness
>> failures.

I agree that tests-compile is quite hackish and I'm happy to make all
of these tests just like normal tests.

> I don't actually see this as a problem - that is, I don't see why any 
> compile failure should be hard to fix for some system-specific reason.  
> I'd rather just add such tests as normal tests, that break the build if 
> they fail.

This would require that users use the latest kernel headers for all of
their builds or `make check` would fail. I always use the latest kernel
headers but I don't want to force that for all developers, and it would
be a change in the way the average developer works.

How about this?

* Extend evaluate-test.sh to support return code 88 as a dynamic xfail
  - Played around with 99 for tests that must not be xfailed.
* Extend kernel-features.h to define __LINUX_KERNEL_HEADER_VERSION the
  version of the headers used in the build.
  - Define __TEST_* macros for features that should be tested based on
    __LINUX_KERNEL_HEADER_VERSION.
* Write tests that that use __TEST_* macros and include linux and glibc
  headers. This way if you have a new enough set of kernel headers the
  tests will attempt to verify the header compatibility. Otherwise if
  your headers are not new enough you see XFAILd tests for these.
* As new compat is added we add more tests and newer __TEST_* macros
  enabled for newer kernel headers.

Example patch below.

Thoughts?

-- 
Cheers,
Carlos.

diff --git a/scripts/evaluate-test.sh b/scripts/evaluate-test.sh
index f2c85ed..b206b53 100755
--- a/scripts/evaluate-test.sh
+++ b/scripts/evaluate-test.sh
@@ -24,21 +24,35 @@ rc=$2
 orig_rc=$rc
 xfail=$3
 stop_on_failure=$4
+xfailable=false
 
-if [ $rc -eq 77 ]; then
-  result="UNSUPPORTED"
-  rc=0
-else
-  if [ $rc -eq 0 ]; then
-    result="PASS"
-  else
+case $rc in
+  99)
+    # Hard fail. Cannot be xfailed.
     result="FAIL"
-  fi
-
-  if $xfail; then
-    result="X$result"
+    ;;
+  88)
+    # Dynamic XFAIL.
+    result="XFAIL"
     rc=0
-  fi
+    ;;
+  77)
+    # Skip.
+    result="UNSUPPORTED"
+    rc=0
+    ;;
+  0)
+    result="PASS"
+    xfailable=true
+    ;;
+  *)
+    result="FAIL"
+    xfailable=true
+    ;;
+esac
+if $xfail && $xfailable; then
+  result="X$result"
+  rc=0
 fi
 
 echo "$result: $test_name"
diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h
index 02c530b..7373001 100644
--- a/sysdeps/unix/sysv/linux/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/kernel-features.h
@@ -17,6 +17,25 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+/* There are two important constants used in this file:
+   * __LINUX_KERNEL_HEADER_VERSION
+     - Version of the linux kernel headers used to compile glibc.
+     - Used to determine when a test can assume a feature is present
+       for testing purposes.
+   * __LINUX_KERNEL_VERSION
+     - Minimum version of the linux kernel usable by glibc.
+     - Used to determine when code can assume a feature is present
+       at runtime.  */
+
+/* Provide LINUX_VERSION_CODE.  */
+#include <linux/version.h>
+
+#ifndef LINUX_VERSION_CODE
+# error "Linux kernel does not define a usable version."
+#else
+# define __LINUX_KERNEL_HEADER_VERSION LINUX_VERSION_CODE
+#endif
+
 /* This file must not contain any C code.  At least it must be protected
    to allow using the file also in assembler files.  */
 
@@ -151,3 +170,17 @@
    separate syscalls were only added later.  */
 #define __ASSUME_SENDMSG_SYSCALL	1
 #define __ASSUME_RECVMSG_SYSCALL	1
+
+/* On Linux kernel 3.12 or newer the IPv6 headers are guarded to
+   ensure compatibiltiy with glibc INET headers. You need at least
+   Linux kernel 3.19 to get the full set of compatible headers for
+   glibc inet/in.h.  */
+#if __LINUX_KERNEL_HEADER_VERSION >= 0x031300
+#define __TEST_USE_KERNEL_IPV6_DEFS	1
+#else
+#define __TEST_USE_KERNEL_IPV6_DEFS	0
+#endif
+
+/* No Linux kernel has fixes for INET header testing.
+   XFAIL these tests.  */
+#define __TEST_USE_KERNEL_INET_DEFS	0
diff --git a/sysdeps/unix/sysv/linux/tst-ipv6-compat1.c b/sysdeps/unix/sysv/linux/tst-ipv6-compat1.c
new file mode 100644
index 0000000..a138982
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/tst-ipv6-compat1.c
@@ -0,0 +1,83 @@
+/* Test IPv6 linux kernel and glibc header interoperability.
+   Copyright (C) 2016 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+#include <kernel-features.h>
+
+/* Run the first test by default.  */
+#ifndef TST_IPV6_COMPAT
+# define TST_IPV6_COMPAT 1
+#endif
+
+#if __TEST_USE_KERNEL_IPV6_DEFS
+
+/* Application has to compile and run successfully.  */
+#define RET 0
+
+#if TST_IPV6_COMPAT == 1
+/* Test the basic coordinated IPv6 definitions:
+   Test netinet/in.h (glibc) coordinates with linux/in6.h (linux) (1/2).  */
+#include <netinet/in.h>
+#include <linux/in6.h>
+#endif
+
+#if TST_IPV6_COMPAT == 2
+/* Test the basic coordinated IPv6 definitions.
+   Test netinet/in.h (glibc) coordinates with linux/in6.h (linux) (2/2).  */
+#include <linux/in6.h>
+#include <netinet/in.h>
+#endif
+
+#if TST_IPV6_COMPAT == 3
+/* Test the coordinated IPv6 definitions:
+   Test netdb.h (glibc) coordinates with linux/xfrm.h (linux) (1/2).  */
+#include <netdb.h>
+#include <linux/xfrm.h>
+#endif
+
+#if TST_IPV6_COMPAT == 4
+/* Test the coordinated IPv6 definitions:
+   Test netdb.h (glibc) coordinates with linux/xfrm.h (linux) (2/2).  */
+#include <linux/xfrm.h>
+#include <netdb.h>
+#endif
+
+#if TST_IPV6_COMPAT == 5
+/* Test the coordinated IPv6 definitions:
+   Test netinet/in.h (glibc) coordinates with linux/ipv6.h (linux) (2/2).  */
+#include <netinet/in.h>
+#include <linux/ipv6.h>
+#endif
+
+#if TST_IPV6_COMPAT == 6
+/* Test the coordinated IPv6 definitions:
+   Test netdb.h (glibc) coordinates with linux/xfrm.h (linux) (2/2).  */
+#include <linux/ipv6.h>
+#include <netinet/in.h>
+#endif
+
+#else
+
+/* The kernel headers don't support coordinated IPv6 definitions.  */
+#define RET 88  /* XFAIL.  */
+
+#endif
+
+int
+main (void)
+{
+  return RET;
+}
diff --git a/sysdeps/unix/sysv/linux/tst-ipv6-compat2.c b/sysdeps/unix/sysv/linux/tst-ipv6-compat2.c
new file mode 100644
index 0000000..7bdad6f
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/tst-ipv6-compat2.c
@@ -0,0 +1,2 @@
+#define TST_IPV6_COMPAT 2
+#include "tst-ipv6-compat1.c"

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Add compile testing to glibc test framework.
  2016-06-17  3:15   ` Carlos O'Donell
@ 2016-06-17  9:18     ` Joseph Myers
  0 siblings, 0 replies; 10+ messages in thread
From: Joseph Myers @ 2016-06-17  9:18 UTC (permalink / raw)
  To: Carlos O'Donell; +Cc: GNU C Library

On Thu, 16 Jun 2016, Carlos O'Donell wrote:

> This would require that users use the latest kernel headers for all of
> their builds or `make check` would fail. I always use the latest kernel

No, just include appropriate conditionals in the tests requiring newer 
headers than the minimum.  We've done that before (via a configure test 
for header presence, removed when the minimum headers version was 
increased).

> * Extend evaluate-test.sh to support return code 88 as a dynamic xfail
>   - Played around with 99 for tests that must not be xfailed.

I don't see this as needed.  The case in question looks exactly like 
UNSUPPORTED - there is some functionality that glibc cannot support in a 
particular environment (in this case, when the kernel headers are too 
old).  (I do think we could do with a new return code for UNRESOLVED as 
distinct from FAIL and UNSUPPORTED, for cases such as memory allocation 
failures.)

> * Extend kernel-features.h to define __LINUX_KERNEL_HEADER_VERSION the
>   version of the headers used in the build.

I don't see a need for a new macro that just duplicates 
LINUX_VERSION_CODE.

> +/* On Linux kernel 3.12 or newer the IPv6 headers are guarded to
> +   ensure compatibiltiy with glibc INET headers. You need at least
> +   Linux kernel 3.19 to get the full set of compatible headers for
> +   glibc inet/in.h.  */
> +#if __LINUX_KERNEL_HEADER_VERSION >= 0x031300
> +#define __TEST_USE_KERNEL_IPV6_DEFS	1
> +#else
> +#define __TEST_USE_KERNEL_IPV6_DEFS	0
> +#endif

This could be simpler as:

#define __TEST_USE_KERNEL_IPV6_DEFS (LINUX_VERSION_CODE >= 0x031300)

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Add compile testing to glibc test framework.
  2016-06-07 17:28 ` Joseph Myers
  2016-06-17  3:15   ` Carlos O'Donell
@ 2016-06-17 11:27   ` Florian Weimer
  2016-06-17 13:51     ` Carlos O'Donell
  1 sibling, 1 reply; 10+ messages in thread
From: Florian Weimer @ 2016-06-17 11:27 UTC (permalink / raw)
  To: Joseph Myers; +Cc: Carlos O'Donell, GNU C Library

On 06/07/2016 07:28 PM, Joseph Myers wrote:
> On Tue, 7 Jun 2016, Carlos O'Donell wrote:
>
>> Previously these kinds of tests would result in the testsuite failing
>> to run to completion because compiler errors are treated as harness
>> failures.
>
> I don't actually see this as a problem - that is, I don't see why any
> compile failure should be hard to fix for some system-specific reason.
> I'd rather just add such tests as normal tests, that break the build if
> they fail.

What's annoying with that is that you lose test summary reporting.  If 
this was somehow fixed (without impacting make running times, please), I 
think there wouldn't much of an incentive to add such compile-time testing.

Florian

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Add compile testing to glibc test framework.
  2016-06-17 11:27   ` Florian Weimer
@ 2016-06-17 13:51     ` Carlos O'Donell
  2016-06-17 13:54       ` Florian Weimer
  0 siblings, 1 reply; 10+ messages in thread
From: Carlos O'Donell @ 2016-06-17 13:51 UTC (permalink / raw)
  To: Florian Weimer, Joseph Myers; +Cc: GNU C Library

On 06/17/2016 07:27 AM, Florian Weimer wrote:
> On 06/07/2016 07:28 PM, Joseph Myers wrote:
>> On Tue, 7 Jun 2016, Carlos O'Donell wrote:
>> 
>>> Previously these kinds of tests would result in the testsuite
>>> failing to run to completion because compiler errors are treated
>>> as harness failures.
>> 
>> I don't actually see this as a problem - that is, I don't see why
>> any compile failure should be hard to fix for some system-specific
>> reason. I'd rather just add such tests as normal tests, that break
>> the build if they fail.
> 
> What's annoying with that is that you lose test summary reporting.
> If this was somehow fixed (without impacting make running times,
> please), I think there wouldn't much of an incentive to add such
> compile-time testing.

What would you like fixed? Summary reporting of failed compile 
and link?

That's an interesting solution, wrap the compiles and link with
something like evaluate-test.sh but designed to capture failed
compiles and failed links and report them properly as a new
kind of failed test code?

-- 
Cheers,
Carlos.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] Add compile testing to glibc test framework.
  2016-06-17 13:51     ` Carlos O'Donell
@ 2016-06-17 13:54       ` Florian Weimer
  0 siblings, 0 replies; 10+ messages in thread
From: Florian Weimer @ 2016-06-17 13:54 UTC (permalink / raw)
  To: Carlos O'Donell; +Cc: Joseph Myers, GNU C Library

On 06/17/2016 03:51 PM, Carlos O'Donell wrote:
> On 06/17/2016 07:27 AM, Florian Weimer wrote:
>> On 06/07/2016 07:28 PM, Joseph Myers wrote:
>>> On Tue, 7 Jun 2016, Carlos O'Donell wrote:
>>>
>>>> Previously these kinds of tests would result in the testsuite
>>>> failing to run to completion because compiler errors are treated
>>>> as harness failures.
>>>
>>> I don't actually see this as a problem - that is, I don't see why
>>> any compile failure should be hard to fix for some system-specific
>>> reason. I'd rather just add such tests as normal tests, that break
>>> the build if they fail.
>>
>> What's annoying with that is that you lose test summary reporting.
>> If this was somehow fixed (without impacting make running times,
>> please), I think there wouldn't much of an incentive to add such
>> compile-time testing.
>
> What would you like fixed? Summary reporting of failed compile
> and link?

Yes, and the existing reports for tests that ran.

> That's an interesting solution, wrap the compiles and link with
> something like evaluate-test.sh but designed to capture failed
> compiles and failed links and report them properly as a new
> kind of failed test code?

Something like that, yes.

If anyone wants to work on this: Potential future directions in this 
area involve compiling all tests -static, as PIE, as PIC, with Address 
Sanitizer, and so on, and also run them under valgrind.

(I also see considerable value in separating the test suite from the 
glibc source body, with the goal that you can compile the tests on an 
older glibc release, and check that they still work with the current 
version, but that is probably a different conversation.)

Florian

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2016-06-17 13:54 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-07  7:37 [PATCH] Add compile testing to glibc test framework Carlos O'Donell
2016-06-07  7:44 ` Andreas Schwab
2016-06-07  8:13   ` Carlos O'Donell
2016-06-07  8:40     ` Carlos O'Donell
2016-06-07 17:28 ` Joseph Myers
2016-06-17  3:15   ` Carlos O'Donell
2016-06-17  9:18     ` Joseph Myers
2016-06-17 11:27   ` Florian Weimer
2016-06-17 13:51     ` Carlos O'Donell
2016-06-17 13:54       ` Florian Weimer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).