* [COMMITTED] [PATCH] Avoid C++ tests when the C++ cannot be linked
@ 2015-07-14 14:21 Adhemerval Zanella
0 siblings, 0 replies; 7+ messages in thread
From: Adhemerval Zanella @ 2015-07-14 14:21 UTC (permalink / raw)
To: GNU C Library
* elf/Makefile [ifeq (yes,$(build-shared)) (tests)] (tst-nodelete):
Add iff $CXX is set.
[ifeq (yes,$(build-shared)) (modules-names)] (tst-nodelete-rtldmod):
Likewise.
(tst-nodelete-zmodiff): Likewise.
* nptl/Makefile [[ifeq (,$(CXX))] (tests-unsupported)]: Add tst-once5.
--
diff --git a/elf/Makefile b/elf/Makefile
index 535421f..90d5058 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -132,7 +132,7 @@ tests += $(tests-static)
ifeq (yes,$(build-shared))
tests += loadtest restest1 preloadtest loadfail multiload origtest resolvfail \
constload1 order noload filter unload \
- reldep reldep2 reldep3 reldep4 nodelete nodelete2 tst-nodelete \
+ reldep reldep2 reldep3 reldep4 nodelete nodelete2 \
nodlopen nodlopen2 neededtest neededtest2 \
neededtest3 neededtest4 unload2 lateglobal initfirst global \
restest2 next dblload dblunload reldep5 reldep6 reldep7 reldep8 \
@@ -145,7 +145,8 @@ tests += loadtest restest1 preloadtest loadfail multiload origtest resolvfail \
unload3 unload4 unload5 unload6 unload7 unload8 tst-global1 order2 \
tst-audit1 tst-audit2 tst-audit8 tst-audit9 \
tst-stackguard1 tst-addr1 tst-thrlock \
- tst-unique1 tst-unique2 $(if $(CXX),tst-unique3 tst-unique4) \
+ tst-unique1 tst-unique2 $(if $(CXX),tst-unique3 tst-unique4 \
+ tst-nodelete) \
tst-initorder tst-initorder2 tst-relsort1 tst-null-argv \
tst-ptrguard1 tst-tlsalign tst-tlsalign-extern
# reldep9
@@ -208,8 +209,8 @@ modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \
tst-unique2mod1 tst-unique2mod2 \
tst-auditmod9a tst-auditmod9b \
$(if $(CXX),tst-unique3lib tst-unique3lib2 tst-unique4lib \
- tst-nodelete-uniquemod) \
- tst-nodelete-rtldmod tst-nodelete-zmod \
+ tst-nodelete-uniquemod tst-nodelete-rtldmod \
+ tst-nodelete-zmod) \
tst-initordera1 tst-initorderb1 \
tst-initordera2 tst-initorderb2 \
tst-initordera3 tst-initordera4 \
diff --git a/nptl/Makefile b/nptl/Makefile
index 5bc4ad1..140f063 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -400,7 +400,7 @@ endif
ifeq (,$(CXX))
# These tests require a C++ compiler and runtime.
-tests-unsupported += tst-cancel24 tst-cancel24-static
+tests-unsupported += tst-cancel24 tst-cancel24-static tst-once5
endif
include ../Rules
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [COMMITTED PATCH] Avoid C++ tests when the C++ cannot be linked.
2015-03-07 0:37 ` Roland McGrath
@ 2015-03-07 18:37 ` Carlos O'Donell
0 siblings, 0 replies; 7+ messages in thread
From: Carlos O'Donell @ 2015-03-07 18:37 UTC (permalink / raw)
To: Roland McGrath; +Cc: GNU C. Library
On 03/06/2015 07:37 PM, Roland McGrath wrote:
>> I don't like this. The semantics I would rather have are that all such
>> tests fail, not fail to build, but fail. Then the results of `make check`
>> represent reality with all the C++ tests failing because you don't have
>> a libstdc++. This way it's clear that you haven't passed all of the testing
>> for glibc.
>
> I don't like the conflation of unbuildable with failed. What we need is
> the possibility of UNSUPPORTED as an outcome for our tests. I'll send a
> change in that direction.
Good point. I like UNSUPPORTED better. My worry is that these tests simply
go missing and we don't notice. Fail safe is better.
Cheers,
Carlos.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [COMMITTED PATCH] Avoid C++ tests when the C++ cannot be linked.
2015-03-05 20:23 ` Carlos O'Donell
@ 2015-03-07 0:37 ` Roland McGrath
2015-03-07 18:37 ` Carlos O'Donell
0 siblings, 1 reply; 7+ messages in thread
From: Roland McGrath @ 2015-03-07 0:37 UTC (permalink / raw)
To: Carlos O'Donell; +Cc: GNU C. Library
> I don't like this. The semantics I would rather have are that all such
> tests fail, not fail to build, but fail. Then the results of `make check`
> represent reality with all the C++ tests failing because you don't have
> a libstdc++. This way it's clear that you haven't passed all of the testing
> for glibc.
I don't like the conflation of unbuildable with failed. What we need is
the possibility of UNSUPPORTED as an outcome for our tests. I'll send a
change in that direction.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [COMMITTED PATCH] Avoid C++ tests when the C++ cannot be linked.
2015-03-06 10:34 ` Florian Weimer
@ 2015-03-07 0:37 ` Roland McGrath
0 siblings, 0 replies; 7+ messages in thread
From: Roland McGrath @ 2015-03-07 0:37 UTC (permalink / raw)
To: Florian Weimer; +Cc: GNU C. Library
> The most common test failure is likely a working C++ compiler which
> cannot link libstdc++ statically.
That's not something I've seen.
> This causes a make check abort, without an error summary report. Your
> configure change does not address that at all.
Feel free to send a change to make the configure check more demanding.
Thanks,
Roland
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [COMMITTED PATCH] Avoid C++ tests when the C++ cannot be linked.
2015-03-04 21:55 [COMMITTED PATCH] " Roland McGrath
2015-03-05 20:23 ` Carlos O'Donell
@ 2015-03-06 10:34 ` Florian Weimer
2015-03-07 0:37 ` Roland McGrath
1 sibling, 1 reply; 7+ messages in thread
From: Florian Weimer @ 2015-03-06 10:34 UTC (permalink / raw)
To: Roland McGrath, GNU C. Library
On 03/04/2015 10:55 PM, Roland McGrath wrote:
> +# It's useless to us if it can't link programs (e.g. missing -lstdc++).
> +AC_CACHE_CHECK([whether $CXX can link programs], libc_cv_cxx_link_ok, [dnl
> +AC_LANG_PUSH([C++])
> +AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
> + [libc_cv_cxx_link_ok=yes],
> + [libc_cv_cxx_link_ok=no])
> +AC_LANG_POP([C++])])
> +AS_IF([test $libc_cv_cxx_link_ok != yes], [CXX=])
The most common test failure is likely a working C++ compiler which
cannot link libstdc++ statically. This causes a “make check” abort,
without an error summary report. Your configure change does not address
that at all.
--
Florian Weimer / Red Hat Product Security
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [COMMITTED PATCH] Avoid C++ tests when the C++ cannot be linked.
2015-03-04 21:55 [COMMITTED PATCH] " Roland McGrath
@ 2015-03-05 20:23 ` Carlos O'Donell
2015-03-07 0:37 ` Roland McGrath
2015-03-06 10:34 ` Florian Weimer
1 sibling, 1 reply; 7+ messages in thread
From: Carlos O'Donell @ 2015-03-05 20:23 UTC (permalink / raw)
To: Roland McGrath, GNU C. Library
On 03/04/2015 04:55 PM, Roland McGrath wrote:
> In a bootstrapping environment, libstdc++ is likely not to be available
> when building libc. This changes configure to check whether linking an
> empty C++ program with ${CXX} works (it won't when libstdc++ is missing),
> and elides all the C++ tests when that check fails.
>
> I've verified the check passes on a normal installation and fails in a
> partially-installed cross-compilation environment lacking libstdc++.
>
>
> Thanks,
> Roland
>
>
> 2015-03-04 Roland McGrath <roland@hack.frob.com>
>
> * configure.ac (libc_cv_cxx_link_ok): New check.
> Reset CXX to empty if it fails to link.
> * configure: Regenerated.
> * dlfcn/Makefile (tests, modules-names): Add bug-atexit3 and
> bug-atexit3-lib only if $(CXX) is nonempty.
> * nptl/Makefile (tests): Likewise for tst-cancel24.
> (tests, tests-static): Likewise for tst-cancel24-static.
> * debug/Makefile (tests): Likewise for tst-chk4, tst-chk5, tst-chk6,
> tst-lfschk4, tst-lfschk5, and tst-lfschk6.
>
I don't like this. The semantics I would rather have are that all such
tests fail, not fail to build, but fail. Then the results of `make check`
represent reality with all the C++ tests failing because you don't have
a libstdc++. This way it's clear that you haven't passed all of the testing
for glibc.
Cheers,
Carlos.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [COMMITTED PATCH] Avoid C++ tests when the C++ cannot be linked.
@ 2015-03-04 21:55 Roland McGrath
2015-03-05 20:23 ` Carlos O'Donell
2015-03-06 10:34 ` Florian Weimer
0 siblings, 2 replies; 7+ messages in thread
From: Roland McGrath @ 2015-03-04 21:55 UTC (permalink / raw)
To: GNU C. Library
In a bootstrapping environment, libstdc++ is likely not to be available
when building libc. This changes configure to check whether linking an
empty C++ program with ${CXX} works (it won't when libstdc++ is missing),
and elides all the C++ tests when that check fails.
I've verified the check passes on a normal installation and fails in a
partially-installed cross-compilation environment lacking libstdc++.
Thanks,
Roland
2015-03-04 Roland McGrath <roland@hack.frob.com>
* configure.ac (libc_cv_cxx_link_ok): New check.
Reset CXX to empty if it fails to link.
* configure: Regenerated.
* dlfcn/Makefile (tests, modules-names): Add bug-atexit3 and
bug-atexit3-lib only if $(CXX) is nonempty.
* nptl/Makefile (tests): Likewise for tst-cancel24.
(tests, tests-static): Likewise for tst-cancel24-static.
* debug/Makefile (tests): Likewise for tst-chk4, tst-chk5, tst-chk6,
tst-lfschk4, tst-lfschk5, and tst-lfschk6.
--- a/configure.ac
+++ b/configure.ac
@@ -50,9 +50,18 @@ if test $host != $build; then
fi
AC_SUBST(cross_compiling)
AC_PROG_CPP
+AC_CHECK_TOOL(READELF, readelf, false)
+
# We need the C++ compiler only for testing.
AC_PROG_CXX
-AC_CHECK_TOOL(READELF, readelf, false)
+# It's useless to us if it can't link programs (e.g. missing -lstdc++).
+AC_CACHE_CHECK([whether $CXX can link programs], libc_cv_cxx_link_ok, [dnl
+AC_LANG_PUSH([C++])
+AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
+ [libc_cv_cxx_link_ok=yes],
+ [libc_cv_cxx_link_ok=no])
+AC_LANG_POP([C++])])
+AS_IF([test $libc_cv_cxx_link_ok != yes], [CXX=])
if test "`cd $srcdir; /bin/pwd`" = "`/bin/pwd`"; then
AC_MSG_ERROR([you must configure in a separate build directory])
--- a/debug/Makefile
+++ b/debug/Makefile
@@ -133,10 +133,13 @@ LDFLAGS-tst-backtrace6 = -rdynamic
tests = backtrace-tst tst-longjmp_chk tst-chk1 tst-chk2 tst-chk3 \
tst-lfschk1 tst-lfschk2 tst-lfschk3 test-strcpy_chk test-stpcpy_chk \
- tst-chk4 tst-chk5 tst-chk6 tst-lfschk4 tst-lfschk5 tst-lfschk6 \
tst-longjmp_chk2 tst-backtrace2 tst-backtrace3 tst-backtrace4 \
tst-backtrace5 tst-backtrace6
+ifneq (,$(CXX))
+tests += tst-chk4 tst-chk5 tst-chk6 tst-lfschk4 tst-lfschk5 tst-lfschk6
+endif
+
extra-libs = libSegFault libpcprofile
extra-libs-others = $(extra-libs)
--- a/dlfcn/Makefile
+++ b/dlfcn/Makefile
@@ -36,12 +36,12 @@ endif
ifeq (yes,$(build-shared))
tests = glrefmain failtest tst-dladdr default errmsg1 tstcxaatexit \
bug-dlopen1 bug-dlsym1 tst-dlinfo bug-atexit1 bug-atexit2 \
- bug-atexit3 tstatexit bug-dl-leaf tst-rec-dlopen
+ tstatexit bug-dl-leaf tst-rec-dlopen
endif
modules-names = glreflib1 glreflib2 glreflib3 failtestmod defaultmod1 \
defaultmod2 errmsg1mod modatexit modcxaatexit \
bug-dlsym1-lib1 bug-dlsym1-lib2 bug-atexit1-lib \
- bug-atexit2-lib bug-atexit3-lib bug-dl-leaf-lib \
+ bug-atexit2-lib bug-dl-leaf-lib \
bug-dl-leaf-lib-cb moddummy1 moddummy2
failtestmod.so-no-z-defs = yes
@@ -57,6 +57,11 @@ tststatic2-ENV = $(tststatic-ENV)
tststatic3-ENV = $(tststatic-ENV)
tststatic4-ENV = $(tststatic-ENV)
tststatic5-ENV = $(tststatic-ENV)
+
+ifneq (,$(CXX))
+tests += bug-atexit3
+modules-names += bug-atexit3-lib
+endif
endif
extra-test-objs += $(modules-names:=.os)
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -245,8 +245,8 @@ tests = tst-typesizes \
tst-cancel6 tst-cancel7 tst-cancel8 tst-cancel9 tst-cancel10 \
tst-cancel11 tst-cancel12 tst-cancel13 tst-cancel14 tst-cancel15 \
tst-cancel16 tst-cancel17 tst-cancel18 tst-cancel19 tst-cancel20 \
- tst-cancel21 tst-cancel22 tst-cancel23 tst-cancel24 tst-cancel25 \
- tst-cancel-self tst-cancel-self-cancelstate \
+ tst-cancel21 tst-cancel22 tst-cancel23 $(if $(CXX),tst-cancel24) \
+ tst-cancel25 tst-cancel-self tst-cancel-self-cancelstate \
tst-cancel-self-canceltype tst-cancel-self-testcancel \
tst-cleanup0 tst-cleanup1 tst-cleanup2 tst-cleanup3 tst-cleanup4 \
tst-flock1 tst-flock2 \
@@ -364,14 +364,19 @@ link-libc-static := $(common-objpfx)libc.a $(static-gnulib) \
$(common-objpfx)libc.a
tests-static += tst-locale1 tst-locale2 tst-stackguard1-static \
- tst-cancel21-static tst-cancel24-static tst-cond8-static \
+ tst-cancel21-static tst-cond8-static \
tst-mutex8-static tst-mutexpi8-static tst-sem11-static \
tst-sem12-static
-tests += tst-stackguard1-static tst-cancel21-static tst-cancel24-static \
+tests += tst-stackguard1-static tst-cancel21-static \
tst-cond8-static tst-mutex8-static tst-mutexpi8-static \
tst-sem11-static tst-sem12-static
xtests-static += tst-setuid1-static
+ifneq (,$(CXX))
+tests += tst-cancel24-static
+tests-static += tst-cancel24-static
+endif
+
# These tests are linked with libc before libpthread
tests-reverse += tst-cancel5 tst-cancel23 tst-vfork1x tst-vfork2x
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2015-07-14 14:21 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-14 14:21 [COMMITTED] [PATCH] Avoid C++ tests when the C++ cannot be linked Adhemerval Zanella
-- strict thread matches above, loose matches on Subject: below --
2015-03-04 21:55 [COMMITTED PATCH] " Roland McGrath
2015-03-05 20:23 ` Carlos O'Donell
2015-03-07 0:37 ` Roland McGrath
2015-03-07 18:37 ` Carlos O'Donell
2015-03-06 10:34 ` Florian Weimer
2015-03-07 0:37 ` Roland McGrath
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).