Subject: Re: bug#12041: Issues running the testsuite as root

From: Stefano Lattarini <[email-masked]>
Date: Wed, 25 Jul 2012 12:41:56 +0200

tags 12041 + patch
thanks

Hi Dennis.

Stefano Lattarini wrote:
>
> Hah!  It happens because you are running the test as root.  My advice
> is: don't do that.  Still, since this seems to be the only spurious
> failure experienced due to the extra privileges, it might be worth
> fixing it, since that would be pretty easy to so.  So I'm not closing
> this bug report yet.
>
The attached patch should solve the issue.  Could you give it a try?

Thanks,
  Stefano
>From d1a7148c7094f9d7bf188e90f072a01c7b5279ca Mon Sep 17 00:00:00 2001
Message-Id: <d1a7148c7[email-masked]>
From: Stefano Lattarini <[email-masked]>
Date: Wed, 25 Jul 2012 12:40:10 +0200
Subject: [PATCH] tests: avoid spurious failure when running as root

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 <[email-masked]>
---
 t/primary-prefix-couples-force-valid.sh | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/t/primary-prefix-couples-force-valid.sh b/t/primary-prefix-couples-force-valid.sh
index 23b56c3..ac539a1 100755
--- a/t/primary-prefix-couples-force-valid.sh
+++ b/t/primary-prefix-couples-force-valid.sh
@@ -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'
-- 
1.7.12.rc0