parallel-tests: work around Tru64/OSF 5.1 sh read bugs.
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sun, 16 Jan 2011 12:48:17 +0000 (13:48 +0100)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sun, 16 Jan 2011 16:59:12 +0000 (17:59 +0100)
* lib/am/check.am ($(TEST_SUITE_LOG), recheck, recheck-html):
Test file readability before redirecting input from it, to avoid
exiting Tru64/OSF 5.1 sh which treats read as special builtin.
* tests/parallel-tests-unreadable-log.test: New test.
* tests/Makefile.am (TESTS): Update.
* NEWS: Update.

Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
ChangeLog
NEWS
lib/Automake/tests/Makefile.in
lib/am/check.am
tests/Makefile.am
tests/Makefile.in
tests/parallel-tests-unreadable-log.test [new file with mode: 0755]

index 9d2428d..cbc0415 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,15 @@
 2011-01-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+           Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       parallel-tests: work around Tru64/OSF 5.1 sh read bugs.
+       * lib/am/check.am ($(TEST_SUITE_LOG), recheck, recheck-html):
+       Test file readability before redirecting input from it, to avoid
+       exiting Tru64/OSF 5.1 sh which treats read as special builtin.
+       * tests/parallel-tests-unreadable-log.test: New test.
+       * tests/Makefile.am (TESTS): Update.
+       * NEWS: Update.
+
+2011-01-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
        * NEWS, README: Update copyright years.
 
diff --git a/NEWS b/NEWS
index 40cd8ef..b5cb6e9 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -53,6 +53,9 @@ Bugs fixed in 1.11.0a:
   - The code for automatic dependency tracking works around a Solaris
     make bug triggered by sources containing repeated slashes when the
     `subdir-objects' option was used.
+
+  - The parallel-tests driver now does not produce erroneous results
+    with Tru64/OSF 5.1 sh upon unreadable log files any more.
 \f
 New in 1.11:
 
index 4b2c57f..b4940db 100644 (file)
@@ -324,7 +324,8 @@ $(TEST_SUITE_LOG): $(TEST_LOGS)
        @$(am__sh_e_setup);                                             \
        list='$(TEST_LOGS)';                                            \
        results=`for f in $$list; do                                    \
-                  read line < $$f && echo "$$line" || echo FAIL;       \
+                  test -r $$f && read line < $$f && echo "$$line"      \
+                    || echo FAIL;                                      \
                 done`;                                                 \
        all=`echo "$$results" | sed '/^$$/d' | wc -l | sed -e 's/^[      ]*//'`; \
        fail=`echo "$$results" | grep -c '^FAIL'`;                      \
@@ -373,7 +374,7 @@ $(TEST_SUITE_LOG): $(TEST_LOGS)
          echo ".. contents:: :depth: 2";                               \
          echo;                                                         \
          for f in $$list; do                                           \
-           read line < $$f;                                            \
+           test -r $$f && read line < $$f || line=;                    \
            case $$line in                                              \
              PASS:*|XFAIL:*);;                                         \
              *) echo; cat $$f;;                                        \
@@ -437,7 +438,7 @@ recheck recheck-html:
        list='$(TEST_LOGS)';                                            \
        list=`for f in $$list; do                                       \
                test -f $$f || continue;                                \
-               if read line < $$f; then                                \
+               if test -r $$f && read line < $$f; then                 \
                  case $$line in FAIL*|XPASS*) echo $$f;; esac;         \
                else echo $$f; fi;                                      \
              done | tr '\012\015' '  '`;                               \
index c953be8..5728081 100644 (file)
@@ -1,6 +1,6 @@
 ## automake - create Makefile.in from Makefile.am
-## Copyright (C) 2001, 2003, 2006, 2007, 2008, 2009, 2010 Free Software
-## Foundation, Inc.
+## Copyright (C) 2001, 2003, 2006, 2007, 2008, 2009, 2010, 2011 Free
+## Software Foundation, Inc.
 
 ## This program is free software; you can redistribute it and/or modify
 ## it under the terms of the GNU General Public License as published by
@@ -146,7 +146,8 @@ $(TEST_SUITE_LOG): $(TEST_LOGS)
        @$(am__sh_e_setup);                                             \
        list='$(TEST_LOGS)';                                            \
        results=`for f in $$list; do                                    \
