automake-ng
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Automake-ng] [PATCH 10/10] [ng] tests: fix a spurious failure on Solari


From: Stefano Lattarini
Subject: [Automake-ng] [PATCH 10/10] [ng] tests: fix a spurious failure on Solaris 10
Date: Mon, 23 Apr 2012 11:57:28 +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 <address@hidden>
---
 t/parallel-tests-unreadable.sh |   33 +++++++++++++++++++++++----------
 1 file changed, 23 insertions(+), 10 deletions(-)

diff --git a/t/parallel-tests-unreadable.sh b/t/parallel-tests-unreadable.sh
index a3380c3..02b711d 100755
--- a/t/parallel-tests-unreadable.sh
+++ b/t/parallel-tests-unreadable.sh
@@ -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
 
 :
-- 
1.7.9.5




reply via email to

[Prev in Thread] Current Thread [Next in Thread]