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.";
23 @echo Verify that busybox cp exists;
24 @echo ------------------------------;
25 [ -x ${BCP} ] || exit 0
30 @echo Copy a file to a copy of the file;
31 @echo ------------------------------;
33 echo A file > afile; \
34 ls -l afile > ../cp_afile_afilecopy.gnu; \
35 ${GCP} afile afilecopy; \
36 ls -l afile afilecopy >> ../cp_afile_afilecopy.gnu;
43 echo A file > afile; \
44 ls -l afile > ../cp_afile_afilecopy.bb; \
45 ${BCP} afile afilecopy; \
46 ls -l afile afilecopy >> ../cp_afile_afilecopy.bb;
49 @echo Might show timestamp differences.
50 -diff -u cp_afile_afilecopy.gnu cp_afile_afilecopy.bb;
55 @echo; echo Copy a file pointed to by a symlink;
56 @echo ------------------------------;
59 echo A file > afile; \
65 ls -lR . > ../cp_symlink.gnu; \
66 ${GCP} here/afile there; \
67 ls -lR . >> ../cp_symlink.gnu;
70 rm -rf cp_tests/there/*;
76 ls -lR . > ../cp_symlink.bb; \
77 ${BCP} here/afile there; \
78 ls -lR . >> ../cp_symlink.bb;
81 @echo Will show timestamp difference.
82 -diff -u cp_symlink.gnu cp_symlink.bb;
87 @echo; echo Copy a symlink, useing the -a switch.;
88 @echo ------------------------------;
90 echo A file > afile; \
96 ls -lR . > ../cp_a_symlink.gnu; \
97 ${GCP} -a here/afile there; \
98 ls -lR . >> ../cp_a_symlink.gnu;
101 rm -rf cp_tests/there/*;
107 echo A file > afile; \
108 ls -lR . > ../cp_a_symlink.bb; \
109 ${BCP} -a here/afile there; \
110 ls -lR . >> ../cp_a_symlink.bb;
113 diff -u cp_a_symlink.gnu cp_a_symlink.bb;
118 @echo; echo Copy a directory into another directory with the -a switch;
119 @echo ------------------------------;
122 echo A file > here/afile; \
124 touch here/adir/afileinadir; \
125 ln -s $$(pwd) here/alink;
129 ls -lR . > ../cp_a_dir_dir.gnu; \
130 ${GCP} -a here/ there/; \
131 ls -lR . >> ../cp_a_dir_dir.gnu;
134 rm -rf cp_tests/there/*;
140 ls -lR . > ../cp_a_dir_dir.bb; \
141 ${BCP} -a here/ there/; \
142 ls -lR . >> ../cp_a_dir_dir.bb;
145 diff -u cp_a_dir_dir.gnu cp_a_dir_dir.bb;
150 # Copy a set of files to a directory.
151 @echo; echo Copy a set of files to a directory.;
152 @echo ------------------------------;
154 echo A file number one > afile1; \
155 echo A file number two, blah. > afile2; \
156 ln -s afile1 symlink1; \
160 ${GCP} afile1 afile2 symlink1 there/; \
161 ls -lR > ../cp_files_dir.gnu;
164 rm -rf cp_tests/there/*;
168 ${BCP} afile1 afile2 symlink1 there/; \
169 ls -lR > ../cp_files_dir.bb;
172 diff -u cp_files_dir.gnu cp_files_dir.bb;
177 # Copy a set of files to a directory with the -d switch.
178 @echo; echo Copy a set of files to a directory with the -d switch.;
179 @echo ------------------------------;
181 echo A file number one > afile1; \
182 echo A file number two, blah. > afile2; \
183 ln -s afile1 symlink1; \
185 ${GCP} -d afile1 afile2 symlink1 there1/; \
186 ls -lR > ../cp_d_files_dir.gnu;
189 rm -rf cp_tests/{afile{1,2},symlink1,there1};
193 echo A file number one > afile1; \
194 echo A file number two, blah. > afile2; \
195 ln -s afile1 symlink1; \
197 ${BCP} -d afile1 afile2 symlink1 there1/; \
198 ls -lR > ../cp_d_files_dir.bb;
201 diff -u cp_d_files_dir.gnu cp_d_files_dir.bb;
204 rm -rf cp_tests/{afile{1,2},symlink1,there1};
206 # Copy a set of files to a directory with the -p switch.
207 @echo; echo Copy a set of files to a directory with the -p switch.;
208 @echo ------------------------------;
210 echo A file number one > afile1; \
211 echo A file number two, blah. > afile2; \
212 touch --date='Sat Jan 29 21:24:08 PST 2000' afile1; \
213 ln -s afile1 symlink1; \
215 ${GCP} -p afile1 afile2 symlink1 there1/; \
216 ls -lR > ../cp_p_files_dir.gnu;
219 rm -rf cp_tests/{afile{1,2},symlink1,there1};
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 ${BCP} -p afile1 afile2 symlink1 there1/; \
229 ls -lR > ../cp_p_files_dir.bb;
232 diff -u cp_p_files_dir.gnu cp_p_files_dir.bb;
235 rm -rf cp_tests/{afile{1,2},symlink1,there1};
237 @echo; echo Copy a set of files to a directory with -p and -d switches.
238 @echo ------------------------------;
240 echo A file number one > afile1; \
241 echo A file number two, blah. > afile2; \
242 touch --date='Sat Jan 29 21:24:08 PST 2000' afile1; \
243 ln -s afile1 symlink1; \
245 ${GCP} -p -d afile1 afile2 symlink1 there1/; \
246 ls -lR > ../cp_pd_files_dir.gnu;
249 rm -rf cp_tests/{afile{1,2},symlink1,there1};
253 echo A file number one > afile1; \
254 echo A file number two, blah. > afile2; \
255 touch --date='Sat Jan 29 21:24:08 PST 2000' afile1; \
256 ln -s afile1 symlink1; \
258 ${BCP} -p -d afile1 afile2 symlink1 there1/; \
259 ls -lR > ../cp_pd_files_dir.bb;
262 diff -u cp_pd_files_dir.gnu cp_pd_files_dir.bb;
265 rm -rf cp_tests/{afile{1,2},symlink1,there1};
267 @echo; echo Copy a directory into another directory with the -a switch.
268 @echo ------------------------------;
271 echo A file > dira/afile; \
272 echo A file in dirb > dirb/afileindirb; \
273 ln -s dira/afile dira/alinktoafile; \
274 mkdir dira/subdir1; \
275 echo Another file > dira/subdir1/anotherfile; \
276 ls -lR . > ../cp_a_dira_dirb.gnu; \
277 ${GCP} -a dira dirb; \
278 ls -lR . >> ../cp_a_dira_dirb.gnu;
281 rm -rf cp_tests/dir{a,b};
286 echo A file > dira/afile; \
287 echo A file in dirb > dirb/afileindirb; \
288 ln -s dira/afile dira/alinktoafile; \
289 mkdir dira/subdir1; \
290 echo Another file > dira/subdir1/anotherfile; \
291 ls -lR . > ../cp_a_dira_dirb.bb; \
292 ${BCP} -a dira dirb; \
293 ls -lR . >> ../cp_a_dira_dirb.bb;
296 diff -u cp_a_dira_dirb.gnu cp_a_dira_dirb.bb;
299 rm -rf cp_tests/dir{a,b};
301 # Copy a directory to another directory, without the -a switch.
302 @echo; echo Copy a directory to another directory, without the -a switch.
303 @echo ------------------------------;
304 @echo There should be an error message about cannot cp a dir to a subdir of itself.
308 ls -lR . > ../cp_a_star_adir.gnu; \
310 ls -lR . >> ../cp_a_star_adir.gnu;
313 @echo There should be an error message about cannot cp a dir to a subdir of itself.
317 ls -lR . > ../cp_a_star_adir.bb; \
319 ls -lR . >> ../cp_a_star_adir.bb;
322 diff -u cp_a_star_adir.gnu cp_a_star_adir.bb;