aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorerik <erik@69ca8d6d-28ef-0310-b511-8ec308f3f277>2000-03-04 21:19:32 +0000
committererik <erik@69ca8d6d-28ef-0310-b511-8ec308f3f277>2000-03-04 21:19:32 +0000
commitf042f3c095e99887a076427cc04de54f90fe2c29 (patch)
tree7c49f1fc1547a2f9cee812472f422a5c1a5c448b /tests
parent6b65252692f961f249492e7768d7b2826600d956 (diff)
downloadbusybox-w32-f042f3c095e99887a076427cc04de54f90fe2c29.tar.gz
busybox-w32-f042f3c095e99887a076427cc04de54f90fe2c29.tar.bz2
busybox-w32-f042f3c095e99887a076427cc04de54f90fe2c29.zip
A few updates (including the cp fix the Craig has been looking for)
-Erik git-svn-id: svn://busybox.net/trunk/busybox@386 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile23
-rw-r--r--tests/cp_tests.mk170
-rw-r--r--tests/ln_tests.mk9
-rw-r--r--tests/mv_tests.mk41
4 files changed, 165 insertions, 78 deletions
diff --git a/tests/Makefile b/tests/Makefile
index 015634460..c4fb0e911 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -1,16 +1,21 @@
1all test_all: message_header cp_tests mv_tests ln_tests 1# busybox/tests/Makefile - Run through all defined tests.
2# ------------------------
3# Copyright (C) 2000 Karl M. Hegbloom <karlheg@debian.org> GPL
2 4
3clean: cp_clean mv_clean ln_clean 5all:: message_header
4 6
5message_header: 7message_header:
6 @echo 8 @echo
7 @echo If tests faile due to differences in timestamps in commands that are not set 9 @echo BusyBox Test Suite.
8 @echo to preserve timestamps, just run the tests again.
9 @echo 10 @echo
10 11
11include cp_tests.mk 12clean::
12include mv_tests.mk 13
13include ln_tests.mk 14distclean: clean
15
16.PHONY: all clean distclean message_header
17
18include $(wildcard *_tests.mk)
14 19
15BBL := $(shell pushd .. >/dev/null && \ 20BBL := $(shell pushd .. >/dev/null && \
16 ${MAKE} busybox.links >/dev/null && \ 21 ${MAKE} busybox.links >/dev/null && \
@@ -21,8 +26,6 @@ BBL := $(shell pushd .. >/dev/null && \
21../busybox: 26../busybox:
22 cd .. && ${MAKE} busybox 27 cd .. && ${MAKE} busybox
23 28
24$(BBL): ../busybox 29${BBL}: ../busybox
25 rm -f $@ 30 rm -f $@
26 ln ../busybox $@ 31 ln ../busybox $@
27
28.PHONY: all test_all message_header
diff --git a/tests/cp_tests.mk b/tests/cp_tests.mk
index e14262ac1..e79f2b38b 100644
--- a/tests/cp_tests.mk
+++ b/tests/cp_tests.mk
@@ -1,18 +1,23 @@
1# This is a -*- makefile -*- 1# cp_tests.mk - Set of test cases for busybox cp
2# -------------
3# Copyright (C) 2000 Karl M. Hegbloom <karlheg@debian.org> GPL
4#
2 5
3# GNU `cp' 6# GNU `cp'
4GCP = /bin/cp 7GCP = /bin/cp
5# BusyBox `cp' 8# BusyBox `cp'
6BCP = $(shell pwd)/cp 9BCP = $(shell pwd)/cp
7 10
8.PHONY: cp_clean 11all:: cp_tests
12clean:: cp_clean
13
9cp_clean: 14cp_clean:
10 rm -rf cp_tests cp_*.{gnu,bb} cp 15 - rm -rf cp_tests cp_*.{gnu,bb} cp
11 16
12.PHONY: cp_tests
13cp_tests: cp_clean cp 17cp_tests: cp_clean cp
14 @echo; 18 @echo;
15 @echo "No output from diff means busybox cp is functioning properly."; 19 @echo "No output from diff means busybox cp is functioning properly.";
20 @echo "Some tests might show timestamp differences that are Ok.";
16 21
17 @echo; 22 @echo;
18 ${BCP} || true; 23 ${BCP} || true;
@@ -20,7 +25,8 @@ cp_tests: cp_clean cp
20 @echo; 25 @echo;
21 mkdir cp_tests; 26 mkdir cp_tests;
22 27
23 @echo; 28 # Copy a file to a copy of the file
29 @echo ------------------------------;
24 cd cp_tests; \ 30 cd cp_tests; \
25 echo A file > afile; \ 31 echo A file > afile; \
26 ls -l afile > ../cp_afile_afilecopy.gnu; \ 32 ls -l afile > ../cp_afile_afilecopy.gnu; \
@@ -28,7 +34,7 @@ cp_tests: cp_clean cp
28 ls -l afile afilecopy >> ../cp_afile_afilecopy.gnu; 34 ls -l afile afilecopy >> ../cp_afile_afilecopy.gnu;
29 35
30 @echo; 36 @echo;
31 rm -f cp_tests/afile*; 37 rm -rf cp_tests/*;
32 38
33 @echo; 39 @echo;
34 cd cp_tests; \ 40 cd cp_tests; \
@@ -38,118 +44,135 @@ cp_tests: cp_clean cp
38 ls -l afile afilecopy >> ../cp_afile_afilecopy.bb; 44 ls -l afile afilecopy >> ../cp_afile_afilecopy.bb;
39 45
40 @echo; 46 @echo;
41 diff -u cp_afile_afilecopy.gnu cp_afile_afilecopy.bb; 47 @echo Might show timestamp differences.
48 -diff -u cp_afile_afilecopy.gnu cp_afile_afilecopy.bb;
42 49
43 @echo; 50 @echo;
44 rm -f cp_tests/afile*; 51 rm -rf cp_tests/*;
45 52
46 @echo; echo; 53 # Copy a file pointed to by a symlink
54 @echo; echo ------------------------------;
47 cd cp_tests; \ 55 cd cp_tests; \
48 mkdir there there1; \ 56 mkdir here there; \
49 cd there; \ 57 echo A file > afile; \
50 ln -s ../afile .; 58 cd here; \
59 ln -s ../afile .; \
51 60
52 @echo; 61 @echo;
53 cd cp_tests; \ 62 cd cp_tests; \
54 echo A file > afile; \ 63 ls -lR . > ../cp_symlink.gnu; \
55 ls -l afile > ../cp_symlink.gnu; \ 64 ${GCP} here/afile there; \
56 ${GCP} there/afile there1/; \ 65 ls -lR . >> ../cp_symlink.gnu;
57 ls -l afile there/afile there1/afile >> ../cp_symlink.gnu;
58 66
59 @echo; 67 @echo;
60 rm -f cp_tests/afile cp_tests/there1/afile; 68 rm -rf cp_tests/there/*;
69
70 sleep 1;
61 71
62 @echo; 72 @echo;
63 cd cp_tests; \ 73 cd cp_tests; \
64 echo A file > afile; \ 74 ls -lR . > ../cp_symlink.bb; \
65 ls -l afile > ../cp_symlink.bb; \ 75 ${BCP} here/afile there; \
66 ${BCP} there/afile there1/; \ 76 ls -lR . >> ../cp_symlink.bb;
67 ls -l afile there/afile there1/afile >> ../cp_symlink.bb;
68 77
69 @echo; 78 @echo;
70 diff -u cp_symlink.gnu cp_symlink.bb; 79 @echo Will show timestamp difference.
80 -diff -u cp_symlink.gnu cp_symlink.bb;
71 81
72 @echo; 82 @echo;
73 rm -f cp_tests/afile cp_tests/there1/afile; 83 rm -rf cp_tests/*
74 84
75 @echo; echo; 85 # Copy a symlink, useing the -a switch.
86 @echo; echo ------------------------------;
76 cd cp_tests; \ 87 cd cp_tests; \
77 echo A file > afile; \ 88 echo A file > afile; \
78 ls -l afile > ../cp_a_symlink.gnu; \ 89 mkdir here there; \
79 ${GCP} -a there/afile there1/; \ 90 cd here; \
80 ls -l afile there/afile there1/afile >> ../cp_a_symlink.gnu; 91 ln -s ../afile .
92
93 cd cp_test; \
94 ls -lR . > ../cp_a_symlink.gnu; \
95 ${GCP} -a here/afile there; \
96 ls -lR . >> ../cp_a_symlink.gnu;
81 97
82 @echo; 98 @echo;
83 rm -f cp_tests/afile cp_tests/there1/afile; 99 rm -f cp_tests/there/*;
100
101 sleep 1;
84 102
85 @echo; 103 @echo;
86 cd cp_tests; \ 104 cd cp_tests; \
87 echo A file > afile; \ 105 echo A file > afile; \
88 ls -l afile > ../cp_a_symlink.bb; \ 106 ls -lR . > ../cp_a_symlink.bb; \
89 ${BCP} -a there/afile there1/; \ 107 ${BCP} -a here/afile there; \
90 ls -l afile there/afile there1/afile >> ../cp_a_symlink.bb; 108 ls -lR . >> ../cp_a_symlink.bb;
91 109
92 @echo; 110 @echo;
93 diff -u cp_a_symlink.gnu cp_a_symlink.bb; 111 diff -u cp_a_symlink.gnu cp_a_symlink.bb;
94 112
95 @echo; 113 @echo;
96 rm -f cp_tests/afile 114 rm -f cp_tests/*;
97 rm -rf cp_tests/there{,1};
98 115
99 @echo; echo; 116 # Copy a directory into another directory with the -a switch
117 @echo; echo ------------------------------;
100 cd cp_tests; \ 118 cd cp_tests; \
101 echo A file > there/afile; \ 119 mkdir here there; \
102 mkdir there/adir; \ 120 echo A file > here/afile; \
103 touch there/adir/afileinadir; \ 121 mkdir here/adir; \
104 ln -s $(shell pwd) there/alink; 122 touch here/adir/afileinadir; \
123 ln -s $$(pwd) here/alink;
105 124
106 @echo; 125 @echo;
107 cd cp_tests; \ 126 cd cp_tests; \
108 ${GCP} -a there/ there1/; \ 127 ls -lR . > ../cp_a_dir_dir.gnu; \
109 ls -lR there/ there1/ > ../cp_a_dir_dir.gnu; 128 ${GCP} -a here/ there/; \
129 ls -lR . >> ../cp_a_dir_dir.gnu;
110 130
111 @echo; 131 @echo;
112 rm -rf cp_tests/there1; 132 rm -rf cp_tests/there/*;
133
134 sleep 1;
113 135
114 @echo; 136 @echo;
115 cd cp_tests; \ 137 cd cp_tests; \
116 ${BCP} -a there/ there1/; \ 138 ls -lR . > ../cp_a_dir_dir.bb; \
117 ls -lR there/ there1/ > ../cp_a_dir_dir.bb; 139 ${BCP} -a here/ there/; \
140 ls -lR . >> ../cp_a_dir_dir.bb;
118 141
119 @echo; 142 @echo;
120 diff -u cp_a_dir_dir.gnu cp_a_dir_dir.bb; 143 diff -u cp_a_dir_dir.gnu cp_a_dir_dir.bb;
121 144
122 @echo; 145 @echo;
123 rm -rf cp_tests/there1/; 146 rm -rf cp_tests/*;
124 147
125 @echo; echo; 148 # Copy a set of files to a directory.
149 @echo; echo ------------------------------;
126 cd cp_tests; \ 150 cd cp_tests; \
127 echo A file number one > afile1; \ 151 echo A file number one > afile1; \
128 echo A file number two, blah. > afile2; \ 152 echo A file number two, blah. > afile2; \
129 ln -s afile1 symlink1; \ 153 ln -s afile1 symlink1; \
130 mkdir there1; \ 154 mkdir there;
131 ${GCP} afile1 afile2 symlink1 there1/; \ 155
156 cd cp_tests; \
157 ${GCP} afile1 afile2 symlink1 there/; \
132 ls -lR > ../cp_files_dir.gnu; 158 ls -lR > ../cp_files_dir.gnu;
133 159
134 @echo; 160 @echo;
135 rm -rf cp_tests/{afile{1,2},symlink1,there1}; 161 rm -rf cp_tests/there/*;
136 162
137 @echo; 163 @echo;
138 cd cp_tests; \ 164 cd cp_tests; \
139 echo A file number one > afile1; \ 165 ${BCP} afile1 afile2 symlink1 there/; \
140 echo A file number two, blah. > afile2; \
141 ln -s afile1 symlink1; \
142 mkdir there1; \
143 ${BCP} afile1 afile2 symlink1 there1/; \
144 ls -lR > ../cp_files_dir.bb; 166 ls -lR > ../cp_files_dir.bb;
145 167
146 @echo; 168 @echo;
147 diff -u cp_files_dir.gnu cp_files_dir.bb; 169 diff -u cp_files_dir.gnu cp_files_dir.bb;
148 170
149 @echo; 171 @echo;
150 rm -rf cp_tests/{afile{1,2},symlink1,there1}; 172 rm -rf cp_tests/*;
151 173
152 @echo; echo; 174 # Copy a set of files to a directory with the -d switch.
175 @echo; echo ------------------------------;
153 cd cp_tests; \ 176 cd cp_tests; \
154 echo A file number one > afile1; \ 177 echo A file number one > afile1; \
155 echo A file number two, blah. > afile2; \ 178 echo A file number two, blah. > afile2; \
@@ -176,7 +199,8 @@ cp_tests: cp_clean cp
176 @echo; 199 @echo;
177 rm -rf cp_tests/{afile{1,2},symlink1,there1}; 200 rm -rf cp_tests/{afile{1,2},symlink1,there1};
178 201
179 @echo; echo; 202 # Copy a set of files to a directory with the -p switch.
203 @echo; echo ------------------------------;
180 cd cp_tests; \ 204 cd cp_tests; \
181 echo A file number one > afile1; \ 205 echo A file number one > afile1; \
182 echo A file number two, blah. > afile2; \ 206 echo A file number two, blah. > afile2; \
@@ -205,7 +229,8 @@ cp_tests: cp_clean cp
205 @echo; 229 @echo;
206 rm -rf cp_tests/{afile{1,2},symlink1,there1}; 230 rm -rf cp_tests/{afile{1,2},symlink1,there1};
207 231
208 @echo; echo; 232 # Copy a set of files to a directory with -p and -d switches.
233 @echo; echo ------------------------------;
209 cd cp_tests; \ 234 cd cp_tests; \
210 echo A file number one > afile1; \ 235 echo A file number one > afile1; \
211 echo A file number two, blah. > afile2; \ 236 echo A file number two, blah. > afile2; \
@@ -234,7 +259,8 @@ cp_tests: cp_clean cp
234 @echo; 259 @echo;
235 rm -rf cp_tests/{afile{1,2},symlink1,there1}; 260 rm -rf cp_tests/{afile{1,2},symlink1,there1};
236 261
237 @echo; echo; 262 # Copy a directory into another directory with the -a switch.
263 @echo; echo ------------------------------;
238 cd cp_tests; \ 264 cd cp_tests; \
239 mkdir dir{a,b}; \ 265 mkdir dir{a,b}; \
240 echo A file > dira/afile; \ 266 echo A file > dira/afile; \
@@ -246,7 +272,6 @@ cp_tests: cp_clean cp
246 ${GCP} -a dira dirb; \ 272 ${GCP} -a dira dirb; \
247 ls -lR . >> ../cp_a_dira_dirb.gnu; 273 ls -lR . >> ../cp_a_dira_dirb.gnu;
248 274
249 # false;
250 @echo; 275 @echo;
251 rm -rf cp_tests/dir{a,b}; 276 rm -rf cp_tests/dir{a,b};
252 277
@@ -265,6 +290,31 @@ cp_tests: cp_clean cp
265 @echo; 290 @echo;
266 diff -u cp_a_dira_dirb.gnu cp_a_dira_dirb.bb; 291 diff -u cp_a_dira_dirb.gnu cp_a_dira_dirb.bb;
267 292
268 # false;
269 @echo; 293 @echo;
270 rm -rf cp_tests/dir{a,b}; 294 rm -rf cp_tests/dir{a,b};
295
296 # 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.
299 cd cp_tests; \
300 touch a b c; \
301 mkdir adir; \
302 ls -lR . > ../cp_a_star_adir.gnu; \
303 ${GCP} -a * adir; \
304 ls -lR . >> ../cp_a_star_adir.gnu;
305
306 @echo
307 @echo There should be an error message about cannot cp a dir to a subdir of itself.
308 cd cp_tests; \
309 rm -rf adir; \
310 mkdir adir; \
311 ls -lR . > ../cp_a_star_adir.bb; \
312 ${BCP} -a * adir; \
313 ls -lR . >> ../cp_a_star_adir.bb;
314
315 @echo;
316 diff -u cp_a_star_adir.gnu cp_a_star_adir.bb;
317
318 @echo;
319 rm -rf cp_tests;
320 @echo; echo Done.
diff --git a/tests/ln_tests.mk b/tests/ln_tests.mk
index 5925edd4f..3110f8199 100644
--- a/tests/ln_tests.mk
+++ b/tests/ln_tests.mk
@@ -1,14 +1,19 @@
1# ln_tests.mk - Set of tests for busybox ln
2# -------------
3# Copyright (C) 2000 Karl M. Hegbloom <karlheg@debian.org> GPL
4#
1 5
2# GNU `ln' 6# GNU `ln'
3GLN = /bin/ln 7GLN = /bin/ln
4# BusyBox `ln' 8# BusyBox `ln'
5BLN = $(shell pwd)/ln 9BLN = $(shell pwd)/ln
6 10
7.PHONY: ln_clean 11all:: ln_tests
12clean:: ln_clean
13
8ln_clean: 14ln_clean:
9 rm -rf ln_tests ln_*.{gnu,bb} ln 15 rm -rf ln_tests ln_*.{gnu,bb} ln
10 16
11.PHONY: ln_tests
12ln_tests: ln_clean ln 17ln_tests: ln_clean ln
13 @echo; 18 @echo;
14 @echo "No output from diff means busybox ln is functioning properly."; 19 @echo "No output from diff means busybox ln is functioning properly.";
diff --git a/tests/mv_tests.mk b/tests/mv_tests.mk
index 3a9012538..81b8ffdec 100644
--- a/tests/mv_tests.mk
+++ b/tests/mv_tests.mk
@@ -1,14 +1,19 @@
1# mv_tests.mk - Set of tests cases for busybox mv
2# -------------
3# Copyright (C) 2000 Karl M. Hegbloom <karlheg@debian.org> GPL
4#
1 5
2# GNU `mv' 6# GNU `mv'
3GMV = /bin/mv 7GMV = /bin/mv
4# BusyBox `mv' 8# BusyBox `mv'
5BMV = $(shell pwd)/mv 9BMV = $(shell pwd)/mv
6 10
7.PHONY: mv_clean 11all:: mv_tests
12clean:: mv_clean
13
8mv_clean: 14mv_clean:
9 rm -rf mv_tests mv_*.{gnu,bb} mv 15 rm -rf mv_tests mv_*.{gnu,bb} mv
10 16
11.PHONY: mv_tests
12mv_tests: mv_clean mv 17mv_tests: mv_clean mv
13 @echo; 18 @echo;
14 @echo "No output from diff means busybox mv is functioning properly."; 19 @echo "No output from diff means busybox mv is functioning properly.";
@@ -45,7 +50,7 @@ mv_tests: mv_clean mv
45 @echo; 50 @echo;
46 rm -f mv_tests/{afile,newname}; 51 rm -f mv_tests/{afile,newname};
47 52
48 @echo; echo; 53 @echo; echo ------------------------------;
49 cd mv_tests; \ 54 cd mv_tests; \
50 echo A file > afile; \ 55 echo A file > afile; \
51 ln -s afile symlink; \ 56 ln -s afile symlink; \
@@ -72,7 +77,7 @@ mv_tests: mv_clean mv
72 @echo; 77 @echo;
73 rm -rf mv_tests/*; 78 rm -rf mv_tests/*;
74 79
75 @echo; echo; 80 @echo; echo ------------------------------;
76 cd mv_tests; \ 81 cd mv_tests; \
77 echo A file > afile; \ 82 echo A file > afile; \
78 ln -s afile symlink; \ 83 ln -s afile symlink; \
@@ -85,7 +90,7 @@ mv_tests: mv_clean mv
85 @echo; 90 @echo;
86 rm -rf mv_tests/* 91 rm -rf mv_tests/*
87 92
88 @echo; echo; 93 @echo; echo ------------------------------;
89 cd mv_tests; \ 94 cd mv_tests; \
90 echo A file > afile; \ 95 echo A file > afile; \
91 ln -s afile symlink; \ 96 ln -s afile symlink; \
@@ -101,7 +106,7 @@ mv_tests: mv_clean mv
101 @echo; 106 @echo;
102 rm -rf mv_tests/*; 107 rm -rf mv_tests/*;
103 108
104 @echo; echo; 109 @echo; echo ------------------------------;
105 cd mv_tests; \ 110 cd mv_tests; \
106 mkdir dir{a,b}; \ 111 mkdir dir{a,b}; \
107 echo A file > dira/afile; \ 112 echo A file > dira/afile; \
@@ -135,3 +140,27 @@ mv_tests: mv_clean mv
135 # false; 140 # false;
136 @echo; 141 @echo;
137 rm -rf mv_tests/dir{a,b}; 142 rm -rf mv_tests/dir{a,b};
143
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/*;