VirtualBox

source: kBuild/vendor/gnumake/current/tests/scripts/features/jobserver@ 3208

最後變更 在這個檔案從3208是 3138,由 bird 提交於 7 年 前

Imported make 4.2.1 (2e55f5e4abdc0e38c1d64be703b446695e70b3b6) from https://git.savannah.gnu.org/git/make.git.

  • 屬性 svn:eol-style 設為 native
檔案大小: 3.5 KB
 
1# -*-perl-*-
2
3$description = "Test jobserver.";
4
5$details = "These tests are ones that specifically are different when the
6jobserver feature is available. Most -j tests are the same whether or not
7jobserver is available, and those appear in the 'parallelism' test suite.";
8
9exists $FEATURES{'jobserver'} or return -1;
10
11if (!$parallel_jobs) {
12 return -1;
13}
14
15# Shorthand
16my $np = '--no-print-directory';
17
18# Simple test of MAKEFLAGS settings
19run_make_test(q!
20SHOW = $(patsubst --jobserver-auth=%,--jobserver-auth=<auth>,$(MAKEFLAGS))
21recurse: ; @echo $@: "/$(SHOW)/"; $(MAKE) -f #MAKEFILE# all
22all:;@echo $@: "/$(SHOW)/"
23!,
24 "-j2 $np", "recurse: /-j2 --jobserver-auth=<auth> $np/\nall: /-j2 --jobserver-auth=<auth> $np/\n");
25
26# Setting parallelism with the environment
27# Command line should take precedence over the environment
28$extraENV{MAKEFLAGS} = "-j2 $np";
29run_make_test(q!
30SHOW = $(patsubst --jobserver-auth=%,--jobserver-auth=<auth>,$(MAKEFLAGS))
31recurse: ; @echo $@: "/$(SHOW)/"; $(MAKE) -f #MAKEFILE# all
32all:;@echo $@: "/$(SHOW)/"
33!,
34 '', "recurse: /-j2 --jobserver-auth=<auth> $np/\nall: /-j2 --jobserver-auth=<auth> $np/\n");
35delete $extraENV{MAKEFLAGS};
36
37# Test override of -jN
38$extraENV{MAKEFLAGS} = "-j9 $np";
39run_make_test(q!
40SHOW = $(patsubst --jobserver-auth=%,--jobserver-auth=<auth>,$(MAKEFLAGS))
41recurse: ; @echo $@: "/$(SHOW)/"; $(MAKE) -j3 -f #MAKEFILE# recurse2
42recurse2: ; @echo $@: "/$(SHOW)/"; $(MAKE) -f #MAKEFILE# all
43all:;@echo $@: "/$(SHOW)/"
44!,
45 "-j2 $np", "recurse: /-j2 --jobserver-auth=<auth> $np/\n#MAKE#[1]: warning: -jN forced in submake: disabling jobserver mode.\nrecurse2: /-j3 --jobserver-auth=<auth> $np/\nall: /-j3 --jobserver-auth=<auth> $np/\n");
46delete $extraENV{MAKEFLAGS};
47
48# Test override of -jN with -j
49run_make_test(q!
50SHOW = $(patsubst --jobserver-auth=%,--jobserver-auth=<auth>,$(MAKEFLAGS))
51recurse: ; @echo $@: "/$(SHOW)/"; $(MAKE) -j -f #MAKEFILE# recurse2
52recurse2: ; @echo $@: "/$(SHOW)/"; $(MAKE) -f #MAKEFILE# all
53all:;@echo $@: "/$(SHOW)/"
54!,
55 "-j2 $np", "recurse: /-j2 --jobserver-auth=<auth> $np/\n#MAKE#[1]: warning: -jN forced in submake: disabling jobserver mode.\nrecurse2: /-j $np/\nall: /-j $np/\n");
56
57# Don't put --jobserver-auth into a re-exec'd MAKEFLAGS.
58# We can't test this directly because there's no way a makefile can
59# show the value of MAKEFLAGS we were re-exec'd with. We can intuit it
60# by looking for "disabling jobserver mode" warnings; we should only
61# get one from the original invocation and none from the re-exec.
62# See Savannah bug #18124
63
64unlink('inc.mk');
65
66run_make_test(q!
67-include inc.mk
68recur:
69# @echo 'MAKEFLAGS = $(MAKEFLAGS)'
70 @rm -f inc.mk
71 @$(MAKE) -j2 -f #MAKEFILE# all
72all:
73# @echo 'MAKEFLAGS = $(MAKEFLAGS)'
74 @echo $@
75inc.mk:
76# @echo 'MAKEFLAGS = $(MAKEFLAGS)'
77 @echo 'FOO = bar' > $@
78!,
79 "$np -j2", "#MAKE#[1]: warning: -jN forced in submake: disabling jobserver mode.\nall\n");
80
81unlink('inc.mk');
82
83# Test recursion when make doesn't think it exists.
84# See Savannah bug #39934
85# Or Red Hat bug https://bugzilla.redhat.com/show_bug.cgi?id=885474
86
87open(MAKEFILE,"> Makefile2");
88print MAKEFILE '
89vpath %.c ../
90foo:
91';
92close(MAKEFILE);
93
94run_make_test(q!
95default: ; @ #MAKEPATH# -f Makefile2
96!,
97 "-j2 $np",
98"#MAKE#[1]: warning: jobserver unavailable: using -j1. Add '+' to parent make rule.
99#MAKE#[1]: Nothing to be done for 'foo'.");
100
101rmfiles('Makefile2');
102
1031;
104
105### Local Variables:
106### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action))
107### End:
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette