tests: avoid spurious failure when running as root
authorStefano Lattarini <stefano.lattarini@gmail.com>
Wed, 25 Jul 2012 10:40:10 +0000 (12:40 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Wed, 25 Jul 2012 10:40:10 +0000 (12:40 +0200)
Fixes automake bug#12041.

* t/primary-prefix-couples-force-valid.sh: If run as root, don't expect
a "test -x" on a non-executable files to fail: for root, all files are
executable (as well as readable and writable), and at least on Solaris
10 that causes "test -x" to succeed also on non-executable files.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
t/primary-prefix-couples-force-valid.sh

index 23b56c3..ac539a1 100755 (executable)
@@ -54,7 +54,12 @@ test:
        test -f '$(bindir)/libquux.a'
        ls -l '$(libexecdir)/bar.h'
        test -f '$(libexecdir)/bar.h'
-       test ! -x '$(libexecdir)/bar.h'
+## If this test is run as root, "test -x" could suceed also for
+## non-executable files, so we need to protect the next check.
+## See automake bug#12041.
+       if test -x Makefile; then echo SKIP THIS; else \
+         test ! -x '$(libexecdir)/bar.h'; \
+       fi;
 END
 
 cat > foo.c <<'END'