File: build_cache.test

package info (click to toggle)
makepp 2.0.98.5-2.1
  • links: PTS
  • area: main
  • in suites: bookworm, bullseye
  • size: 2,744 kB
  • sloc: perl: 15,893; makefile: 38; javascript: 25; sh: 1
file content (241 lines) | stat: -rw-r--r-- 6,249 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
###	SPAR <http://www.cpan.org/scripts/>
###	55	755	1103935704	1342132247	makepp_test_script.pl
makepp \'builtin', qw(-MMpp::BuildCacheControl create --subdir-chars= ./build_cache);

#
# Now build some junk with makepp.
#
makepp 'two_letter_files';	# Make a bunch of files with the name [ab]?.

#
# Now check whether makepp can automatically add files to the build cache
# if we let it.
#
unlink 'mt';
makepp qw(--build-cache build_cache derived_files);

#
# Now verify that rebuilding the file with different contents does not wipe
# out the value in the build cache, but it can be brought back without
# difficulty.
#
unlink <*_build_record>;
makepp qw(--build-cache build_cache derived_files EXTRA_WORD=test2);
# Rebuild the files.
-e $_.'_build_record' or die $_ for <c_??>;
				# This should rebuild everything.

unlink <*_build_record>;	# Get rid of the build record from the last build.
makepp qw(--build-cache build_cache derived_files);
				# Rebuild the files.  This should bring back
				# the old ones from the cache, and they should
				# not have been overwritten by the new ones.
-e $_.'_build_record' and die $_ for <subdir1/c_??>;

#
# Test copying the build files into a different subdirectory than they
# were created in.
#
makepp qw(--build-cache build_cache -F subdir1 derived_files);
-e $_.'_build_record' and die $_ for <subdir1/c_??>;

                                    # Do it again with the altered files.
makepp qw(--build-cache build_cache -F subdir2 derived_files EXTRA_WORD=test2);
-e $_.'_build_record' and die $_ for <subdir2/c_??>;

#
# Corrupt one file in the build cache, and verify that the file is
# correctly rejected.
#
for( <build_cache/*_aa> ) {
  chmod 0755, $_;
  c_echo 'an improper modification', "-o>>$_";
}

makepp \'', qw(--build-cache build_cache -F subdir3 aa);

1;                          # No error.
###	34	644	1103934641	1103934641	Makeppfile
#
# Test of the build cache.
#
$(phony two_letter_files): ba bb bc bd

aa ab ac ad: : signature md5
	&echo $@ $(EXTRA_WORD) -o $@
	&echo $@ -o $@_build_record
				# Side effect that makepp should not know
				# about enables us to test whether they come
				# out of the build cache.

b% : a% : signature md5
	&cat $< -o $@
	&echo $@ -o>>$@
	&echo $@ -o $@_build_record
				# Side effect that makepp should not know
				# about enables us to test whether they come
				# out of the build cache.

mt :
	&touch $@


$(phony derived_files): $(wildcard c_[ab]?)

c_%: % : signature md5
	&echo This file is derived from $<. -o $@
	&cat $< -o>>$@
	&echo $@ -o $@_build_record

SUBDIRS = $(dir_noslash $(wildcard */Makeppfile))

