2013-09-21 22:10:08 +00:00
|
|
|
# -*-perl-*-
|
|
|
|
|
|
|
|
$description = "Test jobserver.";
|
|
|
|
|
|
|
|
$details = "These tests are ones that specifically are different when the
|
|
|
|
jobserver feature is available. Most -j tests are the same whether or not
|
|
|
|
jobserver is available, and those appear in the 'parallelism' test suite.";
|
|
|
|
|
|
|
|
exists $FEATURES{'jobserver'} or return -1;
|
|
|
|
|
|
|
|
if (!$parallel_jobs) {
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2016-04-04 05:23:04 +00:00
|
|
|
# Shorthand
|
|
|
|
my $np = '--no-print-directory';
|
|
|
|
|
|
|
|
# Simple test of MAKEFLAGS settings
|
|
|
|
run_make_test(q!
|
|
|
|
SHOW = $(patsubst --jobserver-auth=%,--jobserver-auth=<auth>,$(MAKEFLAGS))
|
|
|
|
recurse: ; @echo $@: "/$(SHOW)/"; $(MAKE) -f #MAKEFILE# all
|
|
|
|
all:;@echo $@: "/$(SHOW)/"
|
|
|
|
!,
|
|
|
|
"-j2 $np", "recurse: /-j2 --jobserver-auth=<auth> $np/\nall: /-j2 --jobserver-auth=<auth> $np/\n");
|
|
|
|
|
|
|
|
# Setting parallelism with the environment
|
|
|
|
# Command line should take precedence over the environment
|
|
|
|
$extraENV{MAKEFLAGS} = "-j2 $np";
|
|
|
|
run_make_test(q!
|
|
|
|
SHOW = $(patsubst --jobserver-auth=%,--jobserver-auth=<auth>,$(MAKEFLAGS))
|
|
|
|
recurse: ; @echo $@: "/$(SHOW)/"; $(MAKE) -f #MAKEFILE# all
|
|
|
|
all:;@echo $@: "/$(SHOW)/"
|
|
|
|
!,
|
|
|
|
'', "recurse: /-j2 --jobserver-auth=<auth> $np/\nall: /-j2 --jobserver-auth=<auth> $np/\n");
|
|
|
|
delete $extraENV{MAKEFLAGS};
|
|
|
|
|
|
|
|
# Test override of -jN
|
|
|
|
$extraENV{MAKEFLAGS} = "-j9 $np";
|
|
|
|
run_make_test(q!
|
|
|
|
SHOW = $(patsubst --jobserver-auth=%,--jobserver-auth=<auth>,$(MAKEFLAGS))
|
|
|
|
recurse: ; @echo $@: "/$(SHOW)/"; $(MAKE) -j3 -f #MAKEFILE# recurse2
|
|
|
|
recurse2: ; @echo $@: "/$(SHOW)/"; $(MAKE) -f #MAKEFILE# all
|
|
|
|
all:;@echo $@: "/$(SHOW)/"
|
|
|
|
!,
|
2017-10-30 16:53:49 +00:00
|
|
|
"-j2 $np", "recurse: /-j2 --jobserver-auth=<auth> $np/\n#MAKE#[1]: warning: -j3 forced in submake: resetting jobserver mode.\nrecurse2: /-j3 --jobserver-auth=<auth> $np/\nall: /-j3 --jobserver-auth=<auth> $np/\n");
|
2016-04-04 05:23:04 +00:00
|
|
|
delete $extraENV{MAKEFLAGS};
|
|
|
|
|
|
|
|
# Test override of -jN with -j
|
|
|
|
run_make_test(q!
|
|
|
|
SHOW = $(patsubst --jobserver-auth=%,--jobserver-auth=<auth>,$(MAKEFLAGS))
|
|
|
|
recurse: ; @echo $@: "/$(SHOW)/"; $(MAKE) -j -f #MAKEFILE# recurse2
|
|
|
|
recurse2: ; @echo $@: "/$(SHOW)/"; $(MAKE) -f #MAKEFILE# all
|
|
|
|
all:;@echo $@: "/$(SHOW)/"
|
|
|
|
!,
|
2017-10-30 16:53:49 +00:00
|
|
|
"-j2 $np", "recurse: /-j2 --jobserver-auth=<auth> $np/\n#MAKE#[1]: warning: -j0 forced in submake: resetting jobserver mode.\nrecurse2: /-j $np/\nall: /-j $np/\n");
|
2016-04-04 05:23:04 +00:00
|
|
|
|
2016-04-02 20:29:48 +00:00
|
|
|
# Don't put --jobserver-auth into a re-exec'd MAKEFLAGS.
|
2013-09-21 22:10:08 +00:00
|
|
|
# We can't test this directly because there's no way a makefile can
|
|
|
|
# show the value of MAKEFLAGS we were re-exec'd with. We can intuit it
|
|
|
|
# by looking for "disabling jobserver mode" warnings; we should only
|
|
|
|
# get one from the original invocation and none from the re-exec.
|
|
|
|
# See Savannah bug #18124
|
|
|
|
|
2013-09-22 15:28:46 +00:00
|
|
|
unlink('inc.mk');
|
|
|
|
|
2013-09-21 22:10:08 +00:00
|
|
|
run_make_test(q!
|
|
|
|
-include inc.mk
|
|
|
|
recur:
|
|
|
|
# @echo 'MAKEFLAGS = $(MAKEFLAGS)'
|
|
|
|
@rm -f inc.mk
|
|
|
|
@$(MAKE) -j2 -f #MAKEFILE# all
|
|
|
|
all:
|
|
|
|
# @echo 'MAKEFLAGS = $(MAKEFLAGS)'
|
|
|
|
@echo $@
|
|
|
|
inc.mk:
|
|
|
|
# @echo 'MAKEFLAGS = $(MAKEFLAGS)'
|
|
|
|
@echo 'FOO = bar' > $@
|
|
|
|
!,
|
2017-10-30 16:53:49 +00:00
|
|
|
"$np -j2", "#MAKE#[1]: warning: -j2 forced in submake: resetting jobserver mode.\nall\n");
|
2013-09-21 22:10:08 +00:00
|
|
|
|
2013-09-22 15:28:46 +00:00
|
|
|
unlink('inc.mk');
|
2013-09-21 22:10:08 +00:00
|
|
|
|
2018-07-01 20:13:13 +00:00
|
|
|
# Test recursion which is hidden from make.
|
2013-09-21 22:10:08 +00:00
|
|
|
# See Savannah bug #39934
|
|
|
|
# Or Red Hat bug https://bugzilla.redhat.com/show_bug.cgi?id=885474
|
2018-07-01 20:13:13 +00:00
|
|
|
# Windows doesn't use a pipe, and doesn't close access, so this won't happen.
|
|
|
|
if ($port_type ne 'W32') {
|
|
|
|
open(MAKEFILE,"> Makefile2");
|
|
|
|
print MAKEFILE '
|
|
|
|
vpath %.c ../
|
|
|
|
foo:
|
|
|
|
';
|
|
|
|
close(MAKEFILE);
|
|
|
|
|
|
|
|
run_make_test(q!
|
2013-09-21 22:10:08 +00:00
|
|
|
default: ; @ #MAKEPATH# -f Makefile2
|
|
|
|
!,
|
2016-04-04 05:23:04 +00:00
|
|
|
"-j2 $np",
|
2013-09-21 22:10:08 +00:00
|
|
|
"#MAKE#[1]: warning: jobserver unavailable: using -j1. Add '+' to parent make rule.
|
|
|
|
#MAKE#[1]: Nothing to be done for 'foo'.");
|
|
|
|
|
2018-07-01 20:13:13 +00:00
|
|
|
rmfiles('Makefile2');
|
|
|
|
}
|
2013-09-21 22:10:08 +00:00
|
|
|
|
|
|
|
1;
|
2016-04-02 20:29:48 +00:00
|
|
|
|
|
|
|
### Local Variables:
|
|
|
|
### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action))
|
|
|
|
### End:
|