Last change
on this file since 1982 was 1982, checked in by bird, 16 years ago |
two more -j sensitive tests found during valgrind run.
|
-
Property svn:eol-style
set to
LF
-
Property svn:keywords
set to
Author Date Id Revision
|
File size:
2.5 KB
|
Line | |
---|
1 | # -*-perl-*-
|
---|
2 | $description = "Test second expansion in ordinary rules.";
|
---|
3 |
|
---|
4 | $details = "";
|
---|
5 |
|
---|
6 | use Cwd;
|
---|
7 |
|
---|
8 | $dir = cwd;
|
---|
9 | $dir =~ s,.*/([^/]+)$,../$1,;
|
---|
10 |
|
---|
11 |
|
---|
12 | # Test #1: automatic variables.
|
---|
13 | #
|
---|
14 | run_make_test('
|
---|
15 | .SECONDEXPANSION:
|
---|
16 | .DEFAULT: ; @echo $@
|
---|
17 |
|
---|
18 | foo.a: bar baz
|
---|
19 |
|
---|
20 | foo.a: biz | buz
|
---|
21 |
|
---|
22 | foo.%: 1.$$@ \
|
---|
23 | 2.$$< \
|
---|
24 | $$(addprefix 3.,$$^) \
|
---|
25 | $$(addprefix 4.,$$+) \
|
---|
26 | 5.$$| \
|
---|
27 | 6.$$*
|
---|
28 | @:
|
---|
29 |
|
---|
30 | 1.foo.a \
|
---|
31 | 2.bar \
|
---|
32 | 3.bar \
|
---|
33 | 3.baz \
|
---|
34 | 3.biz \
|
---|
35 | 4.bar \
|
---|
36 | 4.baz \
|
---|
37 | 4.biz \
|
---|
38 | 5.buz \
|
---|
39 | 6.a:
|
---|
40 | @echo $@
|
---|
41 |
|
---|
42 | ',
|
---|
43 | '-j1',
|
---|
44 | '1.foo.a
|
---|
45 | 2.bar
|
---|
46 | 3.bar
|
---|
47 | 3.baz
|
---|
48 | 3.biz
|
---|
49 | 4.bar
|
---|
50 | 4.baz
|
---|
51 | 4.biz
|
---|
52 | 5.buz
|
---|
53 | 6.a
|
---|
54 | bar
|
---|
55 | baz
|
---|
56 | biz
|
---|
57 | buz
|
---|
58 | ');
|
---|
59 |
|
---|
60 |
|
---|
61 | # Test #2: target/pattern -specific variables.
|
---|
62 | #
|
---|
63 | run_make_test('
|
---|
64 | .SECONDEXPANSION:
|
---|
65 | foo.x:
|
---|
66 |
|
---|
67 | foo.%: $$(%_a) $$(%_b) bar
|
---|
68 | @:
|
---|
69 |
|
---|
70 | foo.x: x_a := bar
|
---|
71 |
|
---|
72 | %.x: x_b := baz
|
---|
73 |
|
---|
74 | bar baz: ; @echo $@
|
---|
75 |
|
---|
76 | ',
|
---|
77 | '',
|
---|
78 | 'bar
|
---|
79 | baz
|
---|
80 | ');
|
---|
81 |
|
---|
82 |
|
---|
83 | # Test #3: order of prerequisites.
|
---|
84 | #
|
---|
85 | run_make_test('
|
---|
86 | .SECONDEXPANSION:
|
---|
87 | .DEFAULT: ; @echo $@
|
---|
88 |
|
---|
89 | all: foo bar baz
|
---|
90 |
|
---|
91 |
|
---|
92 | # Subtest #1
|
---|
93 | #
|
---|
94 | %oo: %oo.1; @:
|
---|
95 |
|
---|
96 | foo: foo.2
|
---|
97 |
|
---|
98 | foo: foo.3
|
---|
99 |
|
---|
100 | foo.1: ; @echo $@
|
---|
101 |
|
---|
102 |
|
---|
103 | # Subtest #2
|
---|
104 | #
|
---|
105 | bar: bar.2
|
---|
106 |
|
---|
107 | %ar: %ar.1; @:
|
---|
108 |
|
---|
109 | bar: bar.3
|
---|
110 |
|
---|
111 | bar.1: ; @echo $@
|
---|
112 |
|
---|
113 |
|
---|
114 | # Subtest #3
|
---|
115 | #
|
---|
116 | baz: baz.1
|
---|
117 |
|
---|
118 | baz: baz.2
|
---|
119 |
|
---|
120 | %az: ; @:
|
---|
121 |
|
---|
122 | ',
|
---|
123 | '-j1',
|
---|
124 | 'foo.1
|
---|
125 | foo.2
|
---|
126 | foo.3
|
---|
127 | bar.1
|
---|
128 | bar.2
|
---|
129 | bar.3
|
---|
130 | baz.1
|
---|
131 | baz.2
|
---|
132 | ');
|
---|
133 |
|
---|
134 |
|
---|
135 | # Test #4: stem splitting logic.
|
---|
136 | #
|
---|
137 | run_make_test('
|
---|
138 | .SECONDEXPANSION:
|
---|
139 | $(dir)/tmp/bar.o:
|
---|
140 |
|
---|
141 | $(dir)/tmp/foo/bar.c: ; @echo $@
|
---|
142 | $(dir)/tmp/bar/bar.c: ; @echo $@
|
---|
143 | foo.h: ; @echo $@
|
---|
144 |
|
---|
145 | %.o: $$(addsuffix /%.c,foo bar) foo.h
|
---|
146 | @echo $@: {$<} $^
|
---|
147 |
|
---|
148 | ',
|
---|
149 | "dir=$dir",
|
---|
150 | "$dir/tmp/foo/bar.c
|
---|
151 | $dir/tmp/bar/bar.c
|
---|
152 | foo.h
|
---|
153 | $dir/tmp/bar.o: {$dir/tmp/foo/bar.c} $dir/tmp/foo/bar.c $dir/tmp/bar/bar.c foo.h
|
---|
154 | ");
|
---|
155 |
|
---|
156 |
|
---|
157 | # Test #5: stem splitting logic and order-only prerequisites.
|
---|
158 | #
|
---|
159 | run_make_test('
|
---|
160 | .SECONDEXPANSION:
|
---|
161 | $(dir)/tmp/foo.o: $(dir)/tmp/foo.c
|
---|
162 | $(dir)/tmp/foo.c: ; @echo $@
|
---|
163 | bar.h: ; @echo $@
|
---|
164 |
|
---|
165 | %.o: %.c|bar.h
|
---|
166 | @echo $@: {$<} {$|} $^
|
---|
167 |
|
---|
168 | ',
|
---|
169 | "dir=$dir",
|
---|
170 | "$dir/tmp/foo.c
|
---|
171 | bar.h
|
---|
172 | $dir/tmp/foo.o: {$dir/tmp/foo.c} {bar.h} $dir/tmp/foo.c
|
---|
173 | ");
|
---|
174 |
|
---|
175 |
|
---|
176 | # Test #6: lack of implicit prerequisites.
|
---|
177 | #
|
---|
178 | run_make_test('
|
---|
179 | .SECONDEXPANSION:
|
---|
180 | foo.o: foo.c
|
---|
181 | foo.c: ; @echo $@
|
---|
182 |
|
---|
183 | %.o:
|
---|
184 | @echo $@: {$<} $^
|
---|
185 |
|
---|
186 | ',
|
---|
187 | '',
|
---|
188 | 'foo.c
|
---|
189 | foo.o: {foo.c} foo.c
|
---|
190 | ');
|
---|
191 |
|
---|
192 | # Test #7: Test stem from the middle of the name.
|
---|
193 | #
|
---|
194 | run_make_test('
|
---|
195 | .SECONDEXPANSION:
|
---|
196 | foobarbaz:
|
---|
197 |
|
---|
198 | foo%baz: % $$*.1
|
---|
199 | @echo $*
|
---|
200 |
|
---|
201 | bar bar.1:
|
---|
202 | @echo $@
|
---|
203 |
|
---|
204 | ',
|
---|
205 | '',
|
---|
206 | 'bar
|
---|
207 | bar.1
|
---|
208 | bar
|
---|
209 | ');
|
---|
210 |
|
---|
211 | # Test #8: Make sure stem triple-expansion does not happen.
|
---|
212 | #
|
---|
213 | run_make_test('
|
---|
214 | .SECONDEXPANSION:
|
---|
215 | foo$$bar:
|
---|
216 |
|
---|
217 | f%r: % $$*.1
|
---|
218 | @echo \'$*\'
|
---|
219 |
|
---|
220 | oo$$ba oo$$ba.1:
|
---|
221 | @echo \'$@\'
|
---|
222 |
|
---|
223 | ',
|
---|
224 | '',
|
---|
225 | 'oo$ba
|
---|
226 | oo$ba.1
|
---|
227 | oo$ba
|
---|
228 | ');
|
---|
229 |
|
---|
230 |
|
---|
231 | # This tells the test driver that the perl test script executed properly.
|
---|
232 | 1;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.