Subject: Re: bug#12778: Failure when running check-root make target

From: [email-masked]
Date: Sun, 18 Nov 2012 19:16:55 +0100 (CET)

----- Mail original -----
> De: "Matt Burgess" <[email-masked]>
> À: [email-masked]
> Cc: [email-masked]
> Envoyé: Jeudi 1 Novembre 2012 21:29:33
> Objet: bug#12778: Failure when running check-root make target
> 
> Hi,
> 
> When running 'make NON_ROOT_USERNAME=nobody check-root' on
> coreutils-8.20, I get:
> 
>   CCLD   test-xvasprintf
>   CC     test-yesno.o
>   CCLD   test-yesno
> make[6]: Leaving directory
> `/home/burgessm/sources/coreutils-8.20/gnulib-tests'
> make  check-TESTS
> make[6]: Entering directory
> `/home/burgessm/sources/coreutils-8.20/gnulib-tests'
> make[7]: Entering directory
> `/home/burgessm/sources/coreutils-8.20/gnulib-tests'
> make[7]: *** No rule to make target `tests/chown/basic.sh.log',
> needed
> by `test-suite.log'.  Stop.
> make[7]: Leaving directory
> `/home/burgessm/sources/coreutils-8.20/gnulib-tests'
> make[6]: *** [check-TESTS] Error 2
> 
> This looks a little odd to me, as it appears that its finished building
> the gnulib-tests, comes out of that directory, then immediately goes
> back in to then start running coreutils' own tests, which it has already
> successfully run.  Unless I've completely misread the logs, that is.
> 
> This is on a Fedora-17 host, in case it's caused by make (3.82) or
> something else in the toolchain.
> 
> Thanks,
> 
> Matt.
> 
> 

I think this was commit 21b5147fd8ee493727e2a3ca17b3bf695c5024d3 in v8.20 that broke the behavior.

-# Some tests always need root privileges, others need them only sometimes.
-ALL_RECURSIVE_TARGETS += check-root
-check-root:
-       cd tests && $(MAKE) $@ SUBDIRS=
-

Previously check-root was a recursive target going nowhere but in tests directory.
Now, top Makefile contain

ALL_RECURSIVE_TARGETS = distcheck-hook check-root
SUBDIRS = po . gnulib-tests

check-root:
	$(MAKE) check TESTS='$(root_tests)'

So check-root target would go in 'po . gnulib-tests' directories if not stopped by the above issue.

With coreutils-8.20, same result could be achieved using :
make NON_ROOT_USERNAME=nobody SUBDIRS= check-root

This patch allow again "make NON_ROOT_USERNAME=nobody check-root" to run without the error above.
This worked for me running autoreconf -fiv && configure again && make && make NON_ROOT_USERNAME=nobody check-root
I supposed it is not required to run both 'check-TESTS check-local' targets while running check-root, so I replaced too 'check' target by 'check-TESTS'.

Gilles

diff --git a/tests/local.mk b/tests/local.mk
index 1b0ace4..f3b4849 100644
--- a/tests/local.mk
+++ b/tests/local.mk
@@ -137,7 +137,7 @@ all_root_tests =                            \
 ALL_RECURSIVE_TARGETS += check-root
 .PHONY: check-root
 check-root:
-       $(MAKE) check TESTS='$(root_tests)'
+       $(MAKE) check-TESTS TESTS='$(root_tests)' SUBDIRS=

 # Do not choose a name that is a shell keyword like 'if', or a
 # commonly-used utility like 'cat' or 'test', as the name of a test.