]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
[ng] tests: fix a spurious failure on Solaris 10
authorStefano Lattarini <stefano.lattarini@gmail.com>
Mon, 23 Apr 2012 09:16:09 +0000 (11:16 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Mon, 23 Apr 2012 09:40:49 +0000 (11:40 +0200)
* t/parallel-tests-unreadable.sh: On Solaris 10, on an error due to missing
read permission, 'cat' reports simply "cat: cannot open FILENAME", rather
than a proper "Permission denied" message; similarly fr grep.  Adjust the
test (and comments) to cater for that.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
t/parallel-tests-unreadable.sh

index a3380c394fd7f26a009a18a4268bc77e8425ebcf..02b711d9bf40756dca62110b90ce1fdc46366a6c 100755 (executable)
@@ -60,31 +60,44 @@ doit ()
   cat stderr >&2
 }
 
-permission_denied ()
+could_not_read ()
 {
-  # FIXME: there are systems where errors on permissions generate a
-  # FIXME: different message?  We might experience spurious failures
-  # FIXME: there ...
-  grep "$1:.*[pP]ermission denied" stderr
+  # We have to settle for weak checks to avoid spurious failures due to
+  # the differences in error massages on different systems; for example:
+  #
+  #   $ cat unreadable-file # GNU/Linux or NetBSD
+  #   cat: unreadable-file: Permission denied
+  #   $ cat unreadable-file # Solaris 10
+  #   cat: cannot open unreadable
+  #
+  #   $ grep foo unreadable-file # GNU/Linux and NetBSD
+  #   grep: unreadable: Permission denied
+  #   $ grep foo unreadable-file # Solaris 10
+  #   grep: can't open "unreadable"
+  #
+  # FIXME: this might still needs adjustments on other systems ...
+  #
+  grep "$1:.*[pP]ermission denied" stderr \
+    || $EGREP "can(no|')t open [\"'\`]?$1" stderr
 }
 
 for lst in bar.log 'foo.log bar.log'; do
   doit $lst
-  permission_denied bar.log
+  could_not_read bar.log
   grep 'test-suite\.log:.* I/O error reading test logs' stderr
 done
 
 doit foo.trs
-permission_denied foo.trs
+could_not_read foo.trs
 grep 'test-suite\.log:.* I/O error reading test results' stderr
 
 doit foo.trs bar.trs
-permission_denied foo.trs
-permission_denied bar.trs
+could_not_read foo.trs
+could_not_read bar.trs
 grep 'test-suite\.log:.* I/O error reading test results' stderr
 
 doit foo.trs bar.log
-permission_denied foo.trs
+could_not_read foo.trs
 grep 'test-suite\.log:.* I/O error reading test results' stderr
 
 :