libffi/test: Fix compilation for build sysroot
authorMaciej W. Rozycki <macro@wdc.com>
Sat, 25 Apr 2020 20:27:14 +0000 (21:27 +0100)
committerMaciej W. Rozycki <macro@wdc.com>
Sat, 25 Apr 2020 20:27:14 +0000 (21:27 +0100)
Fix a problem with the libffi 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
inability to actually choose any compiler at all in a cross-compilation
configuration.

Address this problem by providing a DejaGNU configuration file defining
the compiler to use, via the CC_FOR_TARGET 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:

FAIL: libffi.call/closure_fn0.c -W -Wall -Wno-psabi -O0 (test for excess errors)
Excess errors:
default_target_compile: No compiler to compile with
UNRESOLVED: libffi.call/closure_fn0.c -W -Wall -Wno-psabi -O0 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:

=== libffi Summary ===

# of unexpected failures 708
# of unresolved testcases 708
# of unsupported tests 30

to:

=== libffi Summary ===

# of expected passes 1934
# of unsupported tests 28

This is a combined backport of the relevant parts of upstream libffi
changes as follows:

- commit 8308984e479e ("[PATCH] Make sure we're running dejagnu tests
  with the right compiler."),

- commit 2d9b3939751b ("[PATCH] Fix for closures with sunpro compiler"),

- commit 0c3824702d3d ("[PATCH] Always set CC_FOR_TARGET for dejagnu, to
  make the testsuite respect $CC"),

- commit 7d698125b1f0 ("[PATCH] Use the proper C++ compiler to run C++
  tests"),

- commit 6b6df1a7bb37 ("[PATCH] Adds `local.exp` to CLEANFILES"),

- commit 6cf0dea78a5a ("[PATCH] Change CLEANFILES to DISTCLEANFILES")

libffi/
* Makefile.am (DISTCLEANFILES): New variable.
* configure.ac: Produce `local.exp'.
* Makefile.in: Regenerate.
* configure: Regenerate.
* testsuite/Makefile.am (EXTRA_DEJAGNU_SITE_CONFIG): New
variable.
* testsuite/Makefile.in: Regenerate.

libffi/ChangeLog
libffi/Makefile.am
libffi/Makefile.in
libffi/configure
libffi/configure.ac
libffi/testsuite/Makefile.am
libffi/testsuite/Makefile.in

index 47648d31abd15fb2edb7166639c95276a2dce077..7ad4b70eb0069114c8a9f7a40d73bd10fd35ec04 100644 (file)
@@ -1,3 +1,13 @@
+2020-04-25  Maciej W. Rozycki  <macro@wdc.com>
+
+       * Makefile.am (DISTCLEANFILES): New variable.
+       * configure.ac: Produce `local.exp'.
+       * Makefile.in: Regenerate.
+       * configure: Regenerate.
+       * testsuite/Makefile.am (EXTRA_DEJAGNU_SITE_CONFIG): New
+       variable.
+       * testsuite/Makefile.in: Regenerate.
+
 2020-01-24  Maciej W. Rozycki  <macro@wdc.com>
 
        * configure.ac: Handle `--with-toolexeclibdir='.
index 86e22496152a9f62edc546b871c186e8facefafa..203b7d10a4224de044f69e3d4530a4888a51248c 100644 (file)
@@ -15,6 +15,9 @@ EXTRA_DIST = LICENSE ChangeLog.v1 ChangeLog.libgcj                    \
        libffi.xcodeproj/project.pbxproj                                \
        libtool-ldflags
 
+# local.exp is generated by configure
+DISTCLEANFILES = local.exp
+
 # Automake Documentation:
 # If your package has Texinfo files in many directories, you can use the
 # variable TEXINFO_TEX to tell Automake where to find the canonical
index f7786ff3fd1106682753df938e99656e6cf97d27..745bdd80777b4f6ca08c18ed698b6466200a4b08 100644 (file)
@@ -454,6 +454,9 @@ EXTRA_DIST = LICENSE ChangeLog.v1 ChangeLog.libgcj                  \
        libtool-ldflags
 
 
+# local.exp is generated by configure
+DISTCLEANFILES = local.exp
+
 # Automake Documentation:
 # If your package has Texinfo files in many directories, you can use the
 # variable TEXINFO_TEX to tell Automake where to find the canonical
@@ -1674,6 +1677,7 @@ distclean-generic:
        -rm -f src/x86/$(am__dirstamp)
        -rm -f src/xtensa/$(DEPDIR)/$(am__dirstamp)
        -rm -f src/xtensa/$(am__dirstamp)
+       -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
 
 maintainer-clean-generic:
        @echo "This command is intended for maintainers to use"
index ca0a2965c7a5ef3567a3d7975283be1f3bb30f19..f0051505d104ac4993eca169f842dd8b92be742a 100755 (executable)
@@ -14961,6 +14961,11 @@ _ACEOF
 
 
 
+cat > local.exp <<EOF
+set CC_FOR_TARGET "$CC"
+set CXX_FOR_TARGET "$CXX"
+EOF
+
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5
 $as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; }
index 93e655803e702c2234cea1a610924b6ed20d75a3..0bf4af410d3eea0ca0bbf2e9c2785f1de0141a6a 100644 (file)
@@ -61,6 +61,11 @@ AC_PROG_LIBTOOL
 # Test for 64-bit build.
 AC_CHECK_SIZEOF([size_t])
 
+cat > local.exp <<EOF
+set CC_FOR_TARGET "$CC"
+set CXX_FOR_TARGET "$CXX"
+EOF
+
 AM_MAINTAINER_MODE
 
 AC_CHECK_HEADERS(sys/mman.h)
index 209e8976635e0384612e4fbb1b88f82d93052a5b..88509fc35d6d1f7a494e270874dac48d42b5419c 100644 (file)
@@ -13,6 +13,8 @@ RUNTEST = `if [ -f $(top_srcdir)/../dejagnu/runtest ] ; then \
 
 AM_RUNTESTFLAGS =
 
+EXTRA_DEJAGNU_SITE_CONFIG=../local.exp
+
 CLEANFILES = *.exe core* *.log *.sum
 
 EXTRA_DIST = config/default.exp libffi.call/cls_19byte.c               \
index 31e9cf520b832aa2bd7f035d42d1bbe87c5f61b7..8b574dad5d73025c6129f0d1391aa5d541a78397 100644 (file)
@@ -279,6 +279,7 @@ RUNTEST = `if [ -f $(top_srcdir)/../dejagnu/runtest ] ; then \
               echo $(top_srcdir)/../dejagnu/runtest ; \
            else echo runtest; fi`
 
+EXTRA_DEJAGNU_SITE_CONFIG = ../local.exp
 CLEANFILES = *.exe core* *.log *.sum
 EXTRA_DIST = config/default.exp libffi.call/cls_19byte.c               \
 libffi.call/cls_align_longdouble_split.c                               \