1 # cp_tests.mk - Set of test cases for busybox cp
3 # Copyright (C) 2000 Karl M. Hegbloom <karlheg@debian.org> GPL
15 - rm -rf cp_tests cp_*.{gnu,bb} cp
19 @echo "No output from diff means busybox cp is functioning properly.";
20 @echo "Some tests might show timestamp differences that are Ok.";
28 \f # Copy a file to a copy of the file
29 @echo ------------------------------;
31 echo A file > afile; \
32 ls -l afile > ../cp_afile_afilecopy.gnu; \
33 ${GCP} afile afilecopy; \
34 ls -l afile afilecopy >> ../cp_afile_afilecopy.gnu;
41 echo A file > afile; \
42 ls -l afile > ../cp_afile_afilecopy.bb; \
43 ${BCP} afile afilecopy; \
44 ls -l afile afilecopy >> ../cp_afile_afilecopy.bb;
47 @echo Might show timestamp differences.
48 -diff -u cp_afile_afilecopy.gnu cp_afile_afilecopy.bb;
53 \f # Copy a file pointed to by a symlink
54 @echo; echo ------------------------------;
57 echo A file > afile; \
63 ls -lR . > ../cp_symlink.gnu; \
64 ${GCP} here/afile there; \
65 ls -lR . >> ../cp_symlink.gnu;
68 rm -rf cp_tests/there/*;
74 ls -lR . > ../cp_symlink.bb; \
75 ${BCP} here/afile there; \
76 ls -lR . >> ../cp_symlink.bb;
79 @echo Will show timestamp difference.
80 -diff -u cp_symlink.gnu cp_symlink.bb;
85 \f # Copy a symlink, useing the -a switch.
86 @echo; echo ------------------------------;
88 echo A file > afile; \
94 ls -lR . > ../cp_a_symlink.gnu; \
95 ${GCP} -a here/afile there; \
96 ls -lR . >> ../cp_a_symlink.gnu;
99 rm -f cp_tests/there/*;
105 echo A file > afile; \
106 ls -lR . > ../cp_a_symlink.bb; \
107 ${BCP} -a here/afile there; \
108 ls -lR . >> ../cp_a_symlink.bb;
111 diff -u cp_a_symlink.gnu cp_a_symlink.bb;
116 \f # Copy a directory into another directory with the -a switch
117 @echo; echo ------------------------------;
120 echo A file > here/afile; \
122 touch here/adir/afileinadir; \
123 ln -s $$(pwd) here/alink;
127 ls -lR . > ../cp_a_dir_dir.gnu; \
128 ${GCP} -a here/ there/; \
129 ls -lR . >> ../cp_a_dir_dir.gnu;
132 rm -rf cp_tests/there/*;
138 ls -lR . > ../cp_a_dir_dir.bb; \
139 ${BCP} -a here/ there/; \
140 ls -lR . >> ../cp_a_dir_dir.bb;
143 diff -u cp_a_dir_dir.gnu cp_a_dir_dir.bb;
148 \f # Copy a set of files to a directory.
149 @echo; echo ------------------------------;
151 echo A file number one > afile1; \
152 echo A file number two, blah. > afile2; \
153 ln -s afile1 symlink1; \
157 ${GCP} afile1 afile2 symlink1 there/; \
158 ls -lR > ../cp_files_dir.gnu;
161 rm -rf cp_tests/there/*;
165 ${BCP} afile1 afile2 symlink1 there/; \
166 ls -lR > ../cp_files_dir.bb;
169 diff -u cp_files_dir.gnu cp_files_dir.bb;
174 \f # Copy a set of files to a directory with the -d switch.
175 @echo; echo ------------------------------;
177 echo A file number one > afile1; \
178 echo A file number two, blah. > afile2; \
179 ln -s afile1 symlink1; \
181 ${GCP} -d afile1 afile2 symlink1 there1/; \
182 ls -lR > ../cp_d_files_dir.gnu;
185 rm -rf cp_tests/{afile{1,2},symlink1,there1};
189 echo A file number one > afile1; \
190 echo A file number two, blah. > afile2; \
191 ln -s afile1 symlink1; \
193 ${BCP} -d afile1 afile2 symlink1 there1/; \
194 ls -lR > ../cp_d_files_dir.bb;
197 diff -u cp_d_files_dir.gnu cp_d_files_dir.bb;
200 rm -rf cp_tests/{afile{1,2},symlink1,there1};
202 \f # Copy a set of files to a directory with the -p switch.
203 @echo; echo ------------------------------;
205 echo A file number one > afile1; \
206 echo A file number two, blah. > afile2; \
207 touch --date='Sat Jan 29 21:24:08 PST 2000' afile1; \
208 ln -s afile1 symlink1; \
210 ${GCP} -p afile1 afile2 symlink1 there1/; \
211 ls -lR > ../cp_p_files_dir.gnu;
214 rm -rf cp_tests/{afile{1,2},symlink1,there1};
218 echo A file number one > afile1; \
219 echo A file number two, blah. > afile2; \
220 touch --date='Sat Jan 29 21:24:08 PST 2000' afile1; \
221 ln -s afile1 symlink1; \
223 ${BCP} -p afile1 afile2 symlink1 there1/; \
224 ls -lR > ../cp_p_files_dir.bb;
227 diff -u cp_p_files_dir.gnu cp_p_files_dir.bb;
230 rm -rf cp_tests/{afile{1,2},symlink1,there1};
232 \f # Copy a set of files to a directory with -p and -d switches.
233 @echo; echo ------------------------------;
235 echo A file number one > afile1; \
236 echo A file number two, blah. > afile2; \
237 touch --date='Sat Jan 29 21:24:08 PST 2000' afile1; \
238 ln -s afile1 symlink1; \
240 ${GCP} -p -d afile1 afile2 symlink1 there1/; \
241 ls -lR > ../cp_pd_files_dir.gnu;
244 rm -rf cp_tests/{afile{1,2},symlink1,there1};
248 echo A file number one > afile1; \
249 echo A file number two, blah. > afile2; \
250 touch --date='Sat Jan 29 21:24:08 PST 2000' afile1; \
251 ln -s afile1 symlink1; \
253 ${BCP} -p -d afile1 afile2 symlink1 there1/; \
254 ls -lR > ../cp_pd_files_dir.bb;
257 diff -u cp_pd_files_dir.gnu cp_pd_files_dir.bb;
260 rm -rf cp_tests/{afile{1,2},symlink1,there1};
262 \f # Copy a directory into another directory with the -a switch.
263 @echo; echo ------------------------------;
266 echo A file > dira/afile; \
267 echo A file in dirb > dirb/afileindirb; \
268 ln -s dira/afile dira/alinktoafile; \
269 mkdir dira/subdir1; \
270 echo Another file > dira/subdir1/anotherfile; \
271 ls -lR . > ../cp_a_dira_dirb.gnu; \
272 ${GCP} -a dira dirb; \
273 ls -lR . >> ../cp_a_dira_dirb.gnu;
276 rm -rf cp_tests/dir{a,b};
281 echo A file > dira/afile; \
282 echo A file in dirb > dirb/afileindirb; \
283 ln -s dira/afile dira/alinktoafile; \
284 mkdir dira/subdir1; \
285 echo Another file > dira/subdir1/anotherfile; \
286 ls -lR . > ../cp_a_dira_dirb.bb; \
287 ${BCP} -a dira dirb; \
288 ls -lR . >> ../cp_a_dira_dirb.bb;
291 diff -u cp_a_dira_dirb.gnu cp_a_dira_dirb.bb;
294 rm -rf cp_tests/dir{a,b};
296 \f # Copy a directory to another directory, without the -a switch.
297 @echo; echo ------------------------------;
298 @echo There should be an error message about cannot cp a dir to a subdir of itself.
302 ls -lR . > ../cp_a_star_adir.gnu; \
304 ls -lR . >> ../cp_a_star_adir.gnu;
307 @echo There should be an error message about cannot cp a dir to a subdir of itself.
311 ls -lR . > ../cp_a_star_adir.bb; \
313 ls -lR . >> ../cp_a_star_adir.bb;
316 diff -u cp_a_star_adir.gnu cp_a_star_adir.bb;