]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
testsuite: fix a spurious failure with non-bash shells
authorStefano Lattarini <stefano.lattarini@gmail.com>
Wed, 27 Jul 2011 14:34:30 +0000 (16:34 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Tue, 2 Aug 2011 21:05:00 +0000 (23:05 +0200)
* tests/tap-fancy2.test: Remove an unportable use of backslashes
with the `echo' builtin, which was causing some shells (among them
bash and Debian /bin/ksh) to print a `\\' string, while other
shells (among them zsh, dash, and Solaris /bin/sh and /bin/ksh)
were unexpectedly printing a single `\' character.  Since we are
at it, add a sanity check to ensure that this issue does not
resurface.

ChangeLog
tests/tap-fancy2.test

index c1550e33405585d51a2775b52b415615831d1fe6..89b5059dbf7bcd98e8791e395fbc535f7e096526 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2011-07-27  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       testsuite: fix a spurious failure with non-bash shells
+       * tests/tap-fancy2.test: Remove an unportable use of backslashes
+       with the `echo' builtin, which was causing some shells (among them
+       bash and Debian /bin/ksh) to print a `\\' string, while other
+       shells (among them zsh, dash, and Solaris /bin/sh and /bin/ksh)
+       were unexpectedly printing a single `\' character.  Since we are
+       at it, add a sanity check to ensure that this issue does not
+       resurface.
+
 2011-07-27  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        testsuite: fix spurious failures with Solaris /bin/sh
index b97d787eab6fa8703f1437535d7e0108643d2394..977d38f4e22a7b7c90db481cdb81e6813e83e75f 100755 (executable)
@@ -47,6 +47,9 @@ END
 # /#\s*(TODO|SKIP)\b/.
 #
 
+# To avoid problems with backslashes in echo arguments.
+xecho () { printf '%s\n' "$*"; }
+
 # There are 34 values for $str ...
 for str in \
   \'  \
@@ -85,8 +88,8 @@ for str in \
   '*.*' \
 ; do
   # ... each of them add 1 pass, 1 fail, ...
-  echo "ok${str}"
-  echo "not ok${str}"
+  xecho "ok${str}"
+  xecho "not ok${str}"
   # ... and (generally) 4 skips, 4 xfails, and 4 xpasses ...
   for settings in \
     'result="ok" directive=SKIP' \
@@ -94,17 +97,23 @@ for str in \
     'result="ok" directive=TODO' \
   ; do
     eval "$settings"
-    echo "${result}# ${directive}${str}"
+    xecho "${result}# ${directive}${str}"
     # ... but 6 skips, 6 xpasses and 6 xfails are to be removed, since
     # they might not work with $str = '#' or $str = '\' ...
     if test x"$str" != x'#' && test x"$str" != x'\'; then
-      echo "${result}${str}#${directive}"
-      echo "${result}${str}#   ${tab}${tab} ${directive}"
-      echo "${result}${str}#${directive}${str}"
+      xecho "${result}${str}#${directive}"
+      xecho "${result}${str}#   ${tab}${tab} ${directive}"
+      xecho "${result}${str}#${directive}${str}"
     fi
   done
 done > all.test
 
+# Sanity check against a previous use of unportable usages of backslashes
+# with the "echo" builtin.
+if grep '[^\\]\\#' all.test; then
+  framework_failure_ "writing backslashes in all.test"
+fi
+
 # ... so that we finally have:
 pass=34
 fail=34