-                  read line < $$f && echo "$$line" || echo FAIL;       \
+                  test -r $$f && read line < $$f && echo "$$line"      \
+                    || echo FAIL;                                      \
                 done`;                                                 \
        all=`echo "$$results" | sed '/^$$/d' | wc -l | sed -e 's/^[      ]*//'`; \
        fail=`echo "$$results" | grep -c '^FAIL'`;                      \
@@ -195,7 +196,7 @@ $(TEST_SUITE_LOG): $(TEST_LOGS)
          echo ".. contents:: :depth: 2";                               \
          echo;                                                         \
          for f in $$list; do                                           \
-           read line < $$f;                                            \
+           test -r $$f && read line < $$f || line=;                    \
            case $$line in                                              \
              PASS:*|XFAIL:*);;                                         \
              *) echo; cat $$f;;                                        \
@@ -287,7 +288,7 @@ recheck recheck-html:
        list='$(TEST_LOGS)';                                            \
        list=`for f in $$list; do                                       \
                test -f $$f || continue;                                \
-               if read line < $$f; then                                \
+               if test -r $$f && read line < $$f; then                 \
                  case $$line in FAIL*|XPASS*) echo $$f;; esac;         \
                else echo $$f; fi;                                      \
              done | tr '\012\015' '  '`;                               \
index 890e69b..713dd92 100644 (file)
@@ -567,6 +567,7 @@ parallel-tests7.test \
 parallel-tests8.test \
 parallel-tests9.test \
 parallel-tests10.test \
+parallel-tests-unreadable-log.test \
 parse.test \
 percent.test \
 percent2.test \
index 7600c14..45adb04 100644 (file)
@@ -834,6 +834,7 @@ parallel-tests7.test \
 parallel-tests8.test \
 parallel-tests9.test \
 parallel-tests10.test \
+parallel-tests-unreadable-log.test \
 parse.test \
 percent.test \
 percent2.test \
@@ -1142,7 +1143,8 @@ $(TEST_SUITE_LOG): $(TEST_LOGS)
        @$(am__sh_e_setup);                                             \
        list='$(TEST_LOGS)';                                            \
        results=`for f in $$list; do                                    \
-                  read line < $$f && echo "$$line" || echo FAIL;       \
+                  test -r $$f && read line < $$f && echo "$$line"      \
+                    || echo FAIL;                                      \
                 done`;                                                 \
        all=`echo "$$results" | sed '/^$$/d' | wc -l | sed -e 's/^[      ]*//'`; \
        fail=`echo "$$results" | grep -c '^FAIL'`;                      \
@@ -1191,7 +1193,7 @@ $(TEST_SUITE_LOG): $(TEST_LOGS)
          echo ".. contents:: :depth: 2";                               \
          echo;                                                         \
          for f in $$list; do                                           \
-           read line < $$f;                                            \
+           test -r $$f && read line < $$f || line=;                    \
            case $$line in                                              \
              PASS:*|XFAIL:*);;                                         \
              *) echo; cat $$f;;                                        \
@@ -1255,7 +1257,7 @@ recheck recheck-html:
        list='$(TEST_LOGS)';                                            \
        list=`for f in $$list; do                                       \
                test -f $$f || continue;                                \
-               if read line < $$f; then                                \
+               if test -r $$f && read line < $$f; then                 \
                  case $$line in FAIL*|XPASS*) echo $$f;; esac;         \
                else echo $$f; fi;                                      \
              done | tr '\012\015' '  '`;                               \
diff --git a/tests/parallel-tests-unreadable-log.test b/tests/parallel-tests-unreadable-log.test
new file mode 100755 (executable)
index 0000000..6ebb2b6
--- /dev/null
@@ -0,0 +1,59 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Check that the testsuite driver copes well with unreadable test logs.
+
+parallel_tests=yes
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+TESTS = foo.test bar.test
+XFAIL_TESTS = bar.test
+END
+
+cat > foo.test << 'END'
+#! /bin/sh
+exit 0
+END
+cat > bar.test << 'END'
+#! /bin/sh
+exit 1
+END
+chmod a+x foo.test bar.test
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+# The testsuite driver will use this variable, so ensure it sanitizes
+# it and do not allow in spurious values from the environment.
+line=PASS; export line
+
+./configure
+
+$MAKE foo.log
+$MAKE bar.log
+chmod a-r foo.log bar.log
+$MAKE test-suite.log >stdout && { cat stdout; Exit 1; }
+cat stdout
+grep '^2 of 2 tests failed *$' stdout
+grep '^2 of 2 tests failed\. *$' test-suite.log
+
+: