2 $description = "Test handling of double-colon rules.";
5 We test these features:
7 - Multiple commands for the same (double-colon) target
8 - Different prerequisites for targets: only out-of-date
10 - Double-colon targets that aren't the goal target.
12 Then we do the same thing for parallel builds: double-colon
13 targets should always be built serially.";
15 # The Contents of the MAKEFILE ...
17 open(MAKEFILE,"> $makefile");
19 print MAKEFILE <<'EOF';
23 foo:: f1.h ; @echo foo FIRST
24 foo:: f2.h ; @echo foo SECOND
26 bar:: ; @echo aaa; sleep 1; echo aaa done
46 # TEST 0: A simple double-colon rule that isn't the goal target.
48 &run_make_with_options($makefile, "all", &get_logfile, 0);
49 $answer = "aaa\nbbb\n";
50 &compare_output($answer, &get_logfile(1));
52 # TEST 1: As above, in parallel
55 &run_make_with_options($makefile, "-j10 all", &get_logfile, 0);
56 $answer = "aaa\nbbb\n";
57 &compare_output($answer, &get_logfile(1));
60 # TEST 2: A simple double-colon rule that is the goal target
62 &run_make_with_options($makefile, "bar", &get_logfile, 0);
63 $answer = "aaa\naaa done\nbbb\n";
64 &compare_output($answer, &get_logfile(1));
66 # TEST 3: As above, in parallel
69 &run_make_with_options($makefile, "-j10 bar", &get_logfile, 0);
70 $answer = "aaa\naaa done\nbbb\n";
71 &compare_output($answer, &get_logfile(1));
74 # TEST 4: Each double-colon rule is supposed to be run individually
79 &run_make_with_options($makefile, "foo", &get_logfile, 0);
80 $answer = "f1.h\nfoo FIRST\n";
81 &compare_output($answer, &get_logfile(1));
83 # TEST 5: Again, in parallel.
86 &run_make_with_options($makefile, "-j10 foo", &get_logfile, 0);
87 $answer = "f1.h\nfoo FIRST\n";
88 &compare_output($answer, &get_logfile(1));
91 # TEST 6: Each double-colon rule is supposed to be run individually
97 &run_make_with_options($makefile, "foo", &get_logfile, 0);
98 $answer = "f2.h\nfoo SECOND\n";
99 &compare_output($answer, &get_logfile(1));
101 # TEST 7: Again, in parallel.
103 if ($parallel_jobs) {
104 &run_make_with_options($makefile, "-j10 foo", &get_logfile, 0);
105 $answer = "f2.h\nfoo SECOND\n";
106 &compare_output($answer, &get_logfile(1));
109 # TEST 8: Test circular dependency check; PR/1671
111 &run_make_with_options($makefile, "d", &get_logfile, 0);
112 $answer = "ok\n$make_name: Circular d <- d dependency dropped.\noops\n";
113 &compare_output($answer, &get_logfile(1));
115 # TEST 8: I don't grok why this is different than the above, but it is...
117 # Hmm... further testing indicates this might be timing-dependent?
119 #if ($parallel_jobs) {
120 # &run_make_with_options($makefile, "-j10 biz", &get_logfile, 0);
121 # $answer = "aaa\ntwo\nbbb\n";
122 # &compare_output($answer, &get_logfile(1));
125 unlink('foo','f1.h','f2.h');