[patch v1] nptl: smarter not-parallel-ing

Florian Weimer fw@deneb.enyo.de
Wed Aug 14 05:18:00 GMT 2019


* DJ Delorie:

> diff --git a/nptl/Makefile b/nptl/Makefile
> index 0567e77a79..d7a3857c95 100644
> --- a/nptl/Makefile
> +++ b/nptl/Makefile
> @@ -666,7 +666,7 @@ $(objpfx)tst-cleanup0.out: /dev/null $(objpfx)tst-cleanup0
>  	$(evaluate-test)
>  
>  $(objpfx)tst-cleanup0-cmp.out: tst-cleanup0.expect $(objpfx)tst-cleanup0.out
> -	cmp $^ > $@; \
> +	cmp tst-cleanup0.expect $(objpfx)tst-cleanup0.out > $@; \
>  	$(evaluate-test)

Why is this needed if | prerequisites are not listed in $^?

> +ifeq ($(run-built-tests),yes)
> +# The tests in this subdir should not be run in parallel.
> +#
> +# The following will create rules like "foo2.out :| foo1.out" for all
> +# tests, which forces the tests to be run serially, but does not force
> +# a test to be run just because some other test was run.
> +#
> +# Caveat: the :|-style dependencies won't be listed in $^, so avoid
> +# using $^ to depend on test result files.
> +
> +ALLTESTS = $(tests:%=$(objpfx)%.out) $(tests-internal:%=$(objpfx)%.out) \
> +	$(tests-container:%=$(objpfx)%.out) \
> +	$(tests-special) $(tests-printers-out) \
> +	$(xtests:%=$(objpfx)%.out) $(xtests-special)
> +
> +ALLBUTFIRSTTEST = $(filter-out $(firstword $(ALLTESTS)), $(ALLTESTS))
> +ALLBUTLASTTEST = $(filter-out $(lastword $(ALLTESTS)), $(ALLTESTS))
> +TESTPAIRS = $(join $(ALLBUTFIRSTTEST),$(addprefix :|,$(ALLBUTLASTTEST)))
> +$(foreach pair,$(TESTPAIRS),$(eval $(pair)))
>  endif

I would have used different variable names (lowercase, perhaps with an
nptl- prefix), but that's just a detail.  The $(filter-out …)
construct is awkward, but I don't see a better way.



More information about the Libc-alpha mailing list