* tests/silentcxx.test: The C++ compiler from Sun Studio is named
`CC'.  Account for this in our grepping checks on the make output.
Since we are at it, throw in a couple of improvements to comments
and formatting.
* tests/silent-many-generic.test: The C++ compiler from Sun Studio
is named `CC', and this can cause spurious failures in our grepping
of the make output.  Work around this by using a wrapper script
around the C++ compiler (generated on the fly), since filtering the
make output proved to be too fragile.
---
 ChangeLog                      |   13 +++++++++++++
 tests/silent-many-generic.test |   22 +++++++++++++++++++++-
 tests/silentcxx.test           |    6 +++---
 3 files changed, 37 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 9ec9083..df6cb05 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,18 @@
 2011-06-02  Stefano Lattarini  <stefano.lattar...@gmail.com>
 
+       silent-rules tests: fix spurious failures with Sun Studio C++
+       * tests/silentcxx.test: The C++ compiler from Sun Studio is named
+       `CC'.  Account for this in our grepping checks on the make output.
+       Since we are at it, throw in a couple of improvements to comments
+       and formatting.
+       * tests/silent-many-generic.test: The C++ compiler from Sun Studio
+       is named `CC', and this can cause spurious failures in our grepping
+       of the make output.  Work around this by using a wrapper script
+       around the C++ compiler (generated on the fly), since filtering the
+       make output proved to be too fragile.
+
+2011-06-02  Stefano Lattarini  <stefano.lattar...@gmail.com>
+
        tests: fix spurious failure in backcompat2.test on NetBSD
        * tests/backcompat2.test: Add trailing `:' in the body of a `for'
        loop, in case the last command there might have an exit status
diff --git a/tests/silent-many-generic.test b/tests/silent-many-generic.test
index 17dea2c..b2c7e89 100755
--- a/tests/silent-many-generic.test
+++ b/tests/silent-many-generic.test
@@ -99,11 +99,27 @@ mkdir sub
 cat >>configure.in <<'EOF'
 AM_SILENT_RULES
 AM_PROG_CC_C_O
-AC_PROG_CXX
 AC_PROG_F77
 AC_PROG_FC
 AC_PROG_LEX
 AC_PROG_YACC
+AC_PROG_CXX
+
+# The SunStudio C++ compiler is unfortunately named `CC' (yuck!),
+# and this can cause problems with our grepping checks on the
+# output from make.  Avoid these problems by invoking a wrapper
+# script, as filtering the make output proved too fragile.
+case " $CXX " in
+  *' CC '*|*'/CC '*)
+    AC_MSG_WARN([the C++ compiler '$CXX' seems to be named 'CC'])
+    AC_MSG_WARN([it will be wrapped with the custom script 'am--cxx'])
+    echo '#!/bin/sh' > bin/am--cxx
+    echo 'PATH=$saved_PATH; export PATH' >> bin/am--cxx
+    echo "exec $CXX \${1+"\$@"}" >> bin/am--cxx
+    chmod a+x bin/am--cxx
+    CXX=am--cxx
+esac
+
 AC_CONFIG_FILES([sub/Makefile])
 AC_OUTPUT
 EOF
@@ -182,6 +198,10 @@ cp foo3.f sub/baz3.f
 cp foo5.l sub/baz5.l
 cp foo6.y sub/baz6.y
 
+mkdir bin
+saved_PATH=$PATH; export saved_PATH
+PATH=`pwd`/bin$PATH_SEPARATOR$PATH; export PATH
+
 $ACLOCAL
 $AUTOMAKE --add-missing
 $AUTOCONF
diff --git a/tests/silentcxx.test b/tests/silentcxx.test
index 14825db..f6eab3d 100755
--- a/tests/silentcxx.test
+++ b/tests/silentcxx.test
@@ -51,10 +51,10 @@ EOF
 
 cat > foo.cpp <<'EOF'
 using namespace std; /* C compilers fail on this. */
-int main() { return 0; }
+int main (void) { return 0; }
 EOF
 
-# let's try out other extensions too
+# Let's try out other extensions too.
 echo 'class Baz  { public: int i;  };' > baz.cxx
 echo 'class Quux { public: bool b; };' > quux.cc
 
@@ -99,7 +99,7 @@ do
   grep ' -c ' stdout
   grep ' -o ' stdout
 
-  $EGREP '(CC|CXX|LD) ' stdout && Exit 1
+  $EGREP '(CXX|LD) ' stdout && Exit 1
 
   # Ensure a clean reconfiguration/rebuild.
   $MAKE clean
-- 
1.7.2.3


Reply via email to