From: Jim Meyering Date: Fri, 18 Apr 2008 13:51:18 +0000 (+0200) Subject: tests: clean up root tests; adapt to new layout X-Git-Tag: v6.12~107 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b214b51ca01f4b81f4381aa7ac7c3dba2911d588;p=thirdparty%2Fcoreutils.git tests: clean up root tests; adapt to new layout * tests/Makefile.am (root_tests): New list. (check-root): Add 'SUBDIRS='. (root-hint): Point to README. * Makefile.am (check-root): Add 'SUBDIRS=' here, too. * maint.mk (sc_root_tests): Adapt rule to new syntax used in tests/Makefile.am. --- diff --git a/Makefile.am b/Makefile.am index 91ce284917..14f777ecb6 100644 --- a/Makefile.am +++ b/Makefile.am @@ -57,7 +57,7 @@ ACLOCAL_AMFLAGS = -I m4 # Some tests always need root privileges, others need them only sometimes. check-root: - cd tests && $(MAKE) $@ + cd tests && $(MAKE) $@ SUBDIRS= # Just prior to distribution, ... # transform the automake-generated rule that runs `rm -f rm'. diff --git a/maint.mk b/maint.mk index 6083583eef..586596b458 100644 --- a/maint.mk +++ b/maint.mk @@ -266,14 +266,17 @@ sc_prohibit_jm_in_m4: { echo '$(ME): do not use jm_ in m4 macro names' \ 1>&2; exit 1; } || : +# Ensure that each root-requiring test is run via the "check-root" rule. sc_root_tests: @if test -d tests \ && grep check-root tests/Makefile.am>/dev/null 2>&1; then \ t1=sc-root.expected; t2=sc-root.actual; \ grep -nl '^require_root_$$' \ - $$($(VC_LIST) tests) |sed s,tests,., |sort > $$t1; \ - sed -n 's, cd \([^ ]*\) .*MAKE..check TESTS=\(.*\),./\1/\2,p' \ - $(srcdir)/tests/Makefile.am |sort > $$t2; \ + $$($(VC_LIST) tests) |sed s,tests/,, |sort > $$t1; \ + sed -n '/^root_tests =[ ]*\\$$/,/[^\]$$/p' \ + $(srcdir)/tests/Makefile.am \ + | sed 's/^ *//;/^root_tests =/d' \ + | tr -s '\012\\' ' ' | fmt -1 | sort > $$t2; \ diff -u $$t1 $$t2 || diff=1; \ rm -f $$t1 $$t2; \ test "$$diff" \ diff --git a/tests/Makefile.am b/tests/Makefile.am index 8893f74bb4..83e96e61b3 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -30,36 +30,24 @@ EXTRA_DIST = \ SUBDIRS = cut head join pr sort tac tail test tr uniq wc ## N O T E :: Please do not add new directories. -all_t = t1 t2 t3 t4 t5 t6 t7 t8 t9 ta tb tc td -.PHONY: check-root $(all_t) -check-root: $(all_t) +root_tests = \ + chown/basic \ + cp/cp-a-selinux \ + cp/preserve-gid \ + cp/special-bits \ + ls/nameless-uid \ + misc/chcon \ + mkdir/writable-under-readonly \ + mv/sticky-to-xpart \ + rm/fail-2eperm \ + rm/no-give-up \ + rm/one-file-system \ + tail-2/append-only \ + touch/now-owned-by-other -t1: - $(MAKE) check TESTS=chown/basic -t2: - $(MAKE) check TESTS=cp/special-bits -t3: - $(MAKE) check TESTS=rm/no-give-up -t4: - $(MAKE) check TESTS=rm/fail-2eperm -t5: - $(MAKE) check TESTS=tail-2/append-only -t6: - $(MAKE) check TESTS=rm/one-file-system -t7: - $(MAKE) check TESTS=ls/nameless-uid -t8: - $(MAKE) check TESTS=misc/chcon -t9: - $(MAKE) check TESTS=cp/cp-a-selinux -ta: - $(MAKE) check TESTS=mkdir/writable-under-readonly -tb: - $(MAKE) check TESTS=mv/sticky-to-xpart -tc: - $(MAKE) check TESTS=cp/preserve-gid -td: - $(MAKE) check TESTS=touch/now-owned-by-other +.PHONY: check-root +check-root: + $(MAKE) check TESTS='$(root_tests)' SUBDIRS= check-recursive: root-hint @@ -68,7 +56,7 @@ check-recursive: root-hint root-hint: @echo '***********************************************************' @echo "NOTICE: Some tests may be run only as root." - @echo " Do \`make check-root' as \`root' to run these tests." + @echo " See the 'Running tests as root' section in README." @echo '***********************************************************' EXTRA_DIST += $(TESTS)