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
17 cp_tests: cp_clean cp check_exists check_simple_cp check_cp_symlnk \
18 check_cp_symlink_w_a check_cp_files_to_dir check_cp_files_to_dir_w_d \
19 check_cp_files_to_dir_w_p check_cp_files_to_dir_w_p_and_d \
20 check_cp_dir_to_dir_wo_a check_cp_dir_to_dir_w_a \
21 check_cp_dir_to_dir_w_a_take_two
25 @echo "No output from diff means busybox cp is functioning properly.";
26 @echo "Some tests might show timestamp differences that are Ok.";
29 @echo Verify that busybox cp exists;
30 @echo ------------------------------;
31 [ -x ${BCP} ] || exit 0
37 @echo Copy a file to a copy of the file;
38 @echo ------------------------------;
40 echo A file > afile; \
41 ls -l afile > ../cp_afile_afilecopy.gnu; \
42 ${GCP} afile afilecopy; \
43 ls -l afile afilecopy >> ../cp_afile_afilecopy.gnu;
50 echo A file > afile; \
51 ls -l afile > ../cp_afile_afilecopy.bb; \
52 ${BCP} afile afilecopy; \
53 ls -l afile afilecopy >> ../cp_afile_afilecopy.bb;
56 @echo Might show timestamp differences.
57 -diff -u cp_afile_afilecopy.gnu cp_afile_afilecopy.bb;
63 @echo; echo Copy a file pointed to by a symlink;
64 @echo ------------------------------;
67 echo A file > afile; \
73 ls -lR . > ../cp_symlink.gnu; \
74 ${GCP} here/afile there; \
75 ls -lR . >> ../cp_symlink.gnu;
78 rm -rf cp_tests/there/*;
84 ls -lR . > ../cp_symlink.bb; \
85 ${BCP} here/afile there; \
86 ls -lR . >> ../cp_symlink.bb;
89 @echo Will show timestamp difference.
90 -diff -u cp_symlink.gnu cp_symlink.bb;
96 @echo; echo Copy a symlink, useing the -a switch.;
97 @echo ------------------------------;
99 echo A file > afile; \
105 ls -lR . > ../cp_a_symlink.gnu; \
106 ${GCP} -a here/afile there; \
107 ls -lR . >> ../cp_a_symlink.gnu;
110 rm -rf cp_tests/there/*;
116 echo A file > afile; \
117 ls -lR . > ../cp_a_symlink.bb; \
118 ${BCP} -a here/afile there; \
119 ls -lR . >> ../cp_a_symlink.bb;
122 diff -u cp_a_symlink.gnu cp_a_symlink.bb;
128 check_cp_files_to_dir:
129 # Copy a set of files to a directory.
130 @echo; echo Copy a set of files to a directory.;
131 @echo ------------------------------;
133 echo A file number one > afile1; \
134 echo A file number two, blah. > afile2; \
135 ln -s afile1 symlink1; \
139 ${GCP} afile1 afile2 symlink1 there/; \
140 ls -lR > ../cp_files_dir.gnu;
143 rm -rf cp_tests/there/*;
147 ${BCP} afile1 afile2 symlink1 there/; \
148 ls -lR > ../cp_files_dir.bb;
151 diff -u cp_files_dir.gnu cp_files_dir.bb;
156 check_cp_files_to_dir_w_d:
157 # Copy a set of files to a directory with the -d switch.
158 @echo; echo Copy a set of files to a directory with the -d switch.;
159 @echo ------------------------------;
161 echo A file number one > afile1; \
162 echo A file number two, blah. > afile2; \
163 ln -s afile1 symlink1; \
165 ${GCP} -d afile1 afile2 symlink1 there1/; \
166 ls -lR > ../cp_d_files_dir.gnu;
169 rm -rf cp_tests/{afile{1,2},symlink1,there1};
173 echo A file number one > afile1; \
174 echo A file number two, blah. > afile2; \
175 ln -s afile1 symlink1; \
177 ${BCP} -d afile1 afile2 symlink1 there1/; \
178 ls -lR > ../cp_d_files_dir.bb;
181 diff -u cp_d_files_dir.gnu cp_d_files_dir.bb;
184 rm -rf cp_tests/{afile{1,2},symlink1,there1};
186 check_cp_files_to_dir_w_p:
187 # Copy a set of files to a directory with the -p switch.
188 @echo; echo Copy a set of files to a directory with the -p switch.;
189 @echo ------------------------------;
191 echo A file number one > afile1; \
192 echo A file number two, blah. > afile2; \
193 touch --date='Sat Jan 29 21:24:08 PST 2000' afile1; \
194 ln -s afile1 symlink1; \
196 ${GCP} -p afile1 afile2 symlink1 there1/; \
197 ls -lR > ../cp_p_files_dir.gnu;
200 rm -rf cp_tests/{afile{1,2},symlink1,there1};
204 echo A file number one > afile1; \
205 echo A file number two, blah. > afile2; \
206 touch --date='Sat Jan 29 21:24:08 PST 2000' afile1; \
207 ln -s afile1 symlink1; \
209 ${BCP} -p afile1 afile2 symlink1 there1/; \
210 ls -lR > ../cp_p_files_dir.bb;
213 diff -u cp_p_files_dir.gnu cp_p_files_dir.bb;
216 rm -rf cp_tests/{afile{1,2},symlink1,there1};
219 check_cp_files_to_dir_w_p_and_d:
220 @echo; echo Copy a set of files to a directory with -p and -d switches.
221 @echo ------------------------------;
223 echo A file number one > afile1; \
224 echo A file number two, blah. > afile2; \
225 touch --date='Sat Jan 29 21:24:08 PST 2000' afile1; \
226 ln -s afile1 symlink1; \
228 ${GCP} -p -d afile1 afile2 symlink1 there1/; \
229 ls -lR > ../cp_pd_files_dir.gnu;
232 rm -rf cp_tests/{afile{1,2},symlink1,there1};
236 echo A file number one > afile1; \
237 echo A file number two, blah. > afile2; \
238 touch --date='Sat Jan 29 21:24:08 PST 2000' afile1; \
239 ln -s afile1 symlink1; \
241 ${BCP} -p -d afile1 afile2 symlink1 there1/; \
242 ls -lR > ../cp_pd_files_dir.bb;
245 diff -u cp_pd_files_dir.gnu cp_pd_files_dir.bb;
248 rm -rf cp_tests/{afile{1,2},symlink1,there1};
250 check_cp_dir_to_dir_wo_a:
251 # Copy a directory to another directory, without the -a switch.
252 @echo; echo Copy a directory to another directory, without the -a switch.
253 @echo ------------------------------;
254 @echo There should be an error message about cannot cp a dir to a subdir of itself.
258 ls -lR . > ../cp_a_star_adir.gnu; \
260 ls -lR . >> ../cp_a_star_adir.gnu;
263 @echo There should be an error message about cannot cp a dir to a subdir of itself.
267 ls -lR . > ../cp_a_star_adir.bb; \
269 ls -lR . >> ../cp_a_star_adir.bb;
272 diff -u cp_a_star_adir.gnu cp_a_star_adir.bb;
280 check_cp_dir_to_dir_w_a:
281 @echo; echo Copy a directory into another directory with the -a switch.
282 @echo ------------------------------;
285 echo A file > dira/afile; \
286 echo A file in dirb > dirb/afileindirb; \
287 ln -s dira/afile dira/alinktoafile; \
288 mkdir dira/subdir1; \
289 echo Another file > dira/subdir1/anotherfile; \
290 ls -lR . > ../cp_a_dira_dirb.gnu; \
291 ${GCP} -a dira dirb; \
292 ls -lR . >> ../cp_a_dira_dirb.gnu;
295 rm -rf cp_tests/dir{a,b};
300 echo A file > dira/afile; \
301 echo A file in dirb > dirb/afileindirb; \
302 ln -s dira/afile dira/alinktoafile; \
303 mkdir dira/subdir1; \
304 echo Another file > dira/subdir1/anotherfile; \
305 ls -lR . > ../cp_a_dira_dirb.bb; \
306 ${BCP} -a dira dirb; \
307 ls -lR . >> ../cp_a_dira_dirb.bb;
310 diff -u cp_a_dira_dirb.gnu cp_a_dira_dirb.bb;
313 rm -rf cp_tests/dir{a,b};
316 check_cp_dir_to_dir_w_a_take_two:
317 @echo; echo Copy a directory into another directory with the -a switch;
318 @echo ------------------------------;
319 mkdir -p cp_tests/gnu; \
320 mkdir -p cp_tests/bb; \
323 echo A file > here/afile; \
325 touch here/adir/afileinadir; \
326 ln -s $$(pwd) here/alink;
330 ls -lR . > ../../cp_a_dir_dir.gnu; \
331 ${GCP} -a here/ there/; \
332 ls -lR . >> ../../cp_a_dir_dir.gnu;
335 rm -rf cp_tests/there/*;
341 ls -lR . > ../../cp_a_dir_dir.bb; \
342 ${BCP} -a here/ there/; \
343 ls -lR . >> ../../cp_a_dir_dir.bb;
347 diff -u cp_a_dir_dir.gnu cp_a_dir_dir.bb;