include mt
###	D	755	1103935490	1103936160	subdir1/
###	L	H	0	0	subdir1/Makeppfile
Makeppfile
###	D	755	1103935490	1103936160	subdir2/
###	L	H	0	0	subdir2/Makeppfile
Makeppfile
###	D	755	1103935620	1103936160	subdir3/
###	L	H	0	0	subdir3/Makeppfile
Makeppfile
###	D	755	1103936101	1103936159	answers/
###	2	644	1103936084	1103936090	answers/aa
aa
an improper modification
###	1	444	1103936084	1103936084	answers/ab
ab
###	1	444	1103936084	1103936084	answers/ac
ac
###	1	444	1103936084	1103936084	answers/ad
ad
###	2	444	1103936084	1103936084	answers/ba
aa
ba
###	2	444	1103936084	1103936084	answers/bb
ab
bb
###	2	444	1103936084	1103936084	answers/bc
ac
bc
###	2	444	1103936085	1103936085	answers/bd
ad
bd
###	3	644	1103936086	1103936090	answers/c_aa
This file is derived from aa.
aa
an improper modification
###	2	444	1103936086	1103936086	answers/c_ab
This file is derived from ab.
ab
###	2	444	1103936086	1103936086	answers/c_ac
This file is derived from ac.
ac
###	2	444	1103936086	1103936086	answers/c_ad
This file is derived from ad.
ad
###	3	444	1103936086	1103936086	answers/c_ba
This file is derived from ba.
aa
ba
###	3	444	1103936086	1103936086	answers/c_bb
This file is derived from bb.
ab
bb
###	3	444	1103936086	1103936086	answers/c_bc
This file is derived from bc.
ac
bc
###	3	444	1103936086	1103936086	answers/c_bd
This file is derived from bd.
ad
bd
###	D	755	1103936123	1103936143	answers/subdir1/
###	L	H	0	0	answers/subdir1/aa
answers/aa
###	L	H	0	0	answers/subdir1/ab
answers/ab
###	L	H	0	0	answers/subdir1/ac
answers/ac
###	L	H	0	0	answers/subdir1/ad
answers/ad
###	L	H	0	0	answers/subdir1/ba
answers/ba
###	L	H	0	0	answers/subdir1/bb
answers/bb
###	L	H	0	0	answers/subdir1/bc
answers/bc
###	L	H	0	0	answers/subdir1/bd
answers/bd
###	L	H	0	0	answers/subdir1/c_aa
answers/c_aa
###	L	H	0	0	answers/subdir1/c_ab
answers/c_ab
###	L	H	0	0	answers/subdir1/c_ac
answers/c_ac
###	L	H	0	0	answers/subdir1/c_ad
answers/c_ad
###	L	H	0	0	answers/subdir1/c_ba
answers/c_ba
###	L	H	0	0	answers/subdir1/c_bb
answers/c_bb
###	L	H	0	0	answers/subdir1/c_bc
answers/c_bc
###	L	H	0	0	answers/subdir1/c_bd
answers/c_bd
###	D	755	1103936123	1103936147	answers/subdir2/
###	2	644	1103936087	1103936090	answers/subdir2/aa
aa test2
an improper modification
###	1	444	1103936087	1103936087	answers/subdir2/ab
ab test2
###	1	444	1103936087	1103936087	answers/subdir2/ac
ac test2
###	1	444	1103936087	1103936087	answers/subdir2/ad
ad test2
###	2	444	1103936087	1103936087	answers/subdir2/ba
aa test2
ba
###	2	444	1103936087	1103936087	answers/subdir2/bb
ab test2
bb
###	2	444	1103936087	1103936087	answers/subdir2/bc
ac test2
bc
###	2	444	1103936087	1103936087	answers/subdir2/bd
ad test2
bd
###	3	644	1103936087	1103936090	answers/subdir2/c_aa
This file is derived from aa.
aa test2
an improper modification
###	2	444	1103936087	1103936087	answers/subdir2/c_ab
This file is derived from ab.
ab test2
###	2	444	1103936087	1103936087	answers/subdir2/c_ac
This file is derived from ac.
ac test2
###	2	444	1103936087	1103936087	answers/subdir2/c_ad
This file is derived from ad.
ad test2
###	3	444	1103936087	1103936087	answers/subdir2/c_ba
This file is derived from ba.
aa test2
ba
###	3	444	1103936087	1103936087	answers/subdir2/c_bb
This file is derived from bb.
ab test2
bb
###	3	444	1103936087	1103936087	answers/subdir2/c_bc
This file is derived from bc.
ac test2
bc
###	3	444	1103936087	1103936087	answers/subdir2/c_bd
This file is derived from bd.
ad test2
bd
###	D	755	1103936123	1103936150	answers/subdir3/
###	1	444	1103936091	1103936091	answers/subdir3/aa
aa
###	1	644	1103936091	1103936091	answers/subdir3/aa_build_record
aa