From b5d6d18a1f2749612b3d0b439a43d89fabf1a719 Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Mon, 23 Apr 2012 11:16:09 +0200 Subject: [PATCH] [ng] tests: fix a spurious failure on Solaris 10 * 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 --- 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 a3380c394..02b711d9b 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 : -- 2.47.2