libatomic/test: Fix compilation for build sysroot
authorMaciej W. Rozycki <macro@wdc.com>
Mon, 6 Apr 2020 22:32:44 +0000 (23:32 +0100)
committerMaciej W. Rozycki <macro@wdc.com>
Mon, 6 Apr 2020 22:32:44 +0000 (23:32 +0100)
Fix a problem with the libatomic testsuite using a method to determine
the compiler to use resulting in the tool being different from one the
library has been built with, and causing a catastrophic failure from the
lack of a suitable `--sysroot=' option where the `--with-build-sysroot='
configuration option has been used to build the compiler resulting in
the inability to link executables.

Address this problem by providing a DejaGNU configuration file defining
the compiler to use, via the GCC_UNDER_TEST TCL variable, set from $CC
by autoconf, which will have all the required options set for the target
compiler to build executables in the environment configured, removing
failures like:

.../bin/riscv64-linux-gnu-ld: cannot find crt1.o: No such file or directory
.../bin/riscv64-linux-gnu-ld: cannot find -lm
collect2: error: ld returned 1 exit status
compiler exited with status 1
FAIL: libatomic.c/atomic-compare-exchange-1.c (test for excess errors)
Excess errors:
.../bin/riscv64-linux-gnu-ld: cannot find crt1.o: No such file or directory
.../bin/riscv64-linux-gnu-ld: cannot find -lm

UNRESOLVED: libatomic.c/atomic-compare-exchange-1.c compilation failed to produce executable

and bringing overall test results for the `riscv64-linux-gnu' target
(here with the `x86_64-linux-gnu' host and RISC-V QEMU in the Linux user
emulation mode as the target board) from:

=== libatomic Summary ===

# of unexpected failures 27
# of unresolved testcases 27

to:

=== libatomic Summary ===

# of expected passes 54

libatomic/
* configure.ac: Add testsuite/libatomic-site-extra.exp to output
files.
* configure: Regenerate.
* libatomic/testsuite/libatomic-site-extra.exp.in: New file.
* testsuite/Makefile.am (EXTRA_DEJAGNU_SITE_CONFIG): New
variable.
* testsuite/Makefile.in: Regenerate.

libatomic/ChangeLog
libatomic/configure
libatomic/configure.ac
libatomic/testsuite/Makefile.am
libatomic/testsuite/Makefile.in
libatomic/testsuite/libatomic-site-extra.exp.in [new file with mode: 0644]

index 93031221e54ef88c2a49e261e2d56483c120823a..624162db9117b3bd75d61434f1d3dc513ff43e6e 100644 (file)
@@ -1,3 +1,13 @@
+2020-04-06  Maciej W. Rozycki  <macro@wdc.com>
+
+       * configure.ac: Add testsuite/libatomic-site-extra.exp to output
+       files.
+       * configure: Regenerate.
+       * libatomic/testsuite/libatomic-site-extra.exp.in: New file.
+       * testsuite/Makefile.am (EXTRA_DEJAGNU_SITE_CONFIG): New
+       variable.
+       * testsuite/Makefile.in: Regenerate.
+
 2020-02-22  Jakub Jelinek  <jakub@redhat.com>
 
        PR other/55930
index 8cad97e878a0f07e1110a7194e22301cdf3f8a70..3e2f2ff4f202789a546464dcc2d4d173cb2f335f 100755 (executable)
@@ -15728,6 +15728,8 @@ fi
 
 ac_config_files="$ac_config_files Makefile testsuite/Makefile"
 
+ac_config_files="$ac_config_files testsuite/libatomic-site-extra.exp"
+
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
 # tests run on this system so they can be shared between configure
@@ -16799,6 +16801,7 @@ do
     "gstdint.h") CONFIG_COMMANDS="$CONFIG_COMMANDS gstdint.h" ;;
     "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
     "testsuite/Makefile") CONFIG_FILES="$CONFIG_FILES testsuite/Makefile" ;;
+    "testsuite/libatomic-site-extra.exp") CONFIG_FILES="$CONFIG_FILES testsuite/libatomic-site-extra.exp" ;;
 
   *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
   esac
index b8df11b4bf3f8740f4f4c83410d8171ef1a0c1f6..7ac8911c342589eb45013bb55aac95e25bbeb104 100644 (file)
@@ -288,4 +288,5 @@ else
 fi
 
 AC_CONFIG_FILES(Makefile testsuite/Makefile)
+AC_CONFIG_FILES(testsuite/libatomic-site-extra.exp)
 AC_OUTPUT
index 41cfbc46e4bf7f44a18d59ffa2037e39cf3c5108..ce0bda4d54e0dd6a124400a4fa6462056f677f7b 100644 (file)
@@ -11,3 +11,5 @@ EXPECT = $(shell if test -f $(top_builddir)/../expect/expect; then \
 _RUNTEST = $(shell if test -f $(top_srcdir)/../dejagnu/runtest; then \
             echo $(top_srcdir)/../dejagnu/runtest; else echo runtest; fi)
 RUNTEST = $(_RUNTEST) $(AM_RUNTESTFLAGS)
+
+EXTRA_DEJAGNU_SITE_CONFIG = libatomic-site-extra.exp
index 15bb3a4505e376d14bbb4b02af17acf2c2d7ab30..333980ec2c185a5af9402c777f5f04c5f9f70241 100644 (file)
@@ -109,7 +109,7 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
 DIST_COMMON = $(srcdir)/Makefile.am
 mkinstalldirs = $(SHELL) $(top_srcdir)/../mkinstalldirs
 CONFIG_HEADER = $(top_builddir)/auto-config.h
-CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_FILES = libatomic-site-extra.exp
 CONFIG_CLEAN_VPATH_FILES =
 AM_V_P = $(am__v_P_@AM_V@)
 am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
@@ -278,6 +278,7 @@ _RUNTEST = $(shell if test -f $(top_srcdir)/../dejagnu/runtest; then \
             echo $(top_srcdir)/../dejagnu/runtest; else echo runtest; fi)
 
 RUNTEST = $(_RUNTEST) $(AM_RUNTESTFLAGS)
+EXTRA_DEJAGNU_SITE_CONFIG = libatomic-site-extra.exp
 all: all-am
 
 .SUFFIXES:
@@ -310,6 +311,8 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
 $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
        cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(am__aclocal_m4_deps):
+libatomic-site-extra.exp: $(top_builddir)/config.status $(srcdir)/libatomic-site-extra.exp.in
+       cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
 
 mostlyclean-libtool:
        -rm -f *.lo
diff --git a/libatomic/testsuite/libatomic-site-extra.exp.in b/libatomic/testsuite/libatomic-site-extra.exp.in
new file mode 100644 (file)
index 0000000..c0d2666
--- /dev/null
@@ -0,0 +1 @@
+set GCC_UNDER_TEST {@CC@}