Commit dd11a04061cb49ce1d702545693c24eb1267d648

Anthony Green 2014-04-12T19:37:21

Merge pull request #86 from joshtriplett/testsuite-CC-CXX testsuite ignores CC parameter supplied to configure or make

diff --git a/.travis.yml b/.travis.yml
index 6633e6f..6c14fcd 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,17 +1,22 @@
-language: c
+language: cpp
 compiler:
   - gcc
   - clang
 env:
-  - build32=false
-  - build32=true
+  -
+  - HOST=i386-pc-linux-gnu
 matrix:
   exclude:
     - compiler: clang
-      env: build32=true
+      env: HOST=i386-pc-linux-gnu
 
 before_script:
   - sudo apt-get install dejagnu texinfo
-  - if $build32 ; then sudo apt-get install gcc-multilib g++-multilib ; fi
+  - if [ "$HOST" = i386-pc-linux-gnu ] ; then sudo apt-get install gcc-multilib g++-multilib && CC="$CC -m32" && CXX="$CXX -m32" ; fi
 
-script: run= && if $build32 ; then run=i386 && mkdir path32 && PATH="$(pwd)/path32:$PATH" && printf '#!/bin/sh\nexec /usr/bin/'"$CC"' -m32 "$@"' > "path32/$CC" && chmod a+x "path32/$CC" ; fi && ./autogen.sh && $run ./configure && make && make dist && make check
+script:
+  - ./autogen.sh
+  - ./configure ${HOST+--host=$HOST}
+  - make
+  - make dist
+  - make check
diff --git a/README b/README
index 7c52607..b4cdb85 100644
--- a/README
+++ b/README
@@ -146,13 +146,16 @@ It's also possible to build libffi on Windows platforms with
 Microsoft's Visual C++ compiler.  In this case, use the msvcc.sh
 wrapper script during configuration like so:
 
-path/to/configure CC=path/to/msvcc.sh LD=link CPP=\"cl -nologo -EP\"
+path/to/configure CC=path/to/msvcc.sh CXX=path/to/msvcc.sh LD=link CPP=\"cl -nologo -EP\"
 
-For 64-bit Windows builds, use CC="path/to/msvcc.sh -m64".
-You may also need to specify --build appropriately. When building with MSVC
-under a MingW environment, you may need to remove the line in configure
-that sets 'fix_srcfile_path' to a 'cygpath' command. ('cygpath' is not
-present in MingW, and is not required when using MingW-style paths.)
+For 64-bit Windows builds, use CC="path/to/msvcc.sh -m64" and
+CXX="path/to/msvcc.sh -m64".  You may also need to specify --build
+appropriately.
+
+When building with MSVC under a MingW environment, you may need to
+remove the line in configure that sets 'fix_srcfile_path' to a 'cygpath'
+command.  ('cygpath' is not present in MingW, and is not required when
+using MingW-style paths.)
 
 For iOS builds, the 'libffi.xcodeproj' Xcode project is available.
 
@@ -180,8 +183,8 @@ See the git log for details at http://github.com/atgreen/libffi.
 	  32-bit x86 targets such as Linux.
 	Various Android, MIPS N32, x86, FreeBSD and UltraSPARC IIi
 	  fixes.
-	Make the testsuite more robust: eliminated several spurious
-	  failures.
+	Make the testsuite more robust: eliminate several spurious
+	  failures, and respect the $CC and $CXX environment variables.
 	Archive off the manually maintained ChangeLog in favor of git
 	  log.
 
diff --git a/configure.ac b/configure.ac
index 3c1632c..3058095 100644
--- a/configure.ac
+++ b/configure.ac
@@ -29,6 +29,7 @@ m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS])
 m4_define([_AC_ARG_VAR_PRECIOUS],[])
 save_CFLAGS=$CFLAGS
 AC_PROG_CC
+AC_PROG_CXX
 CFLAGS=$save_CFLAGS
 m4_undefine([_AC_ARG_VAR_PRECIOUS])
 m4_rename_force([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
@@ -53,12 +54,12 @@ fi
 
 if test "x$GCC" = "xyes"; then
   CFLAGS="$CFLAGS -fexceptions"
-  touch local.exp
-else
-  cat > local.exp <<EOF
+fi
+
+cat > local.exp <<EOF
 set CC_FOR_TARGET "$CC"
+set CXX_FOR_TARGET "$CXX"
 EOF
-fi
 
 AM_MAINTAINER_MODE
 
diff --git a/testsuite/Makefile.am b/testsuite/Makefile.am
index 912e8e1..acd15c5 100644
--- a/testsuite/Makefile.am
+++ b/testsuite/Makefile.am
@@ -2,17 +2,6 @@
 
 AUTOMAKE_OPTIONS = foreign dejagnu
 
-# Setup the testing framework, if you have one
-EXPECT = `if [ -f $(top_builddir)/../expect/expect ] ; then \
-            echo $(top_builddir)/../expect/expect ; \
-          else echo expect ; fi`
-
-RUNTEST = `if [ -f $(top_srcdir)/../dejagnu/runtest ] ; then \
-	       echo $(top_srcdir)/../dejagnu/runtest ; \
-	    else echo runtest; fi`
-
-AM_RUNTESTFLAGS =
-
 EXTRA_DEJAGNU_SITE_CONFIG=../local.exp
 
 CLEANFILES = *.exe core* *.log *.sum
diff --git a/testsuite/lib/libffi.exp b/testsuite/lib/libffi.exp
index 28d6036..dbdd1a2 100644
--- a/testsuite/lib/libffi.exp
+++ b/testsuite/lib/libffi.exp
@@ -222,6 +222,10 @@ proc libffi_target_compile { source dest type options } {
 	lappend options "libs= -lpthread"
     }
 
+    if { [string match "*.cc" $source] } {
+	lappend options "c++"
+    }
+
     verbose "options: $options"
     return [target_compile $source $dest $type $options]
 }
diff --git a/testsuite/libffi.call/call.exp b/testsuite/libffi.call/call.exp
index 90e400f..36d13d8 100644
--- a/testsuite/libffi.call/call.exp
+++ b/testsuite/libffi.call/call.exp
@@ -19,10 +19,7 @@ libffi-init
 
 global srcdir subdir
 
-run-many-tests [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] ""
-if { [string match $using_gcc "yes"] } {
-  run-many-tests [lsort [glob -nocomplain $srcdir/$subdir/*.cc]] "-shared-libgcc -lstdc++"
-}
+run-many-tests [lsort [glob -nocomplain -- $srcdir/$subdir/*.{c,cc}]] ""
 
 dg-finish