VirtualBox

source: kBuild/trunk/src/gmake/tests/scripts/features/parallelism@ 285

最後變更 在這個檔案從285是 285,由 bird 提交於 20 年 前

This commit was generated by cvs2svn to compensate for changes in r284,
which included commits to RCS files with non-trunk default branches.

  • 屬性 svn:eol-style 設為 native
檔案大小: 2.8 KB
 
1# -*-perl-*-
2
3$description = "Test parallelism (-j) option.";
4
5
6$details = "This test creates a makefile with two double-colon default
7rules. The first rule has a series of sleep and echo commands
8intended to run in series. The second and third have just an
9echo statement. When make is called in this test, it is given
10the -j option with a value of 4. This tells make that it may
11start up to four jobs simultaneously. In this case, since the
12first command is a sleep command, the output of the second
13and third commands will appear before the first if indeed
14make is running all of these commands in parallel.";
15
16if (!$parallel_jobs) {
17 return -1;
18}
19
20if ($vos) {
21 $delete_command = "delete_file -no_ask";
22 $sleep_command = "sleep -seconds";
23}
24else {
25 $delete_command = "rm -f";
26 $sleep_command = "sleep";
27}
28
29
30run_make_test("
31all : def_1 def_2 def_3
32def_1 : ; \@echo ONE; $sleep_command 3 ; echo TWO
33def_2 : ; \@$sleep_command 2 ; echo THREE
34def_3 : ; \@$sleep_command 1 ; echo FOUR",
35 '-j4', "ONE\nFOUR\nTHREE\nTWO");
36
37# Test parallelism with included files. Here we sleep/echo while
38# building the included files, to test that they are being built in
39# parallel.
40run_make_test("
41all: 1 2; \@echo success
42-include 1.inc 2.inc
431.inc: ; \@echo ONE.inc; $sleep_command 2; echo TWO.inc; echo '1: ; \@echo ONE; $sleep_command 2; echo TWO' > \$\@
442.inc: ; \@$sleep_command 1; echo THREE.inc; echo '2: ; \@$sleep_command 1; echo THREE' > \$\@",
45 "-j4",
46 "ONE.inc\nTHREE.inc\nTWO.inc\nONE\nTHREE\nTWO\nsuccess\n");
47
48unlink('1.inc', '2.inc');
49
50
51# Test parallelism with included files--this time recurse first and make
52# sure the jobserver works.
53run_make_test("
54recurse: ; \@\$(MAKE) --no-print-directory -f #MAKEFILE# INC=yes all
55all: 1 2; \@echo success
56
57INC = no
58ifeq (\$(INC),yes)
59-include 1.inc 2.inc
60endif
61
621.inc: ; \@echo ONE.inc; $sleep_command 2; echo TWO.inc; echo '1: ; \@echo ONE; $sleep_command 2; echo TWO' > \$\@
632.inc: ; \@$sleep_command 1; echo THREE.inc; echo '2: ; \@$sleep_command 1; echo THREE' > \$\@",
64 "-j4",
65 "ONE.inc\nTHREE.inc\nTWO.inc\nONE\nTHREE\nTWO\nsuccess\n");
66
67unlink('1.inc', '2.inc');
68
69# Grant Taylor reports a problem where tokens can be lost (not written back
70# to the pipe when they should be): this happened when there is a $(shell ...)
71# function in an exported recursive variable. I added some code to check
72# for this situation and print a message if it occurred. This test used
73# to trigger this code when I added it but no longer does after the fix.
74
75run_make_test("
76export HI = \$(shell \$(\$\@.CMD))
77first.CMD = echo hi
78second.CMD = $sleep_command 4; echo hi
79
80.PHONY: all first second
81all: first second
82
83first second: ; \@echo \$\@; $sleep_command 1; echo \$\@",
84 '-j2', "first\nfirst\nsecond\nsecond");
85
861;
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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