3 $description = "Test the behaviour of the .WAIT target.";
7 # Ensure .WAIT doesn't appear in any automatic variables
10 all: .WAIT pre1 .WAIT pre2 | .WAIT pre3 ; @echo '<=$< ^=$^ ?=$? +=$+ |=$|'
13 # This is just here so we don't fail with older versions of make
16 '', '<=pre1 ^=pre1 pre2 ?=pre1 pre2 +=pre1 pre2 |=pre3');
20 all: $$(pre) ; @echo '<=$< ^=$^ ?=$? +=$+ |=$|'
23 pre = .WAIT pre1 .WAIT pre2 | .WAIT pre3
24 # This is just here so we don't fail with older versions of make
27 '', '<=pre1 ^=pre1 pre2 ?=pre1 pre2 +=pre1 pre2 |=pre3');
31 p% : .WAIT p%1 .WAIT p%2 | .WAIT p%3; @echo '<=$< ^=$^ ?=$? +=$+ |=$|'
34 # This is just here so we don't fail with older versions of make
37 '', "<=pre1 ^=pre1 pre2 ?=pre1 pre2 +=pre1 pre2 |=pre3\n");
39 # Unfortunately I don't think we can get away from using sleep here; at least
40 # I can't think of any way to make sure .WAIT works without it. Even with it,
41 # it's not reliable (in that even if .WAIT is not working we MIGHT succeed the
42 # test--it shouldn't ever be the case that we fail the test unexpectedly).
43 # That makes this test suite slow to run :-/.
47 pre1: ; @#HELPER# -q out start-$@ sleep 1 out end-$@
48 pre2: ; @#HELPER# -q out $@
50 # This is just here so we don't fail with older versions of make
53 '-j10', "start-pre1\nend-pre1\npre2\n");
55 # Ensure .WAIT doesn't add extra a dependency between its targets
57 run_make_test(undef, '-j10 pre2', "pre2\n");
59 # Ensure .WAIT doesn't wait between all targets
62 all : pre1 .WAIT pre2 pre3
63 pre1: ; @#HELPER# -q out start-$@ sleep 1 out end-$@
64 pre2: ; @#HELPER# -q out start-$@ file TWO wait THREE out end-$@
65 pre3: ; @#HELPER# -q wait TWO out $@ file THREE
67 # This is just here so we don't fail with older versions of make
70 '-j10', "start-pre1\nend-pre1\nstart-pre2\npre3\nend-pre2\n");
72 unlink(qw(TWO THREE));
74 # Ensure .WAIT waits for ALL targets on the left before ANY targets on the right
77 all : pre1 pre2 .WAIT post1 post2
78 pre1: ; @#HELPER# -q out start-$@ file PRE1 wait PRE2 sleep 1 out end-$@
79 pre2: ; @#HELPER# -q wait PRE1 out $@ file PRE2
81 post1: ; @#HELPER# -q wait POST2 out $@ file POST1
82 post2: ; @#HELPER# -q file POST2 wait POST1 out $@
84 # This is just here so we don't fail with older versions of make
87 '-j10', "start-pre1\npre2\nend-pre1\npost1\npost2\n");
89 unlink(qw(PRE1 PRE2 POST1 POST2));
91 # See if .WAIT takes effect between different lists of prereqs
92 # In the current implementation, .WAIT waits only between two prerequisites
93 # in a given target. These same two targets might be run in a different
94 # order if they appear as prerequisites of another target. This is the way
95 # other implementations of .WAIT work. I personally think it's gross and
96 # makes .WAIT just a toy when it comes to ordering, but it's much simpler
97 # to implement than creating an actual edge in the DAG to represent .WAIT
98 # and since that's what users expect, we'll do the same for now.
104 pre1: ; @#HELPER# -q out start-$@ file PRE1 wait PRE2 out end-$@
105 pre2: ; @#HELPER# -q wait PRE1 out $@ file PRE2
108 # This is just here so we don't fail with older versions of make
111 '-j10', "start-pre1\npre2\nend-pre1\n");
112 unlink(qw(PRE1 PRE2));
114 # Check that .WAIT works with pattern rules
119 pre1: ; @#HELPER# -q out start-$@ sleep 1 out end-$@
120 pre2: ; @#HELPER# -q out $@
122 # This is just here so we don't fail with older versions of make
125 '-j10', "start-pre1\nend-pre1\npre2\n");
127 # Check that .WAIT works with secondarily expanded rules
132 pre1: ; @#HELPER# -q out start-$@ sleep 1 out end-$@
133 pre2: ; @#HELPER# -q out $@
134 pre3: ; @#HELPER# -q out $@
136 pre = .WAIT pre1 .WAIT pre2 | .WAIT pre3
138 # This is just here so we don't fail with older versions of make
141 '-j10', "start-pre1\nend-pre1\npre2\npre3\n");
143 # Verify NOTPARALLEL works
147 pre1: ; @#HELPER# -q out start-$@ sleep 1 out end-$@
148 pre2: ; @#HELPER# -q out $@
152 '-j10', "start-pre1\nend-pre1\npre2\n");
158 pre1: ; @#HELPER# -q out start-$@ file PRE1 wait PRE2 out end-$@
159 pre2: ; @#HELPER# -q wait PRE1 out $@ file PRE2
163 npre1: ; @#HELPER# -q out start-$@ sleep 1 out end-$@
164 npre2: ; @#HELPER# -q out $@
168 '-j10', "start-pre1\npre2\nend-pre1\nstart-npre1\nend-npre1\nnpre2\n");
169 unlink(qw(PRE1 PRE2));
171 # Ensure we don't shuffle if .WAIT is set
174 all : pre1 .WAIT pre2
175 pre1: ; @#HELPER# -q out start-$@ sleep 1 out end-$@
176 pre2: ; @#HELPER# -q out $@
178 # This is just here so we don't fail with older versions of make
181 '-j10 --shuffle=reverse', "start-pre1\nend-pre1\npre2\n");
183 # Warn about invalid .WAIT definitions
190 '', "#MAKEFILE#:2: .WAIT should not have prerequisites\n#MAKEFILE#:3: .WAIT should not have commands\n");
192 # This tells the test driver that the perl test script executed properly.