When compiling without sys/acl.h or any of various other conditions that inhibit use of ACL support, these two tests would fail: (for the record, this happened on Fedora 9 for me, but that's not really pertinent)
FAIL: test-file-has-acl.sh.log FAIL: test-copy-acl.sh.log That's because the acl code would be compiled with #define USE_ACL 0 My fix is simply to skip the two tests. However, informing the test code about the USE_ACL=0 setting (available in config.h) is tricky, since the test cannot easily know in which directory the package choose to put config.h. In other acl-related tests in coreutils proper, I do something like this: grep '^#define USE_ACL 0' $CONFIG_HEADER > /dev/null && { echo "Skipping test: insufficient ACL support" exit 77 } but to do that, I had to hard-code the knowledge (coreutils-specific) that config.h is in lib/ via this: TESTS_ENVIRONMENT = \ ... CONFIG_HEADER='$(abs_top_builddir)/lib/config.h' \ However, a cleaner solution is to AC_SUBST a shell variable (I chose that same name), USE_ACL, and push it through make to the scripts that use it: Bruno, I think you wrote the test, so I'll wait to hear from you before pushing. >From 07303f6f2d9c519b521709ac4f4359936a91d199 Mon Sep 17 00:00:00 2001 From: Jim Meyering <[EMAIL PROTECTED]> Date: Mon, 15 Sep 2008 14:37:49 +0200 Subject: [PATCH] avoid spurious test failure when library is built without ACL support * m4/acl.m4 (USE_ACL): Define as a shell variable, too, for... * modules/acl-tests (Makefile.am) [TESTS_ENVIRONMENT]: Add USE_ACL. * tests/test-file-has-acl.sh: Skip if USE_ACL == 0. * tests/test-copy-acl.sh: Likewise. --- ChangeLog | 8 ++++++++ m4/acl.m4 | 2 ++ modules/acl-tests | 2 +- tests/test-copy-acl.sh | 6 ++++++ tests/test-file-has-acl.sh | 6 ++++++ 5 files changed, 23 insertions(+), 1 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6817f88..98417ec 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2008-09-15 Jim Meyering <[EMAIL PROTECTED]> + + avoid spurious test failure when library is built without ACL support + * m4/acl.m4 (USE_ACL): Define as a shell variable, too, for... + * modules/acl-tests (Makefile.am) [TESTS_ENVIRONMENT]: Add USE_ACL. + * tests/test-file-has-acl.sh: Skip if USE_ACL == 0. + * tests/test-copy-acl.sh: Likewise. + 2008-09-15 Bruno Haible <[EMAIL PROTECTED]> * doc/posix-headers/errno.texi: Mention the Cygwin problem. diff --git a/m4/acl.m4 b/m4/acl.m4 index 494ce4b..08342d0 100644 --- a/m4/acl.m4 +++ b/m4/acl.m4 @@ -121,6 +121,8 @@ int type = ACL_TYPE_EXTENDED;]], AC_SUBST([LIB_ACL]) AC_DEFINE_UNQUOTED([USE_ACL], [$use_acl], [Define to nonzero if you want access control list support.]) + USE_ACL=$use_acl + AC_SUBST([USE_ACL]) ]) # gl_ACL_GET_FILE(IF-WORKS, IF-NOT) diff --git a/modules/acl-tests b/modules/acl-tests index 04e004c..0aacd41 100644 --- a/modules/acl-tests +++ b/modules/acl-tests @@ -17,7 +17,7 @@ configure.ac: Makefile.am: TESTS += test-file-has-acl.sh test-set-mode-acl.sh test-copy-acl.sh -TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' +TESTS_ENVIRONMENT += EXEEXT='@EXEEXT@' USE_ACL=$(USE_ACL) check_PROGRAMS += test-file-has-acl test-set-mode-acl test-copy-acl test-sameacls test_file_has_acl_LDADD = $(LDADD) $(LIB_ACL) test_set_mode_acl_LDADD = $(LDADD) $(LIB_ACL) @LIBINTL@ diff --git a/tests/test-copy-acl.sh b/tests/test-copy-acl.sh index 6d59702..9e20e77 100755 --- a/tests/test-copy-acl.sh +++ b/tests/test-copy-acl.sh @@ -3,6 +3,12 @@ # Show all commands when run with environment variable VERBOSE=yes. test -z "$VERBOSE" || set -x +test "$USE_ACL" = 0 && + { + echo "Skipping test: insufficient ACL support" + exit 77 + } + # func_tmpdir # creates a temporary directory. # Sets variable diff --git a/tests/test-file-has-acl.sh b/tests/test-file-has-acl.sh index e2dbe9d..9783960 100755 --- a/tests/test-file-has-acl.sh +++ b/tests/test-file-has-acl.sh @@ -3,6 +3,12 @@ # Show all commands when run with environment variable VERBOSE=yes. test -z "$VERBOSE" || set -x +test "$USE_ACL" = 0 && + { + echo "Skipping test: insufficient ACL support" + exit 77 + } + # func_tmpdir # creates a temporary directory. # Sets variable -- 1.6.0.2.229.g1293c