blob: 81b8ffdecb5a0bd3d88d428d892ba6dc10334d30 [file] [log] [blame]
Erik Andersen029011b2000-03-04 21:19:32 +00001# mv_tests.mk - Set of tests cases for busybox mv
2# -------------
3# Copyright (C) 2000 Karl M. Hegbloom <karlheg@debian.org> GPL
4#
Erik Andersenfac10d72000-02-07 05:29:42 +00005
6# GNU `mv'
7GMV = /bin/mv
8# BusyBox `mv'
9BMV = $(shell pwd)/mv
10
Erik Andersen029011b2000-03-04 21:19:32 +000011all:: mv_tests
12clean:: mv_clean
13
Erik Andersenfac10d72000-02-07 05:29:42 +000014mv_clean:
15 rm -rf mv_tests mv_*.{gnu,bb} mv
16
Erik Andersenfac10d72000-02-07 05:29:42 +000017mv_tests: mv_clean mv
18 @echo;
19 @echo "No output from diff means busybox mv is functioning properly.";
20 @echo;
21 @echo "No such file or directory is good; it means the old file got removed.";
22 @echo;
23 ${BMV} || true;
24
25 @echo;
26 mkdir mv_tests;
27
28 @echo;
29 cd mv_tests; \
30 echo A file > afile; \
31 ls -l afile > ../mv_afile_newname.gnu; \
32 ${GMV} afile newname; \
33 ls -l newname >> ../mv_afile_newname.gnu;
34 -ls -l mv_tests/afile;
35
36 @echo;
37 rm -f mv_tests/{afile,newname};
38
39 @echo;
40 cd mv_tests; \
41 echo A file > afile; \
42 ls -l afile > ../mv_afile_newname.bb; \
43 ${BMV} afile newname; \
44 ls -l newname >> ../mv_afile_newname.bb;
45 -ls -l mv_tests/afile;
46
47 @echo;
48 diff -u mv_afile_newname.gnu mv_afile_newname.bb;
49
50 @echo;
51 rm -f mv_tests/{afile,newname};
52
Erik Andersen029011b2000-03-04 21:19:32 +000053 @echo; echo ------------------------------;
Erik Andersenfac10d72000-02-07 05:29:42 +000054 cd mv_tests; \
55 echo A file > afile; \
56 ln -s afile symlink; \
57 ls -l afile symlink > ../mv_symlink_newname.gnu; \
58 ${GMV} symlink newname; \
59 ls -l afile newname >> ../mv_symlink_newname.gnu;
60 -ls -l mv_tests/symlink;
61
62 @echo;
63 rm -f mv_tests/{afile,newname};
64
65 @echo;
66 cd mv_tests; \
67 echo A file > afile; \
68 ln -s afile symlink; \
69 ls -l afile symlink > ../mv_symlink_newname.bb;\
70 ${BMV} symlink newname; \
71 ls -l afile newname >> ../mv_symlink_newname.bb;
72 -ls -l mv_tests/symlink;
73
74 @echo;
75 diff -u mv_symlink_newname.gnu mv_symlink_newname.bb;
76
77 @echo;
78 rm -rf mv_tests/*;
79
Erik Andersen029011b2000-03-04 21:19:32 +000080 @echo; echo ------------------------------;
Erik Andersenfac10d72000-02-07 05:29:42 +000081 cd mv_tests; \
82 echo A file > afile; \
83 ln -s afile symlink; \
84 mkdir newdir; \
85 ls -lR > ../mv_file_symlink_dir.gnu; \
86 ${GMV} symlink afile newdir; \
87 ls -lR >> ../mv_file_symlink_dir.gnu;
88 -ls -l mv_tests/{symlink,afile};
89
90 @echo;
91 rm -rf mv_tests/*
92
Erik Andersen029011b2000-03-04 21:19:32 +000093 @echo; echo ------------------------------;
Erik Andersenfac10d72000-02-07 05:29:42 +000094 cd mv_tests; \
95 echo A file > afile; \
96 ln -s afile symlink; \
97 mkdir newdir; \
98 ls -lR > ../mv_file_symlink_dir.bb; \
99 ${BMV} symlink afile newdir; \
100 ls -lR >> ../mv_file_symlink_dir.bb;
101 -ls -l mv_tests/{symlink,afile};
102
103 @echo;
104 diff -u mv_file_symlink_dir.gnu mv_file_symlink_dir.bb;
105
106 @echo;
107 rm -rf mv_tests/*;
108
Erik Andersen029011b2000-03-04 21:19:32 +0000109 @echo; echo ------------------------------;
Erik Andersenfac10d72000-02-07 05:29:42 +0000110 cd mv_tests; \
111 mkdir dir{a,b}; \
112 echo A file > dira/afile; \
113 echo A file in dirb > dirb/afileindirb; \
114 ln -s dira/afile dira/alinktoafile; \
115 mkdir dira/subdir1; \
116 echo Another file > dira/subdir1/anotherfile; \
117 ls -lR . > ../mv_dira_dirb.gnu; \
118 ${GMV} dira dirb; \
119 ls -lR . >> ../mv_dira_dirb.gnu;
120
121 # false;
122 @echo;
123 rm -rf mv_tests/dir{a,b};
124
125 @echo;
126 cd mv_tests; \
127 mkdir dir{a,b}; \
128 echo A file > dira/afile; \
129 echo A file in dirb > dirb/afileindirb; \
130 ln -s dira/afile dira/alinktoafile; \
131 mkdir dira/subdir1; \
132 echo Another file > dira/subdir1/anotherfile; \
133 ls -lR . > ../mv_dira_dirb.bb; \
134 ${BMV} dira dirb; \
135 ls -lR . >> ../mv_dira_dirb.bb;
136
137 @echo;
138 diff -u mv_dira_dirb.gnu mv_dira_dirb.bb;
139
140 # false;
141 @echo;
142 rm -rf mv_tests/dir{a,b};
Erik Andersen029011b2000-03-04 21:19:32 +0000143
144 @echo; echo ------------------------------;
145 @echo There should be an error message about cannot mv a dir to a subdir of itself.
146 cd mv_tests; \
147 touch a b c; \
148 mkdir adir; \
149 ls -lR . > ../mv_a_star_adir.gnu; \
150 ${GMV} * adir; \
151 ls -lR . >> ../mv_a_star_adir.gnu;
152
153 @echo
154 @echo There should be an error message about cannot mv a dir to a subdir of itself.
155 cd mv_tests; \
156 rm -rf adir; \
157 mkdir adir; \
158 ls -lR . > ../mv_a_star_adir.bb; \
159 ${BMV} * adir; \
160 ls -lR . >> ../mv_a_star_adir.bb;
161
162 @echo;
163 diff -u mv_a_star_adir.gnu mv_a_star_adir.bb;
164
165 @echo;
166 rm -rf mv_test/*;