aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/.cvsignore16
-rw-r--r--tests/Makefile36
-rw-r--r--tests/cp_tests.mk360
-rw-r--r--tests/ln_tests.mk71
-rwxr-xr-xtests/multibuild.pl73
-rwxr-xr-xtests/multifeat.pl83
-rw-r--r--tests/mv_tests.mk167
-rw-r--r--tests/sh.testcases89
-rw-r--r--tests/syslog_test.c19
-rw-r--r--tests/testcases404
-rwxr-xr-xtests/tester.sh158
-rw-r--r--tests/tst-syslogd.c44
-rw-r--r--testsuite/basename/basename-works2
-rw-r--r--testsuite/cmp/cmp-detects-difference8
-rw-r--r--testsuite/cp/cp-a-files-to-dir8
-rw-r--r--testsuite/cp/cp-a-preserves-links2
-rw-r--r--testsuite/cp/cp-d-files-to-dir4
-rw-r--r--testsuite/cp/cp-does-not-copy-unreadable-file2
-rw-r--r--testsuite/cp/cp-preserves-links2
-rw-r--r--testsuite/date/date-R-works2
-rw-r--r--testsuite/date/date-format-works1
-rw-r--r--testsuite/date/date-u-works2
-rw-r--r--testsuite/date/date-works2
-rw-r--r--testsuite/dirname/dirname-works2
-rw-r--r--testsuite/du/du-h-works3
-rw-r--r--testsuite/du/du-k-works3
-rw-r--r--testsuite/du/du-l-works3
-rw-r--r--testsuite/du/du-m-works3
-rw-r--r--testsuite/du/du-s-works3
-rw-r--r--testsuite/du/du-works3
-rw-r--r--testsuite/echo/echo-prints-argument2
-rw-r--r--testsuite/expr/expr-works59
-rw-r--r--testsuite/grep/grep-matches-NUL8
-rw-r--r--testsuite/head/head-n-works3
-rw-r--r--testsuite/head/head-works3
-rw-r--r--testsuite/hostid/hostid-works2
-rw-r--r--testsuite/hostname/hostname-d-works2
-rw-r--r--testsuite/hostname/hostname-i-works2
-rw-r--r--testsuite/hostname/hostname-s-works1
-rw-r--r--testsuite/hostname/hostname-works1
-rw-r--r--testsuite/id/id-g-works1
-rw-r--r--testsuite/id/id-u-works1
-rw-r--r--testsuite/id/id-un-works1
-rw-r--r--testsuite/id/id-ur-works1
-rw-r--r--testsuite/ln/ln-creates-hard-links4
-rw-r--r--testsuite/ln/ln-creates-soft-links4
-rw-r--r--testsuite/ln/ln-force-creates-hard-links5
-rw-r--r--testsuite/ln/ln-force-creates-soft-links5
-rw-r--r--testsuite/ln/ln-preserves-hard-links8
-rw-r--r--testsuite/ln/ln-preserves-soft-links9
-rw-r--r--testsuite/ls/ls-1-works3
-rw-r--r--testsuite/ls/ls-h-works3
-rw-r--r--testsuite/ls/ls-l-works3
-rw-r--r--testsuite/ls/ls-s-works3
-rw-r--r--testsuite/mv/mv-files-to-dir16
-rw-r--r--testsuite/mv/mv-follows-links4
-rw-r--r--testsuite/mv/mv-moves-empty-file4
-rw-r--r--testsuite/mv/mv-moves-hardlinks4
-rw-r--r--testsuite/mv/mv-moves-large-file4
-rw-r--r--testsuite/mv/mv-moves-small-file4
-rw-r--r--testsuite/mv/mv-moves-symlinks6
-rw-r--r--testsuite/mv/mv-moves-unreadable-files5
-rw-r--r--testsuite/mv/mv-preserves-hard-links6
-rw-r--r--testsuite/mv/mv-preserves-links5
-rw-r--r--testsuite/mv/mv-refuses-mv-dir-to-subdir23
-rw-r--r--testsuite/mv/mv-removes-source-file4
-rw-r--r--testsuite/pwd/pwd-prints-working-directory2
-rwxr-xr-xtestsuite/runtest34
-rw-r--r--testsuite/sed/sed-append-next-line7
-rw-r--r--testsuite/sort/sort-n-works3
-rw-r--r--testsuite/sort/sort-r-works3
-rw-r--r--testsuite/sort/sort-works3
-rw-r--r--testsuite/strings/strings-works-like-GNU7
-rw-r--r--testsuite/tail/tail-n-works3
-rw-r--r--testsuite/tail/tail-works3
-rw-r--r--testsuite/tar/tar-extracts-multiple-files3
-rw-r--r--testsuite/tr/tr-d-works4
-rw-r--r--testsuite/tr/tr-non-gnu1
-rw-r--r--testsuite/tr/tr-works9
-rw-r--r--testsuite/uptime/uptime-works2
-rw-r--r--testsuite/uuencode/uuencode-sets-standard-input-mode-correctly2
-rw-r--r--testsuite/which/which-uses-default-path3
-rw-r--r--testsuite/xargs/xargs-works3
83 files changed, 316 insertions, 1570 deletions
diff --git a/tests/.cvsignore b/tests/.cvsignore
deleted file mode 100644
index 3645cf92f..000000000
--- a/tests/.cvsignore
+++ /dev/null
@@ -1,16 +0,0 @@
1cp
2cp_*.bb
3cp_*.gnu
4cp_tests
5date
6df
7du
8ln
9ln_*.bb
10ln_*.gnu
11ln_tests
12mv
13mv_*.bb
14mv_*.gnu
15mv_tests
16syslog_test
diff --git a/tests/Makefile b/tests/Makefile
deleted file mode 100644
index 16f53452e..000000000
--- a/tests/Makefile
+++ /dev/null
@@ -1,36 +0,0 @@
1# busybox/tests/Makefile - Run through all defined tests.
2# ------------------------
3# Copyright (C) 2000 Karl M. Hegbloom <karlheg@debian.org> GPL
4
5all:: message_header
6
7message_header:
8 @echo
9 @echo BusyBox Test Suite.
10 @echo
11 (cd ..; tests/busybox.REGRESS.sh)
12
13clean::
14 rm -f *.o
15 rm -f tester.log
16
17distclean: clean
18
19.PHONY: all clean distclean message_header
20
21include $(wildcard *_tests.mk)
22
23BBL := $(shell pushd .. >/dev/null && \
24 ${MAKE} busybox.links >/dev/null && \
25 popd >/dev/null && \
26 cat ../busybox.links | \
27 sed -e 's,.*/\(.*\)$$,\1,')
28
29../busybox:
30 cd .. && ${MAKE} busybox
31
32${BBL}: ../busybox
33 rm -f $@
34 ln ../busybox $@
35
36syslog_test: syslog_test.c
diff --git a/tests/cp_tests.mk b/tests/cp_tests.mk
deleted file mode 100644
index b96c5cea6..000000000
--- a/tests/cp_tests.mk
+++ /dev/null
@@ -1,360 +0,0 @@
1# cp_tests.mk - Set of test cases for busybox cp
2# -------------
3# Copyright (C) 2000 Karl M. Hegbloom <karlheg@debian.org> GPL
4#
5
6# GNU `cp'
7GCP = /bin/cp
8# BusyBox `cp'
9BCP = $(shell pwd)/cp
10
11all:: cp_tests
12clean:: cp_clean
13
14cp_clean:
15 - rm -rf cp_tests cp_*.{gnu,bb} cp
16
17# check_cp_dir_to_dir_wo_a removed from this list; see below
18cp_tests: cp_clean cp check_exists check_simple_cp check_cp_symlnk \
19 check_cp_symlink_w_a check_cp_files_to_dir check_cp_files_to_dir_w_d \
20 check_cp_files_to_dir_w_p check_cp_files_to_dir_w_p_and_d \
21 check_cp_dir_to_dir_w_a \
22 check_cp_dir_to_dir_w_a_take_two
23
24check_exists:
25 @echo;
26 @echo "No output from diff means busybox cp is functioning properly.";
27 @echo "Some tests might show timestamp differences that are Ok.";
28
29 @echo;
30 @echo Verify that busybox cp exists;
31 @echo ------------------------------;
32 [ -x ${BCP} ] || exit 0
33
34 @echo;
35 mkdir cp_tests;
36
37check_simple_cp:
38 @echo Copy a file to a copy of the file;
39 @echo ------------------------------;
40 cd cp_tests; \
41 echo A file > afile; \
42 ls -l afile > ../cp_afile_afilecopy.gnu; \
43 ${GCP} afile afilecopy; \
44 ls -l afile afilecopy >> ../cp_afile_afilecopy.gnu;
45
46 @echo;
47 rm -rf cp_tests/*;
48
49 @echo;
50 cd cp_tests; \
51 echo A file > afile; \
52 ls -l afile > ../cp_afile_afilecopy.bb; \
53 ${BCP} afile afilecopy; \
54 ls -l afile afilecopy >> ../cp_afile_afilecopy.bb;
55
56 @echo;
57 @echo Might show timestamp differences.
58 -diff -u cp_afile_afilecopy.gnu cp_afile_afilecopy.bb;
59
60 @echo;
61 rm -rf cp_tests/*;
62
63check_cp_symlnk:
64 @echo; echo Copy a file pointed to by a symlink;
65 @echo ------------------------------;
66 cd cp_tests; \
67 mkdir here there; \
68 echo A file > afile; \
69 cd here; \
70 ln -s ../afile .; \
71
72 @echo;
73 cd cp_tests; \
74 ls -lR . > ../cp_symlink.gnu; \
75 ${GCP} here/afile there; \
76 ls -lR . >> ../cp_symlink.gnu;
77
78 @echo;
79 rm -rf cp_tests/there/*;
80
81 sleep 1;
82
83 @echo;
84 cd cp_tests; \
85 ls -lR . > ../cp_symlink.bb; \
86 ${BCP} here/afile there; \
87 ls -lR . >> ../cp_symlink.bb;
88
89 @echo;
90 @echo Will show timestamp difference.
91 -diff -u cp_symlink.gnu cp_symlink.bb;
92
93 @echo;
94 rm -rf cp_tests/*
95
96check_cp_symlink_w_a:
97 @echo; echo Copy a symlink, useing the -a switch.;
98 @echo ------------------------------;
99 cd cp_tests; \
100 echo A file > afile; \
101 mkdir here there; \
102 cd here; \
103 ln -s ../afile .
104
105 cd cp_tests; \
106 ls -lR . > ../cp_a_symlink.gnu; \
107 ${GCP} -a here/afile there; \
108 ls -lR . >> ../cp_a_symlink.gnu;
109
110 @echo;
111 rm -rf cp_tests/there/*;
112
113 sleep 1;
114
115 @echo;
116 cd cp_tests; \
117 echo A file > afile; \
118 ls -lR . > ../cp_a_symlink.bb; \
119 ${BCP} -a here/afile there; \
120 ls -lR . >> ../cp_a_symlink.bb;
121
122 @echo;
123 diff -u cp_a_symlink.gnu cp_a_symlink.bb;
124
125 @echo;
126 rm -rf cp_tests/*;
127
128
129check_cp_files_to_dir:
130 # Copy a set of files to a directory.
131 @echo; echo Copy a set of files to a directory.;
132 @echo ------------------------------;
133 cd cp_tests; \
134 echo A file number one > afile1; \
135 echo A file number two, blah. > afile2; \
136 ln -s afile1 symlink1; \
137 mkdir there;
138
139 cd cp_tests; \
140 ${GCP} afile1 afile2 symlink1 there/; \
141 ls -lR > ../cp_files_dir.gnu;
142
143 @echo;
144 rm -rf cp_tests/there/*;
145
146 @echo;
147 cd cp_tests; \
148 ${BCP} afile1 afile2 symlink1 there/; \
149 ls -lR > ../cp_files_dir.bb;
150
151 @echo;
152 diff -u cp_files_dir.gnu cp_files_dir.bb;
153
154 @echo;
155 rm -rf cp_tests/*;
156
157check_cp_files_to_dir_w_d:
158 # Copy a set of files to a directory with the -d switch.
159 @echo; echo Copy a set of files to a directory with the -d switch.;
160 @echo ------------------------------;
161 cd cp_tests; \
162 echo A file number one > afile1; \
163 echo A file number two, blah. > afile2; \
164 ln -s afile1 symlink1; \
165 mkdir there1; \
166 ${GCP} -d afile1 afile2 symlink1 there1/; \
167 ls -lR > ../cp_d_files_dir.gnu;
168
169 @echo;
170 rm -rf cp_tests/{afile{1,2},symlink1,there1};
171
172 @echo;
173 cd cp_tests; \
174 echo A file number one > afile1; \
175 echo A file number two, blah. > afile2; \
176 ln -s afile1 symlink1; \
177 mkdir there1; \
178 ${BCP} -d afile1 afile2 symlink1 there1/; \
179 ls -lR > ../cp_d_files_dir.bb;
180
181 @echo;
182 diff -u cp_d_files_dir.gnu cp_d_files_dir.bb;
183
184 @echo;
185 rm -rf cp_tests/{afile{1,2},symlink1,there1};
186
187check_cp_files_to_dir_w_p:
188 # Copy a set of files to a directory with the -p switch.
189 @echo; echo Copy a set of files to a directory with the -p switch.;
190 @echo ------------------------------;
191 cd cp_tests; \
192 echo A file number one > afile1; \
193 echo A file number two, blah. > afile2; \
194 touch --date='Sat Jan 29 21:24:08 PST 2000' afile1; \
195 ln -s afile1 symlink1; \
196 mkdir there1; \
197 ${GCP} -p afile1 afile2 symlink1 there1/; \
198 ls -lR > ../cp_p_files_dir.gnu;
199
200 @echo;
201 rm -rf cp_tests/{afile{1,2},symlink1,there1};
202
203 @echo;
204 cd cp_tests; \
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; \
209 mkdir there1; \
210 ${BCP} -p afile1 afile2 symlink1 there1/; \
211 ls -lR > ../cp_p_files_dir.bb;
212
213 @echo;
214 diff -u cp_p_files_dir.gnu cp_p_files_dir.bb;
215
216 @echo;
217 rm -rf cp_tests/{afile{1,2},symlink1,there1};
218
219
220check_cp_files_to_dir_w_p_and_d:
221 @echo; echo Copy a set of files to a directory with -p and -d switches.
222 @echo ------------------------------;
223 cd cp_tests; \
224 echo A file number one > afile1; \
225 echo A file number two, blah. > afile2; \
226 touch --date='Sat Jan 29 21:24:08 PST 2000' afile1; \
227 ln -s afile1 symlink1; \
228 mkdir there1; \
229 ${GCP} -p -d afile1 afile2 symlink1 there1/; \
230 ls -lR > ../cp_pd_files_dir.gnu;
231
232 @echo;
233 rm -rf cp_tests/{afile{1,2},symlink1,there1};
234
235 @echo;
236 cd cp_tests; \
237 echo A file number one > afile1; \
238 echo A file number two, blah. > afile2; \
239 touch --date='Sat Jan 29 21:24:08 PST 2000' afile1; \
240 ln -s afile1 symlink1; \
241 mkdir there1; \
242 ${BCP} -p -d afile1 afile2 symlink1 there1/; \
243 ls -lR > ../cp_pd_files_dir.bb;
244
245 @echo;
246 diff -u cp_pd_files_dir.gnu cp_pd_files_dir.bb;
247
248 @echo;
249 rm -rf cp_tests/{afile{1,2},symlink1,there1};
250
251# This test doesn't work any more; gnu cp now _does_ copy a directory
252# to a subdirectory of itself. What's worse, that "feature" has no
253# (documented) way to be disabled with command line switches.
254# It's not obvious that busybox cp should mimic this behavior.
255# For now, this test is removed from the cp_tests list, above.
256check_cp_dir_to_dir_wo_a:
257 # Copy a directory to another directory, without the -a switch.
258 @echo; echo Copy a directory to another directory, without the -a switch.
259 @echo ------------------------------;
260 @echo There should be an error message about cannot cp a dir to a subdir of itself.
261 cd cp_tests; \
262 touch a b c; \
263 mkdir adir; \
264 ls -lR . > ../cp_a_star_adir.gnu; \
265 ${GCP} -a * adir; \
266 ls -lR . >> ../cp_a_star_adir.gnu;
267
268 @echo
269 @echo There should be an error message about cannot cp a dir to a subdir of itself.
270 cd cp_tests; \
271 rm -rf adir; \
272 mkdir adir; \
273 ls -lR . > ../cp_a_star_adir.bb; \
274 ${BCP} -a * adir; \
275 ls -lR . >> ../cp_a_star_adir.bb;
276
277 @echo;
278 diff -u cp_a_star_adir.gnu cp_a_star_adir.bb;
279
280 # Done
281 @echo;
282 rm -rf cp_tests;
283 @echo; echo Done.
284
285
286check_cp_dir_to_dir_w_a:
287 @echo; echo Copy a directory into another directory with the -a switch.
288 @echo ------------------------------;
289 cd cp_tests; \
290 mkdir dir{a,b}; \
291 echo A file > dira/afile; \
292 echo A file in dirb > dirb/afileindirb; \
293 ln -s dira/afile dira/alinktoafile; \
294 mkdir dira/subdir1; \
295 echo Another file > dira/subdir1/anotherfile; \
296 ls -lR . > ../cp_a_dira_dirb.gnu; \
297 ${GCP} -a dira dirb; \
298 ls -lR . >> ../cp_a_dira_dirb.gnu;
299
300 @echo;
301 rm -rf cp_tests/dir{a,b};
302
303 @echo;
304 cd cp_tests; \
305 mkdir dir{a,b}; \
306 echo A file > dira/afile; \
307 echo A file in dirb > dirb/afileindirb; \
308 ln -s dira/afile dira/alinktoafile; \
309 mkdir dira/subdir1; \
310 echo Another file > dira/subdir1/anotherfile; \
311 ls -lR . > ../cp_a_dira_dirb.bb; \
312 ${BCP} -a dira dirb; \
313 ls -lR . >> ../cp_a_dira_dirb.bb;
314
315 @echo;
316 diff -u cp_a_dira_dirb.gnu cp_a_dira_dirb.bb;
317
318 @echo;
319 rm -rf cp_tests/dir{a,b};
320
321
322check_cp_dir_to_dir_w_a_take_two:
323 @echo; echo Copy a directory into another directory with the -a switch;
324 @echo ------------------------------;
325 mkdir -p cp_tests/gnu; \
326 mkdir -p cp_tests/bb; \
327 cd cp_tests; \
328 mkdir here there; \
329 echo A file > here/afile; \
330 mkdir here/adir; \
331 touch here/adir/afileinadir; \
332 ln -s $$(pwd) here/alink;
333
334 @echo;
335 cd cp_tests/gnu; \
336 ls -lR . > ../../cp_a_dir_dir.gnu; \
337 ${GCP} -a here/ there/; \
338 ls -lR . >> ../../cp_a_dir_dir.gnu;
339
340 @echo;
341 rm -rf cp_tests/there/*;
342
343 sleep 1;
344
345 @echo;
346 cd cp_tests/bb; \
347 ls -lR . > ../../cp_a_dir_dir.bb; \
348 ${BCP} -a here/ there/; \
349 ls -lR . >> ../../cp_a_dir_dir.bb;
350
351 @echo;
352 echo "Erik 1"
353 diff -u cp_a_dir_dir.gnu cp_a_dir_dir.bb;
354 echo "Erik 2"
355
356 @echo;
357 echo "Erik 3"
358 rm -rf cp_tests/*;
359
360
diff --git a/tests/ln_tests.mk b/tests/ln_tests.mk
deleted file mode 100644
index 3110f8199..000000000
--- a/tests/ln_tests.mk
+++ /dev/null
@@ -1,71 +0,0 @@
1# ln_tests.mk - Set of tests for busybox ln
2# -------------
3# Copyright (C) 2000 Karl M. Hegbloom <karlheg@debian.org> GPL
4#
5
6# GNU `ln'
7GLN = /bin/ln
8# BusyBox `ln'
9BLN = $(shell pwd)/ln
10
11all:: ln_tests
12clean:: ln_clean
13
14ln_clean:
15 rm -rf ln_tests ln_*.{gnu,bb} ln
16
17ln_tests: ln_clean ln
18 @echo;
19 @echo "No output from diff means busybox ln is functioning properly.";
20
21 @echo;
22 ${BLN} || true;
23
24 @echo;
25 mkdir ln_tests;
26
27 @echo;
28 cd ln_tests; \
29 echo A file > afile; \
30 ls -l afile > ../ln_afile_newname.gnu; \
31 ${GLN} afile newname; \
32 ls -l afile newname >> ../ln_afile_newname.gnu;
33
34 @echo;
35 rm -f ln_tests/{afile,newname};
36
37 @echo;
38 cd ln_tests; \
39 echo A file > afile; \
40 ls -l afile > ../ln_afile_newname.bb; \
41 ${BLN} afile newname; \
42 ls -l afile newname >> ../ln_afile_newname.bb;
43
44 @echo;
45 diff -u ln_afile_newname.gnu ln_afile_newname.bb
46
47 @echo;
48 rm -f ln_tests/{afile,newname};
49
50 @echo;
51 cd ln_tests; \
52 echo A file > afile; \
53 ls -l afile > ../ln_s_afile_newname.gnu; \
54 ${GLN} -s afile newname; \
55 ls -l afile newname >> ../ln_s_afile_newname.gnu;
56
57 @echo;
58 rm -f ln_tests/{afile,newname};
59
60 @echo;
61 cd ln_tests; \
62 echo A file > afile; \
63 ls -l afile > ../ln_s_afile_newname.bb; \
64 ${BLN} -s afile newname; \
65 ls -l afile newname >> ../ln_s_afile_newname.bb;
66
67 @echo;
68 diff -u ln_s_afile_newname.gnu ln_s_afile_newname.bb
69
70 @echo;
71 rm -f ln_tests/{afile,newname};
diff --git a/tests/multibuild.pl b/tests/multibuild.pl
deleted file mode 100755
index 301ed3500..000000000
--- a/tests/multibuild.pl
+++ /dev/null
@@ -1,73 +0,0 @@
1#!/usr/bin/perl
2
3# multibuild.pl
4# Tests BusyBox-0.48 (at least) to see if each applet builds
5# properly on its own. The most likely problems this will
6# flush out are those involving preprocessor instructions in
7# utility.c.
8#
9# TODO: some time it might be nice to list absolute and
10# differential object sizes for each option...
11#
12
13$logfile = "multibuild.log";
14
15# How to handle all the CONFIG_FEATURE_FOO lines
16if ($ARGV[0] eq "-all" ) { shift(@ARGV); $choice="all"; }
17if ($ARGV[0] eq "-none") { shift(@ARGV); $choice="none"; }
18# neither means, leave that part of Config.h alone
19
20# Support building from pristine source
21$make_opt = "-f $ARGV[0]/Makefile CONFIG_SRC_DIR=$ARGV[0]" if ($ARGV[0] ne "");
22
23# Move the config file to a safe place
24-e "Config.h.orig" || 0==system("mv -f Config.h Config.h.orig") || die;
25
26# Clear previous log file, if any
27unlink($logfile);
28
29# Parse the config file
30open(C,"<Config.h.orig") || die;
31while (<C>) {
32 if ($in_trailer) {
33 if (!$in_olympus) {
34 s/^\/\/#/#/ if ($choice eq "all" && !/USE_DEVPS_PATCH/);
35 s/^#/\/\/#/ if ($choice eq "none");
36 }
37 $in_olympus=1 if /End of Features List/;
38 $trailer .= $_;
39 } else {
40 $in_trailer=1 if /End of Applications List/;
41 if (/^\/*#define CONFIG_([A-Z0-9_]*)/) {
42 push @apps, $1;
43 }
44 }
45}
46close C;
47
48# Do the real work ...
49$failed_tests=0;
50for $a (@apps) {
51 # print "Testing build of applet $a ...\n";
52 open (O, ">Config.h") || die;
53 print O "#define CONFIG_$a\n", $trailer;
54 close O;
55 system("echo -e '\n***\n$a\n***' >>$logfile");
56 # With a fast computer and 1-second resolution on file timestamps, this
57 # process pushes beyond the limits of what unix make can understand.
58 # That's why need to weed out obsolete files before restarting make.
59 $result{$a} = system("rm -f *.o applet_source_list; make $make_opt busybox >>$logfile 2>&1");
60 $flag = $result{$a} ? "FAILED!!!" : "ok";
61 printf("Applet %-20s: %s\n", $a, $flag);
62 $total_tests++;
63 $failed_tests++ if $flag eq "FAILED!!!";
64 # pause long enough to let user stop us with a ^C
65 select(undef, undef, undef, 0.03);
66}
67
68# Clean up our mess
69system("mv -f Config.h.orig Config.h");
70
71print "$total_tests applets tested, $failed_tests failures\n";
72print "See $logfile for details.\n";
73
diff --git a/tests/multifeat.pl b/tests/multifeat.pl
deleted file mode 100755
index 875b4a277..000000000
--- a/tests/multifeat.pl
+++ /dev/null
@@ -1,83 +0,0 @@
1#!/usr/bin/perl
2#
3# multifeat.pl
4#
5# Turns on all applets, then tests turning on one feature at a time through
6# iterative compilations. Tests if any features depend on each other in any
7# weird ways or such-like problems.
8#
9# Hacked by Mark Whitley, but based *heavily* on multibuild.pl which was
10# written by Larry Doolittle.
11
12$logfile = "multifeat.log";
13
14# How to handle all the CONFIG_APPLET lines
15# (most thorough testing occurs when you call it with the -all switch)
16if ($ARGV[0] eq "-all" ) { shift(@ARGV); $choice="all"; }
17if ($ARGV[0] eq "-none") { shift(@ARGV); $choice="none"; }
18# neither means, leave that part of Config.h alone
19
20# Support building from pristine source
21$make_opt = "-f $ARGV[0]/Makefile CONFIG_SRC_DIR=$ARGV[0]" if ($ARGV[0] ne "");
22
23# Move the config file to a safe place
24-e "Config.h.orig" || 0==system("mv -f Config.h Config.h.orig") || die;
25
26# Clear previous log file, if any
27unlink($logfile);
28
29# Parse the config file
30open(C,"<Config.h.orig") || die;
31$in_applist=1;
32$in_features=0;
33$in_olympus=0;
34while (<C>) {
35 if ($in_applist) {
36 s/^\/\/#/#/ if ($choice eq "all");
37 s/^#/\/\/#/ if ($choice eq "none");
38 $header .= $_;
39 if (/End of Applications List/) {
40 $in_applist=0;
41 $in_features=1
42 }
43 }
44 elsif ($in_features) {
45 if (/^\/*#define CONFIG_FEATURE_([A-Z0-9_]*)/) {
46 push @features, $1;
47 }
48 if (/End of Features List/) {
49 $in_features=0;
50 $in_olympus=1
51 }
52 } elsif ($in_olympus) {
53 $trailer .= $_;
54 }
55}
56close C;
57
58# Do the real work ...
59$failed_tests=0;
60for $f (@features) {
61 # print "Testing build with feature $f ...\n";
62 open (O, ">Config.h") || die;
63 print O $header, "#define CONFIG_FEATURE_$f\n", $trailer;
64 close O;
65 system("echo -e '\n***\n$f\n***' >>$logfile");
66 # With a fast computer and 1-second resolution on file timestamps, this
67 # process pushes beyond the limits of what unix make can understand.
68 # That's why need to weed out obsolete files before restarting make.
69 $result{$f} = system("rm -f *.o applet_source_list; make $make_opt busybox >>$logfile 2>&1");
70 $flag = $result{$f} ? "FAILED!!!" : "ok";
71 printf("Feature %-20s: %s\n", $f, $flag);
72 $total_tests++;
73 $failed_tests++ if $flag eq "FAILED!!!";
74 # pause long enough to let user stop us with a ^C
75 select(undef, undef, undef, 0.03);
76}
77
78# Clean up our mess
79system("mv -f Config.h.orig Config.h");
80
81print "$total_tests applets tested, $failed_tests failures\n";
82print "See $logfile for details.\n";
83
diff --git a/tests/mv_tests.mk b/tests/mv_tests.mk
deleted file mode 100644
index f03e08a73..000000000
--- a/tests/mv_tests.mk
+++ /dev/null
@@ -1,167 +0,0 @@
1# mv_tests.mk - Set of tests cases for busybox mv
2# -------------
3# Copyright (C) 2000 Karl M. Hegbloom <karlheg@debian.org> GPL
4#
5
6# GNU `mv'
7GMV = /bin/mv
8# BusyBox `mv'
9BMV = $(shell pwd)/mv
10
11all:: mv_tests
12clean:: mv_clean
13
14mv_clean:
15 rm -rf mv_tests mv_*.{gnu,bb} mv
16
17mv_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
53 @echo; echo ------------------------------;
54 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
80 @echo; echo ------------------------------;
81 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
93 @echo; echo ------------------------------;
94 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
109 @echo; echo ------------------------------;
110 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};
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 mkdir adir; \
148 touch -r . a b c 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 a b c adir; \
157 mkdir adir; \
158 touch -r . a b c adir; \
159 ls -lR . > ../mv_a_star_adir.bb; \
160 ${BMV} * adir; \
161 ls -lR . >> ../mv_a_star_adir.bb;
162
163 @echo;
164 diff -u mv_a_star_adir.gnu mv_a_star_adir.bb;
165
166 @echo;
167 rm -rf mv_test/*;
diff --git a/tests/sh.testcases b/tests/sh.testcases
deleted file mode 100644
index aa834d4a2..000000000
--- a/tests/sh.testcases
+++ /dev/null
@@ -1,89 +0,0 @@
1# try running this with bash, ksh, ash, and hush.
2
3# simple quoting rules.
4echo a b
5echo "a b"
6echo a "" b
7echo a '' b
8echo hello?
9echo "hello?"
10echo t* hello
11echo t\* hello
12
13# quick and painless exit for lash
14if false; then true; exit; fi
15
16# fairly simple command substitution
17echo `echo -e foo\\\necho bar`
18
19echo THIS IS A TEST >foo
20cat $(echo FOO | tr 'A-Z' 'a-z')
21cat foo | tr 'A-Z' 'a-z'
22cat $(echo FOO | tr 'A-Z' 'a-z') | tr 'A-Z' 'a-z'
23
24cat foo | if true; then tr 'A-Z' 'a-z'; else echo bar1; fi
25cat foo | if false; then tr 'A-Z' 'a-z'; else echo bar2; fi
26if true; then tr 'A-Z' 'a-z'; else echo bar3; fi <foo
27if false; then tr 'A-Z' 'a-z'; else echo bar4; fi <foo
28if true || false; then echo foo; else echo bar5; fi
29if true && false; then echo bar6; else echo foo; fi
30
31# basic distinction between local and env variables
32unset FOO
33FOO=bar env | grep FOO
34echo "but not here: $FOO"
35FOO=bar
36env | grep FOO
37echo "yes, here: $FOO"
38FOO=
39echo a $FOO b
40echo "a $FOO b"
41
42# not quite so basic variables. Credit to Matt Kraai.
43unset FOO
44FOO=bar
45export FOO
46env | grep FOO
47unset FOO
48export FOO=bar
49FOO=baz
50env | grep FOO
51
52# interaction between environment variables and if/then and subshells
53FOO=default
54if true; then FOO=new; fi
55echo $FOO
56FOO=default
57(FOO=bogus)
58echo $FOO
59
60# make sure we can duplicate file descriptors properly
61echo replacement >foo 2>&1
62cat foo
63cat doesnt_exist >foo 2>&1
64tr 'a-z' 'A-Z' <foo
65
66# fairly simple example of hush expanding variables too early
67unset TMP
68rm -f fish
69TMP=fish && >$TMP
70ls fish
71
72# ash, lash, and hush do not create wish; bash and ksh do.
73# Thanks to Tapani Tarvainen <tt@mit.jyu.fi> for this stress test.
74unset TMP
75rm -f wish
76TMP=wish >$TMP
77ls wish
78
79# The following example shows that hush's parser is
80# not _really_ Bourne compatible
81echo "echo Hello World" >"a=b"
82unset a
83chmod a+x "a=b"
84PATH=$PATH:.
85"a=b"
86echo $a
87
88# assuming the shell wasn't too buggy, clean up the mess
89rm -f a=b wish fish foo
diff --git a/tests/syslog_test.c b/tests/syslog_test.c
deleted file mode 100644
index fb4c691b1..000000000
--- a/tests/syslog_test.c
+++ /dev/null
@@ -1,19 +0,0 @@
1#include <syslog.h>
2
3int do_log(char* msg, int delay)
4{
5 openlog("testlog", LOG_PID, LOG_DAEMON);
6 while(1) {
7 syslog(LOG_ERR, "%s: testing one, two, three\n", msg);
8 sleep(delay);
9 }
10 closelog();
11 return(0);
12};
13
14int main(void)
15{
16 if (fork()==0)
17 do_log("A", 2);
18 do_log("B", 3);
19}
diff --git a/tests/testcases b/tests/testcases
deleted file mode 100644
index 37e741260..000000000
--- a/tests/testcases
+++ /dev/null
@@ -1,404 +0,0 @@
1# testcases
2#
3# This file should be filled with test cases to test applets that:
4#
5# - can somehow produce output (we can't test sync or sleep)
6# - have a GNU (or other) counterpart
7# - are not interactive (don't require a ^C or anything)
8# - don't require extensive setup or cleanup (a litte setup is fine)
9# - don't have huge and possibly damaging effects (fsck, swapoff)
10#
11# If possible, a test case should be made that tests each option the applet
12# supports. When a new option is added, a new test case should be written for
13# it. When somebody reports a bug with a testcase, that testcase should be
14# added here as well.
15#
16# Some other guidelines to follow:
17#
18# - please try to keep applets alphabetized, it will make life easier
19# - use the file tester.sh or testcases when you need to do a non-destructive
20# test on a file (i.e., cat, md5sum)
21# - try to make the applet you're testing the first thing on the line (this
22# not always possible)
23# - (???) if you have to create a temporary file, call it TMPFILE
24# - pipe symbols that represent real pipes need a space in front of them
25# (so the test script can find them and add the "../busybox" after it).
26# - pipe symbols that are not used for pipes need to be shell-escaped,
27# with a double \. See the expr test cases.
28
29
30# ar
31
32# basename
33basename `pwd`
34
35# cat
36cat tester.sh
37echo hello there | cat tester.sh -
38
39# chmod
40# chown
41# chgrp
42# chroot
43# chvt - can't be tested here
44# clear - can't be tested here
45# cmp
46# cp
47
48# cut
49echo "1234" | cut -c1
50echo "1234" | cut -c 1
51echo "1234567890" | cut -c2-7
52echo "1234567890" | cut -c 2-7
53echo "f1 f2" | cut -f2
54echo "f1 f2" | cut -f 2
55echo "f1 f2 f3 f4 f5" | cut -f2-4
56echo "f1 f2 f3 f4 f5" | cut -f 2-4
57
58# date
59date
60date -R
61date -u
62date +%d/%m/%y
63
64# dc - needs an input file
65
66# dd
67# BUG: record count line goes to stdout instead of stderr
68dd if=/dev/urandom of=O bs=1k count=1 ; ls -l O ; rm O
69
70# deallocvt
71
72# df
73# XXX: minor formatting differences
74df
75df .
76df -k
77df -h
78df -m
79
80# dirname
81dirname `pwd`
82
83# dmesg (XXX: change the silly cmd business in the source)
84dmesg
85dmesg -n 8
86dmesg -s 512
87# I really don't want to do this next one
88#dmesg -c
89
90# dos2unix - needs an input file
91# dpkg
92# dpkg_deb
93
94# du
95# BUG: rounding behavior differs from GNU du
96du
97du -s
98du -l
99du -k
100du -h
101du -m
102
103# dumpkmap - no counterprt?
104# dutmp - no counterprt?
105
106# echo
107echo "foo bar baz"
108echo -n "no newline"
109
110
111# expr
112expr 1 \\| 1
113expr 1 \\| 0
114expr 0 \\| 1
115expr 0 \\| 0
116
117expr 1 \\& 1
118expr 1 \\& 0
119expr 0 \\& 1
120expr 0 \\& 0
121
122expr 0 \\< 1
123expr 1 \\< 0
124
125expr 1 \\> 0
126expr 0 \\> 1
127
128expr 0 \\<= 1
129expr 1 \\<= 0
130expr 1 \\<= 1
131
132expr 1 \\>= 0
133expr 0 \\>= 1
134expr 1 \\>= 1
135
136expr 1 + 2
137expr 2 - 1
138expr 2 \\* 3
139expr 12 / 2
140expr 12 % 5
141
142# somebody else can do all the string stuff
143
144
145# fbset - can't be tested here
146# fdflush
147# find
148find .
149
150# free
151# XXX: minor formatting differences
152free
153
154# freeramdisk
155# fsck.minix - won't test
156# getopt
157
158# grep
159grep -l strdup ../*utils/*.c
160grep -c strdup ../*utils/*.c
161grep -lc strdup ../*utils/*.c
162grep -cv strdup ../*utils/*.c
163grep -i null ../findutils/grep.c
164grep -e strdup -e regcomp -e atexit ../findutils/grep.c
165
166# gunzip
167
168# gzip
169# XXX: compressed output differs from gzip-1.2.4, but decompresses fine
170echo testing 1 2 3 >tmpfile1; gzip tmpfile1; echo tmpfile*; md5sum tmpfile1.gz; rm tmpfile1.gz
171echo testing 1 2 3 | gzip >tmpfile1.gz; md5sum tmpfile1.gz; rm tmpfile1.gz
172
173
174# halt - won't test, dangerous
175
176# head
177head tester.sh
178head -n 2 tester.sh
179
180# hostid
181hostid
182
183# hostname
184# XXX: minor formatting differences
185hostname
186hostname -s
187hostname -i
188hostname -d
189# not going to do this next one
190#hostname -F
191
192# id
193# BUG: Busybox id doesn't print supplemental groups
194id
195id -u
196id -g
197id -ur
198id -un
199
200
201# ifconfig
202# requires CONFIG_FEATURE_IFCONFIG_STATUS
203ifconfig
204#ifconfig -a
205#ifconfig eth0
206#ifconfig lo
207
208# init - won't test
209# insmod - won't test
210
211# kill
212#kill -l
213# not going to do any more
214
215# length
216# ln - see ln_tests.mk
217# loadacm
218# loadfont
219# loadkmap
220# logger
221# logname
222
223# ls
224# XXX: minor formatting differences
225ls ../e*
226ls -l ../e*
227ls -s ../e*
228ls -h ../e*
229ls -1 ../e*
230
231# lsmod
232lsmod
233
234# makedevs
235
236# md5sum
237md5sum tester.sh
238
239# mkdir
240mkdir D ; ls -ld D ; rmdir D
241
242# mkfifo
243#
244# we will test making one. actually testing pushing data through it requires
245# more interaction than we can manage here.
246# (these lines turn up an existing ls bug)
247mkfifo F ; ls -l F ; rm F
248mkfifo -m 0600 F ; ls -l F ; rm F
249
250# mkfs.minix - won't test
251# mknod
252# mkswap - won't test
253# mktemp
254# more - can't test: interactive
255
256# mount
257# BUG: proc line starts with /proc instead of proc
258mount
259# not going to test mount with any args, can't be done safely or sanely
260
261# mt
262# mv - see mv_tests.mk
263# nc
264# nfsmount
265# nslookup
266# ping
267ping -c 3 yahoo.com
268# pivot_root
269# poweroff - won't test
270# printf
271# ps - there's lotsa differences between busybox ps and any other ps
272
273# pwd
274pwd
275
276# rdate - won't test
277
278# readlink
279ln -sf tester.sh L ; readlink L ; rm -f L
280
281# reboot - won't test
282# renice - won't test
283# reset - can't test: no output
284
285# rm
286touch F ; rm F
287
288# rmdir
289# rmmod - won't test: dangerous
290
291# route
292# XXX: doesn't DNS resolve
293route
294
295# rpm2cpio
296
297# sed - we can do some one-liners here, some testing is a little
298# difficult to do in just this space (like a,i,c cmds).
299
300# test ^$ matching
301echo foo | sed -ne '/^$/p'
302echo -e "foo\\n\\nbar" | sed -ne '/^$/p'
303
304sed -e '/test$/d' testcases
305sed -e '/^echo/d' testcases
306sed -e '/test/s/dangerous/PELIGROSO/' testcases
307sed -ne '1,/getopt/p' ../shellutils/pwd.c
308sed -e '/getopt/r ../shellutils/pwd.c' ../editors/sed.c
309
310
311# setkeycodes
312
313# sh - note that we cannot test the shell interactively here
314sh -c "echo a b c"
315sh -c ">"
316sh -c "a"
317sh sh.testcases
318
319
320# sleep - can't test: produces no output
321
322# sort
323sort tester.sh
324sort -n tester.sh
325sort -r tester.sh
326
327# stty
328# swapon - won't test: dangerous
329# swapoff - won't test: dangerous
330# sync - can't test: no output
331# syslogd - won't test: too involved
332
333# tail
334tail tester.sh
335tail -n 2 tester.sh
336
337# tar
338
339# tee
340echo "please tee me!" | tee A B C ; cat A B C
341echo "please tee me!" | tee A B C ; echo "tee me too!" | tee -a A B C ; cat A B C ; rm A B C
342
343# telnet - can't test: interactive
344
345# test
346# tftp
347
348# touch
349touch tmpfile1; ls tmpfile1; rm -f tmpfile1
350touch -c tmpfile1; ls tmpfile1; rm -f tmpfile1
351
352# tr
353# BUG: Busybox tr range handling minix style [a-z] instead of GNU # style a-z
354echo "cbaab" | tr abc zyx
355echo "TESTING A B C" | tr [A-Z] [a-z]
356# not GNU compatible
357echo fdhrnzvfu bffvsentr | tr [a-z] [n-z][a-m]
358echo abc[] | tr a[b AXB
359echo testing | tr -d aeiou
360
361# true
362true ; echo $?
363
364# false
365false ; echo $?
366
367# tty
368# umount
369# uname
370# uniq
371# unix2dos
372# update
373
374# uptime
375# BUG: doesn't print number of users
376uptime
377
378# usleep
379# uudecode
380# uuencode
381# watchdog
382
383# wc
384wc tester.sh
385wc -c tester.sh
386wc -w tester.sh
387wc -l tester.sh
388wc -L tester.sh
389
390# wget
391
392# which
393which ls
394
395# whoami
396whoami
397
398# xargs
399# XXX: Busygox xargs divides filenames with '\n' instead of ' '
400ls -1 ../e* | xargs
401ls -1 ../e* | xargs md5sum
402
403# yes - can't test: interactive (needs ^C)
404
diff --git a/tests/tester.sh b/tests/tester.sh
deleted file mode 100755
index a17762f05..000000000
--- a/tests/tester.sh
+++ /dev/null
@@ -1,158 +0,0 @@
1#!/bin/bash
2#
3# tester.sh - reads testcases from file and tests busybox applets vs GNU
4# counterparts
5#
6# This should be run from within the tests/ directory. Before you run it, you
7# should compile up a busybox that has all applets and all features turned on.
8
9# set up defaults (can be changed with cmd-line options)
10BUSYBOX=../busybox
11TESTCASES=testcases
12LOGFILE=tester.log
13CONFIG_OUT=bb.out
14GNU_OUT=gnu.out
15SETUP=""
16CLEANUP=""
17KEEPTMPFILES="no"
18DEBUG=2
19
20
21#while getopts 'p:t:l:b:g:s:c:kd:' opt
22while getopts 'p:t:l:s:c:kd:' opt
23do
24 case $opt in
25 p) BUSYBOX=$OPTARG; ;;
26 t) TESTCASES=$OPTARG; ;;
27 l) LOGFILE=$OPTARG; ;;
28# b) CONFIG_OUT=$OPTARG; ;;
29# g) GNU_OUT=$OPTARG; ;;
30 s) SETUP=$OPTARG; ;;
31 c) CLEANUP=$OPTARG; ;;
32 k) KEEPTMPFILES="yes"; ;;
33 d) DEBUG=$OPTARG; ;;
34 *)
35 echo "usage: $0 [-ptlbgsc]"
36 echo " -p PATH path to busybox executable (default=$BUSYBOX)"
37 echo " -t FILE run testcases in FILE (default=$TESTCASES)"
38 echo " -l FILE log test results in FILE (default=$LOGFILE)"
39# echo " -b FILE store temporary busybox output in FILE"
40# echo " -g FILE store temporary GNU output in FILE"
41 echo " -s FILE (setup) run commands in FILE before testcases"
42 echo " -c FILE (cleanup) run commands in FILE after testcases"
43 echo " -k keep temporary output files (don't delete them)"
44 echo " -d NUM set level of debugging output"
45 echo " 0 = no output"
46 echo " 1 = output failures / whoops lines only"
47 echo " 2 = (default) output setup / cleanup msgs and testcase lines"
48 echo " 3+= other debug noise (internal stuff)"
49 exit 1
50 ;;
51 esac
52done
53#shift `expr $OPTIND - 1`
54
55
56# maybe print some debug output
57if [ $DEBUG -ge 3 ]
58then
59 echo "BUSYBOX=$BUSYBOX"
60 echo "TESTCASES=$TESTCASES"
61 echo "LOGFILE=$LOGFILE"
62 echo "CONFIG_OUT=$CONFIG_OUT"
63 echo "GNU_OUT=$GNU_OUT"
64 echo "SETUP=$SETUP"
65 echo "CLEANUP=$CLEANUP"
66 echo "DEBUG=$DEBUG"
67fi
68
69
70# do sanity checks
71if [ ! -e $BUSYBOX ]
72then
73 echo "Busybox executable: $BUSYBOX not found!"
74 exit 1
75fi
76
77if [ ! -e $TESTCASES ]
78then
79 echo "Testcases file: $TESTCASES not found!"
80 exit 1
81fi
82
83
84# do normal setup
85[ -e $LOGFILE ] && rm $LOGFILE
86unalias -a # gets rid of aliases that might create different output
87
88
89# do extra setup (if any)
90if [ ! -z "$SETUP" ]
91then
92 [ $DEBUG -ge 2 ] && echo "running setup commands in $SETUP"
93 source $SETUP
94fi
95
96
97# go through each line in the testcase file
98cat $TESTCASES | while read line
99do
100 #echo $line
101 # only process non-blank lines and non-comment lines
102 if [ "$line" ]
103 then
104 if [ `echo "$line" | cut -c1` != "#" ]
105 then
106
107 # test if the applet was compiled into busybox
108 # (this only tests the applet at the beginning of the line)
109 #applet=`echo $line | cut -d' ' -f1`
110 applet=`echo $line | sed 's/\(^[^ ;]*\)[ ;].*/\1/'`
111 $BUSYBOX 2>&1 | grep -qw $applet
112 if [ $? -eq 1 ]
113 then
114 echo "WHOOPS: $applet not compiled into busybox" | tee -a $LOGFILE
115 else
116
117 # execute line using gnu / system programs
118 [ $DEBUG -ge 2 ] && echo "testing: $line" | tee -a $LOGFILE
119 sh -c "$line" > $GNU_OUT
120
121 # change line to include "busybox" before every statement
122 line="$BUSYBOX $line"
123 # is this a bash-2-ism?
124 # line=${line//;/; $BUSYBOX }
125 # line=${line//|/| $BUSYBOX }
126 # assume $BUSYBOX has no commas
127 line=`echo "$line" | sed -e 's,;,; '$BUSYBOX, \
128 -e 's, |, | '$BUSYBOX,`
129
130 # execute line using busybox programs
131 [ $DEBUG -ge 2 ] && echo "testing: $line" | tee -a $LOGFILE
132 sh -c "$line" > $CONFIG_OUT
133
134 # see if they match
135 diff -q $CONFIG_OUT $GNU_OUT > /dev/null
136 if [ $? -eq 1 ]
137 then
138 [ $DEBUG -ge 1 ] && echo "FAILED: $line" | tee -a $LOGFILE
139 diff -u $CONFIG_OUT $GNU_OUT >> $LOGFILE
140 fi
141 fi
142 fi
143 fi
144done
145
146[ $DEBUG -gt 0 ] && echo "Finished. Results are in $LOGFILE"
147
148
149# do normal cleanup
150[ "$KEEPTMPFILES" = "no" ] && rm -f $CONFIG_OUT $GNU_OUT
151
152
153# do extra cleanup (if any)
154if [ ! -z "$CLEANUP" ]
155then
156 [ $DEBUG -ge 2 ] && echo "running cleanup commands in $CLEANUP"
157 source $CLEANUP
158fi
diff --git a/tests/tst-syslogd.c b/tests/tst-syslogd.c
deleted file mode 100644
index bae10afdf..000000000
--- a/tests/tst-syslogd.c
+++ /dev/null
@@ -1,44 +0,0 @@
1/*
2 * tst-syslogd.c - tests concurrent threads calling syslog
3 *
4 * build with: gcc -Wall tst-syslogd.c -lpthread
5 */
6
7#include <stdio.h>
8#include <pthread.h>
9#include <syslog.h>
10#include <unistd.h>
11
12void *log_func(void *arg)
13{
14 int i;
15 int thrid = (int)arg;
16
17 openlog(NULL, LOG_PERROR | LOG_PID, LOG_USER);
18 for (i = 0; i < 10; i++) {
19 syslog(LOG_DEBUG, "thread %i iter %i\n", thrid, i);
20 sleep(thrid); /* this mixes things up a bit */
21 }
22 closelog();
23
24 return NULL;
25}
26
27int main(int argc, char **argv)
28{
29 pthread_t thr1, thr2, thr3;
30 int id1 = 1;
31 int id2 = 2;
32 int id3 = 3;
33
34 pthread_create(&thr1, NULL, log_func, (void *)id1);
35 pthread_create(&thr2, NULL, log_func, (void *)id2);
36 pthread_create(&thr3, NULL, log_func, (void *)id3);
37
38 pthread_join(thr1, NULL);
39 pthread_join(thr2, NULL);
40 pthread_join(thr3, NULL);
41
42 return 0;
43}
44
diff --git a/testsuite/basename/basename-works b/testsuite/basename/basename-works
new file mode 100644
index 000000000..38907d4c1
--- /dev/null
+++ b/testsuite/basename/basename-works
@@ -0,0 +1,2 @@
1test x$(basename $(pwd)) = x$(busybox basename $(pwd))
2
diff --git a/testsuite/cmp/cmp-detects-difference b/testsuite/cmp/cmp-detects-difference
index aa0744487..b9bb628f1 100644
--- a/testsuite/cmp/cmp-detects-difference
+++ b/testsuite/cmp/cmp-detects-difference
@@ -1,3 +1,9 @@
1echo foo >foo 1echo foo >foo
2echo bar >bar 2echo bar >bar
3! busybox cmp -s foo bar 3set +e
4busybox cmp -s foo bar
5if [ $? != 0 ] ; then
6 exit 0;
7fi
8
9exit 1;
diff --git a/testsuite/cp/cp-a-files-to-dir b/testsuite/cp/cp-a-files-to-dir
index 8fb3c201d..39f8f8103 100644
--- a/testsuite/cp/cp-a-files-to-dir
+++ b/testsuite/cp/cp-a-files-to-dir
@@ -8,7 +8,7 @@ busybox cp -a file1 file2 link1 dir1 there
8test -f there/file1 8test -f there/file1
9test -f there/file2 9test -f there/file2
10test ! -s there/dir1/file3 10test ! -s there/dir1/file3
11test -l there/link1 11test -L there/link1
12test `readlink there/link1` = "file2" 12test xfile2 = x`readlink there/link1`
13test ! file3 -ot there/dir1/file3 13test ! dir1/file3 -ot there/dir1/file3
14test ! file3 -nt there/dir1/file3 14test ! dir1/file3 -nt there/dir1/file3
diff --git a/testsuite/cp/cp-a-preserves-links b/testsuite/cp/cp-a-preserves-links
index aae8313c6..0c0cd9653 100644
--- a/testsuite/cp/cp-a-preserves-links
+++ b/testsuite/cp/cp-a-preserves-links
@@ -2,4 +2,4 @@ touch foo
2ln -s foo bar 2ln -s foo bar
3busybox cp -a bar baz 3busybox cp -a bar baz
4test -L baz 4test -L baz
5test `readlink baz` = "foo" 5test xfoo = x`readlink baz`
diff --git a/testsuite/cp/cp-d-files-to-dir b/testsuite/cp/cp-d-files-to-dir
index 9407ead00..9571a567e 100644
--- a/testsuite/cp/cp-d-files-to-dir
+++ b/testsuite/cp/cp-d-files-to-dir
@@ -7,5 +7,5 @@ busybox cp -d file1 file2 file3 link1 there
7test -f there/file1 7test -f there/file1
8test -f there/file2 8test -f there/file2
9test ! -s there/file3 9test ! -s there/file3
10test -l there/link1 10test -L there/link1
11test `readlink there/link1` = "file2" 11test xfile2 = x`readlink there/link1`
diff --git a/testsuite/cp/cp-does-not-copy-unreadable-file b/testsuite/cp/cp-does-not-copy-unreadable-file
index 68c576727..ce11bfab0 100644
--- a/testsuite/cp/cp-does-not-copy-unreadable-file
+++ b/testsuite/cp/cp-does-not-copy-unreadable-file
@@ -1,4 +1,6 @@
1touch foo 1touch foo
2chmod a-r foo 2chmod a-r foo
3set +e
3busybox cp foo bar 4busybox cp foo bar
5set -e
4test ! -f bar 6test ! -f bar
diff --git a/testsuite/cp/cp-preserves-links b/testsuite/cp/cp-preserves-links
index d3223b132..301dc5fd8 100644
--- a/testsuite/cp/cp-preserves-links
+++ b/testsuite/cp/cp-preserves-links
@@ -2,4 +2,4 @@ touch foo
2ln -s foo bar 2ln -s foo bar
3busybox cp -d bar baz 3busybox cp -d bar baz
4test -L baz 4test -L baz
5test `readlink baz` = "foo" 5test xfoo = x`readlink baz`
diff --git a/testsuite/date/date-R-works b/testsuite/date/date-R-works
new file mode 100644
index 000000000..ec3a06751
--- /dev/null
+++ b/testsuite/date/date-R-works
@@ -0,0 +1,2 @@
1test x"`date -R`" = x"`busybox date -R`"
2
diff --git a/testsuite/date/date-format-works b/testsuite/date/date-format-works
new file mode 100644
index 000000000..f28d06cfc
--- /dev/null
+++ b/testsuite/date/date-format-works
@@ -0,0 +1 @@
test x"`date +%d/%m/%y`" = x"`busybox date +%d/%m/%y`"
diff --git a/testsuite/date/date-u-works b/testsuite/date/date-u-works
new file mode 100644
index 000000000..7d9902a3f
--- /dev/null
+++ b/testsuite/date/date-u-works
@@ -0,0 +1,2 @@
1test x"`date -u`" = x"`busybox date -u`"
2
diff --git a/testsuite/date/date-works b/testsuite/date/date-works
new file mode 100644
index 000000000..2f6dd1eca
--- /dev/null
+++ b/testsuite/date/date-works
@@ -0,0 +1,2 @@
1test x"`date`" = x"`busybox date`"
2
diff --git a/testsuite/dirname/dirname-works b/testsuite/dirname/dirname-works
new file mode 100644
index 000000000..f339c8f73
--- /dev/null
+++ b/testsuite/dirname/dirname-works
@@ -0,0 +1,2 @@
1test x$(dirname $(pwd)) = x$(busybox dirname $(pwd))
2
diff --git a/testsuite/du/du-h-works b/testsuite/du/du-h-works
new file mode 100644
index 000000000..8ec5d4c24
--- /dev/null
+++ b/testsuite/du/du-h-works
@@ -0,0 +1,3 @@
1du -h .. > logfile.gnu
2busybox du -h .. > logfile.bb
3cmp logfile.gnu logfile.bb
diff --git a/testsuite/du/du-k-works b/testsuite/du/du-k-works
new file mode 100644
index 000000000..43b119c7c
--- /dev/null
+++ b/testsuite/du/du-k-works
@@ -0,0 +1,3 @@
1du -k .. > logfile.gnu
2busybox du -k .. > logfile.bb
3cmp logfile.gnu logfile.bb
diff --git a/testsuite/du/du-l-works b/testsuite/du/du-l-works
new file mode 100644
index 000000000..c5d439853
--- /dev/null
+++ b/testsuite/du/du-l-works
@@ -0,0 +1,3 @@
1du -l .. > logfile.gnu
2busybox du -l .. > logfile.bb
3cmp logfile.gnu logfile.bb
diff --git a/testsuite/du/du-m-works b/testsuite/du/du-m-works
new file mode 100644
index 000000000..e3e2d3a56
--- /dev/null
+++ b/testsuite/du/du-m-works
@@ -0,0 +1,3 @@
1du -m .. > logfile.gnu
2busybox du -m .. > logfile.bb
3cmp logfile.gnu logfile.bb
diff --git a/testsuite/du/du-s-works b/testsuite/du/du-s-works
new file mode 100644
index 000000000..16b0a3e5a
--- /dev/null
+++ b/testsuite/du/du-s-works
@@ -0,0 +1,3 @@
1du -s .. > logfile.gnu
2busybox du -s .. > logfile.bb
3cmp logfile.gnu logfile.bb
diff --git a/testsuite/du/du-works b/testsuite/du/du-works
new file mode 100644
index 000000000..87ba63032
--- /dev/null
+++ b/testsuite/du/du-works
@@ -0,0 +1,3 @@
1du .. > logfile.gnu
2busybox du .. > logfile.bb
3cmp logfile.gnu logfile.bb
diff --git a/testsuite/echo/echo-prints-argument b/testsuite/echo/echo-prints-argument
index 98779dbbb..479dac89c 100644
--- a/testsuite/echo/echo-prints-argument
+++ b/testsuite/echo/echo-prints-argument
@@ -1 +1 @@
test `busybox echo fubar` = fubar test xfubar = x`busybox echo fubar`
diff --git a/testsuite/expr/expr-works b/testsuite/expr/expr-works
new file mode 100644
index 000000000..af49ac4d5
--- /dev/null
+++ b/testsuite/expr/expr-works
@@ -0,0 +1,59 @@
1# busybox expr
2busybox expr 1 \| 1
3busybox expr 1 \| 0
4busybox expr 0 \| 1
5busybox expr 1 \& 1
6busybox expr 0 \< 1
7busybox expr 1 \> 0
8busybox expr 0 \<= 1
9busybox expr 1 \<= 1
10busybox expr 1 \>= 0
11busybox expr 1 \>= 1
12busybox expr 1 + 2
13busybox expr 2 - 1
14busybox expr 2 \* 3
15busybox expr 12 / 2
16busybox expr 12 % 5
17
18
19set +e
20busybox expr 0 \| 0
21if [ $? != 1 ] ; then
22 exit 1;
23fi;
24
25busybox expr 1 \& 0
26if [ $? != 1 ] ; then
27 exit 1;
28fi;
29
30busybox expr 0 \& 1
31if [ $? != 1 ] ; then
32 exit 1;
33fi;
34
35busybox expr 0 \& 0
36if [ $? != 1 ] ; then
37 exit 1;
38fi;
39
40busybox expr 1 \< 0
41if [ $? != 1 ] ; then
42 exit 1;
43fi;
44
45busybox expr 0 \> 1
46if [ $? != 1 ] ; then
47 exit 1;
48fi;
49
50busybox expr 1 \<= 0
51if [ $? != 1 ] ; then
52 exit 1;
53fi;
54
55busybox expr 0 \>= 1
56if [ $? != 1 ] ; then
57 exit 1;
58fi;
59
diff --git a/testsuite/grep/grep-matches-NUL b/testsuite/grep/grep-matches-NUL
index 597d22cb4..082bd8700 100644
--- a/testsuite/grep/grep-matches-NUL
+++ b/testsuite/grep/grep-matches-NUL
@@ -1,2 +1,8 @@
1# XFAIL 1set +e
2echo -e '\0' | busybox grep . 2echo -e '\0' | busybox grep .
3if [ $? != 0 ] ; then
4 exit 0;
5fi
6
7exit 1;
8
diff --git a/testsuite/head/head-n-works b/testsuite/head/head-n-works
new file mode 100644
index 000000000..121a1fa1d
--- /dev/null
+++ b/testsuite/head/head-n-works
@@ -0,0 +1,3 @@
1head -n 2 ../README > logfile.gnu
2busybox head -n 2 ../README > logfile.bb
3cmp logfile.gnu logfile.bb
diff --git a/testsuite/head/head-works b/testsuite/head/head-works
new file mode 100644
index 000000000..ea10adeb4
--- /dev/null
+++ b/testsuite/head/head-works
@@ -0,0 +1,3 @@
1head ../README > logfile.gnu
2busybox head ../README > logfile.bb
3cmp logfile.gnu logfile.bb
diff --git a/testsuite/hostid/hostid-works b/testsuite/hostid/hostid-works
new file mode 100644
index 000000000..e85698e66
--- /dev/null
+++ b/testsuite/hostid/hostid-works
@@ -0,0 +1,2 @@
1test x$(hostid) = x$(busybox hostid)
2
diff --git a/testsuite/hostname/hostname-d-works b/testsuite/hostname/hostname-d-works
new file mode 100644
index 000000000..a9aeb92cb
--- /dev/null
+++ b/testsuite/hostname/hostname-d-works
@@ -0,0 +1,2 @@
1test x$(hostname -d) = x$(busybox hostname -d)
2
diff --git a/testsuite/hostname/hostname-i-works b/testsuite/hostname/hostname-i-works
new file mode 100644
index 000000000..68a3e6789
--- /dev/null
+++ b/testsuite/hostname/hostname-i-works
@@ -0,0 +1,2 @@
1test x$(hostname -i) = x$(busybox hostname -i)
2
diff --git a/testsuite/hostname/hostname-s-works b/testsuite/hostname/hostname-s-works
new file mode 100644
index 000000000..172b94409
--- /dev/null
+++ b/testsuite/hostname/hostname-s-works
@@ -0,0 +1 @@
test x$(hostname -s) = x$(busybox hostname -s)
diff --git a/testsuite/hostname/hostname-works b/testsuite/hostname/hostname-works
new file mode 100644
index 000000000..f51a406ea
--- /dev/null
+++ b/testsuite/hostname/hostname-works
@@ -0,0 +1 @@
test x$(hostname) = x$(busybox hostname)
diff --git a/testsuite/id/id-g-works b/testsuite/id/id-g-works
new file mode 100644
index 000000000..671fc5361
--- /dev/null
+++ b/testsuite/id/id-g-works
@@ -0,0 +1 @@
test x$(id -g) = x$(busybox id -g)
diff --git a/testsuite/id/id-u-works b/testsuite/id/id-u-works
new file mode 100644
index 000000000..2358cb0d7
--- /dev/null
+++ b/testsuite/id/id-u-works
@@ -0,0 +1 @@
test x$(id -u) = x$(busybox id -u)
diff --git a/testsuite/id/id-un-works b/testsuite/id/id-un-works
new file mode 100644
index 000000000..db390e733
--- /dev/null
+++ b/testsuite/id/id-un-works
@@ -0,0 +1 @@
test x$(id -un) = x$(busybox id -un)
diff --git a/testsuite/id/id-ur-works b/testsuite/id/id-ur-works
new file mode 100644
index 000000000..6b0fcb038
--- /dev/null
+++ b/testsuite/id/id-ur-works
@@ -0,0 +1 @@
test x$(id -ur) = x$(busybox id -ur)
diff --git a/testsuite/ln/ln-creates-hard-links b/testsuite/ln/ln-creates-hard-links
new file mode 100644
index 000000000..2f6e23f9a
--- /dev/null
+++ b/testsuite/ln/ln-creates-hard-links
@@ -0,0 +1,4 @@
1echo file number one > file1
2busybox ln file1 link1
3test -f file1
4test -f link1
diff --git a/testsuite/ln/ln-creates-soft-links b/testsuite/ln/ln-creates-soft-links
new file mode 100644
index 000000000..e875e4c8a
--- /dev/null
+++ b/testsuite/ln/ln-creates-soft-links
@@ -0,0 +1,4 @@
1echo file number one > file1
2busybox ln -s file1 link1
3test -L link1
4test xfile1 = x`readlink link1`
diff --git a/testsuite/ln/ln-force-creates-hard-links b/testsuite/ln/ln-force-creates-hard-links
new file mode 100644
index 000000000..c96b7d6cf
--- /dev/null
+++ b/testsuite/ln/ln-force-creates-hard-links
@@ -0,0 +1,5 @@
1echo file number one > file1
2echo file number two > link1
3busybox ln -f file1 link1
4test -f file1
5test -f link1
diff --git a/testsuite/ln/ln-force-creates-soft-links b/testsuite/ln/ln-force-creates-soft-links
new file mode 100644
index 000000000..cab8d1db7
--- /dev/null
+++ b/testsuite/ln/ln-force-creates-soft-links
@@ -0,0 +1,5 @@
1echo file number one > file1
2echo file number two > link1
3busybox ln -f -s file1 link1
4test -L link1
5test xfile1 = x`readlink link1`
diff --git a/testsuite/ln/ln-preserves-hard-links b/testsuite/ln/ln-preserves-hard-links
new file mode 100644
index 000000000..47fb98961
--- /dev/null
+++ b/testsuite/ln/ln-preserves-hard-links
@@ -0,0 +1,8 @@
1echo file number one > file1
2echo file number two > link1
3set +e
4busybox ln file1 link1
5if [ $? != 0 ] ; then
6 exit 0;
7fi
8exit 1;
diff --git a/testsuite/ln/ln-preserves-soft-links b/testsuite/ln/ln-preserves-soft-links
new file mode 100644
index 000000000..a8123ece3
--- /dev/null
+++ b/testsuite/ln/ln-preserves-soft-links
@@ -0,0 +1,9 @@
1echo file number one > file1
2echo file number two > link1
3set +e
4busybox ln -s file1 link1
5if [ $? != 0 ] ; then
6 exit 0;
7fi
8exit 1;
9
diff --git a/testsuite/ls/ls-1-works b/testsuite/ls/ls-1-works
new file mode 100644
index 000000000..8651ecd72
--- /dev/null
+++ b/testsuite/ls/ls-1-works
@@ -0,0 +1,3 @@
1ls -1 .. > logfile.gnu
2busybox ls -1 .. > logfile.bb
3cmp logfile.gnu logfile.bb
diff --git a/testsuite/ls/ls-h-works b/testsuite/ls/ls-h-works
new file mode 100644
index 000000000..f54a7be0b
--- /dev/null
+++ b/testsuite/ls/ls-h-works
@@ -0,0 +1,3 @@
1ls -h .. > logfile.gnu
2busybox ls -h .. > logfile.bb
3cmp logfile.gnu logfile.bb
diff --git a/testsuite/ls/ls-l-works b/testsuite/ls/ls-l-works
new file mode 100644
index 000000000..50e44597e
--- /dev/null
+++ b/testsuite/ls/ls-l-works
@@ -0,0 +1,3 @@
1ls -l .. > logfile.gnu
2busybox ls -l .. > logfile.bb
3cmp logfile.gnu logfile.bb
diff --git a/testsuite/ls/ls-s-works b/testsuite/ls/ls-s-works
new file mode 100644
index 000000000..98a612d06
--- /dev/null
+++ b/testsuite/ls/ls-s-works
@@ -0,0 +1,3 @@
1ls -1s .. > logfile.gnu
2busybox ls -1s .. > logfile.bb
3cmp logfile.gnu logfile.bb
diff --git a/testsuite/mv/mv-files-to-dir b/testsuite/mv/mv-files-to-dir
new file mode 100644
index 000000000..c8eaba88e
--- /dev/null
+++ b/testsuite/mv/mv-files-to-dir
@@ -0,0 +1,16 @@
1echo file number one > file1
2echo file number two > file2
3ln -s file2 link1
4mkdir dir1
5touch --date='Sat Jan 29 21:24:08 PST 2000' dir1/file3
6mkdir there
7busybox mv file1 file2 link1 dir1 there
8test -f there/file1
9test -f there/file2
10test -f there/dir1/file3
11test -L there/link1
12test xfile2 = x`readlink there/link1`
13test ! -e file1
14test ! -e file2
15test ! -e link1
16test ! -e dir1/file3
diff --git a/testsuite/mv/mv-follows-links b/testsuite/mv/mv-follows-links
new file mode 100644
index 000000000..1fb355b81
--- /dev/null
+++ b/testsuite/mv/mv-follows-links
@@ -0,0 +1,4 @@
1touch foo
2ln -s foo bar
3busybox mv bar baz
4test -f baz
diff --git a/testsuite/mv/mv-moves-empty-file b/testsuite/mv/mv-moves-empty-file
new file mode 100644
index 000000000..48afca4d5
--- /dev/null
+++ b/testsuite/mv/mv-moves-empty-file
@@ -0,0 +1,4 @@
1touch foo
2busybox mv foo bar
3test ! -e foo
4test -f bar
diff --git a/testsuite/mv/mv-moves-hardlinks b/testsuite/mv/mv-moves-hardlinks
new file mode 100644
index 000000000..eaa8215a4
--- /dev/null
+++ b/testsuite/mv/mv-moves-hardlinks
@@ -0,0 +1,4 @@
1touch foo
2ln foo bar
3busybox mv bar baz
4test ! -f bar -a -f baz
diff --git a/testsuite/mv/mv-moves-large-file b/testsuite/mv/mv-moves-large-file
new file mode 100644
index 000000000..77d088ff1
--- /dev/null
+++ b/testsuite/mv/mv-moves-large-file
@@ -0,0 +1,4 @@
1dd if=/dev/zero of=foo seek=10k count=1 2>/dev/null
2busybox mv foo bar
3test ! -e foo
4test -f bar
diff --git a/testsuite/mv/mv-moves-small-file b/testsuite/mv/mv-moves-small-file
new file mode 100644
index 000000000..065c7f1e9
--- /dev/null
+++ b/testsuite/mv/mv-moves-small-file
@@ -0,0 +1,4 @@
1echo I WANT > foo
2busybox mv foo bar
3test ! -e foo
4test -f bar
diff --git a/testsuite/mv/mv-moves-symlinks b/testsuite/mv/mv-moves-symlinks
new file mode 100644
index 000000000..c413af07c
--- /dev/null
+++ b/testsuite/mv/mv-moves-symlinks
@@ -0,0 +1,6 @@
1touch foo
2ln -s foo bar
3busybox mv bar baz
4test -f foo
5test ! -e bar
6test -L baz
diff --git a/testsuite/mv/mv-moves-unreadable-files b/testsuite/mv/mv-moves-unreadable-files
new file mode 100644
index 000000000..bc9c3133c
--- /dev/null
+++ b/testsuite/mv/mv-moves-unreadable-files
@@ -0,0 +1,5 @@
1touch foo
2chmod a-r foo
3busybox mv foo bar
4test ! -e foo
5test -f bar
diff --git a/testsuite/mv/mv-preserves-hard-links b/testsuite/mv/mv-preserves-hard-links
new file mode 100644
index 000000000..b3ba3aa29
--- /dev/null
+++ b/testsuite/mv/mv-preserves-hard-links
@@ -0,0 +1,6 @@
1# FEATURE: CONFIG_FEATURE_PRESERVE_HARDLINKS
2touch foo
3ln foo bar
4mkdir baz
5busybox mv foo bar baz
6test baz/foo -ef baz/bar
diff --git a/testsuite/mv/mv-preserves-links b/testsuite/mv/mv-preserves-links
new file mode 100644
index 000000000..ea565d2f1
--- /dev/null
+++ b/testsuite/mv/mv-preserves-links
@@ -0,0 +1,5 @@
1touch foo
2ln -s foo bar
3busybox mv bar baz
4test -L baz
5test xfoo = x`readlink baz`
diff --git a/testsuite/mv/mv-refuses-mv-dir-to-subdir b/testsuite/mv/mv-refuses-mv-dir-to-subdir
new file mode 100644
index 000000000..7c572c4f8
--- /dev/null
+++ b/testsuite/mv/mv-refuses-mv-dir-to-subdir
@@ -0,0 +1,23 @@
1echo file number one > file1
2echo file number two > file2
3ln -s file2 link1
4mkdir dir1
5touch --date='Sat Jan 29 21:24:08 PST 2000' dir1/file3
6mkdir there
7busybox mv file1 file2 link1 dir1 there
8test -f there/file1
9test -f there/file2
10test -f there/dir1/file3
11test -L there/link1
12test xfile2 = x`readlink there/link1`
13test ! -e file1
14test ! -e file2
15test ! -e link1
16test ! -e dir1/file3
17set +e
18busybox mv there there/dir1
19if [ $? != 0 ] ; then
20 exit 0;
21fi
22
23exit 1;
diff --git a/testsuite/mv/mv-removes-source-file b/testsuite/mv/mv-removes-source-file
new file mode 100644
index 000000000..48afca4d5
--- /dev/null
+++ b/testsuite/mv/mv-removes-source-file
@@ -0,0 +1,4 @@
1touch foo
2busybox mv foo bar
3test ! -e foo
4test -f bar
diff --git a/testsuite/pwd/pwd-prints-working-directory b/testsuite/pwd/pwd-prints-working-directory
index 7bea10741..8575347d6 100644
--- a/testsuite/pwd/pwd-prints-working-directory
+++ b/testsuite/pwd/pwd-prints-working-directory
@@ -1 +1 @@
test `pwd` = `busybox pwd` test $(pwd) = $(busybox pwd)
diff --git a/testsuite/runtest b/testsuite/runtest
index f57f464ee..89aba3985 100755
--- a/testsuite/runtest
+++ b/testsuite/runtest
@@ -2,37 +2,19 @@
2 2
3PATH=$(dirname $(pwd)):$PATH 3PATH=$(dirname $(pwd)):$PATH
4 4
5show_result ()
6{
7 local resolution=$1
8 local testcase=$2
9 local status=0
10
11 if [ $resolution = XPASS -o $resolution = FAIL ]; then
12 status=1
13 fi
14
15 if [ "$verbose" -o $status -eq 1 ]; then
16 echo "$resolution: $testcase"
17 fi
18
19 return $status
20}
21
22run_applet_testcase () 5run_applet_testcase ()
23{ 6{
24 local applet=$1 7 local applet=$1
25 local testcase=$2 8 local testcase=$2
26 9
27 local status=0 10 local status=0
28 local X=
29 local RES= 11 local RES=
30 12
31 local uc_applet=$(echo $applet | tr a-z A-Z) 13 local uc_applet=$(echo $applet | tr a-z A-Z)
32 local testname=$(basename $testcase) 14 local testname=$(basename $testcase)
33 15
34 if grep -q "^# CONFIG_${uc_applet} is not set$" ../.config; then 16 if grep -q "^# CONFIG_${uc_applet} is not set$" ../.config; then
35 show_result UNTESTED $testname 17 echo UNTESTED: $testname
36 return 0 18 return 0
37 fi 19 fi
38 20
@@ -40,15 +22,11 @@ run_applet_testcase ()
40 local feature=`sed -ne 's/^# FEATURE: //p' $testcase` 22 local feature=`sed -ne 's/^# FEATURE: //p' $testcase`
41 23
42 if grep -q "^# ${feature} is not set$" ../.config; then 24 if grep -q "^# ${feature} is not set$" ../.config; then
43 show_result UNTESTED $testname 25 echo UNTESTED: $testname
44 return 0 26 return 0
45 fi 27 fi
46 fi 28 fi
47 29
48 if grep -q "^# XFAIL$" $testcase; then
49 X=X
50 fi
51
52 rm -rf tmp 30 rm -rf tmp
53 mkdir -p tmp 31 mkdir -p tmp
54 pushd tmp >/dev/null 32 pushd tmp >/dev/null
@@ -56,14 +34,14 @@ run_applet_testcase ()
56 sh -x -e ../$testcase >.logfile.txt 2>&1 34 sh -x -e ../$testcase >.logfile.txt 2>&1
57 35
58 if [ $? != 0 ] ; then 36 if [ $? != 0 ] ; then
59 show_result ${X}FAIL $testname 37 echo FAIL: $testname
60 if [ "$verbose" == 1 ]; then 38 if [ "$verbose" = 1 ]; then
61 cat .logfile.txt 39 cat .logfile.txt
62 exit 1; 40 #exit 1;
63 fi; 41 fi;
64 status=$? 42 status=$?
65 else 43 else
66 show_result ${X}PASS $testname 44 echo PASS: $testname
67 rm -f .logfile.txt 45 rm -f .logfile.txt
68 status=$? 46 status=$?
69 fi 47 fi
diff --git a/testsuite/sed/sed-append-next-line b/testsuite/sed/sed-append-next-line
index e7f72f476..0621a319f 100644
--- a/testsuite/sed/sed-append-next-line
+++ b/testsuite/sed/sed-append-next-line
@@ -1,10 +1,11 @@
1# XFAIL
2# This will fail if CONFIG_FEATURE_SED_GNU_COMPATABILITY is defined 1# This will fail if CONFIG_FEATURE_SED_GNU_COMPATABILITY is defined
3busybox sed 'N;p'>output <<EOF 2busybox sed 'N;p'>output <<EOF
4a 3a
5b 4b
6c 5c
7EOF 6EOF
7
8set +e
8cmp -s output - <<EOF 9cmp -s output - <<EOF
9a 10a
10b 11b
@@ -12,3 +13,7 @@ a
12b 13b
13c 14c
14EOF 15EOF
16if [ $? != 0 ] ; then
17 exit 0;
18fi
19exit 1;
diff --git a/testsuite/sort/sort-n-works b/testsuite/sort/sort-n-works
new file mode 100644
index 000000000..c9b63a36a
--- /dev/null
+++ b/testsuite/sort/sort-n-works
@@ -0,0 +1,3 @@
1sort -n ../README > logfile.gnu
2busybox sort -n ../README > logfile.bb
3cmp logfile.gnu logfile.bb
diff --git a/testsuite/sort/sort-r-works b/testsuite/sort/sort-r-works
new file mode 100644
index 000000000..6422ba940
--- /dev/null
+++ b/testsuite/sort/sort-r-works
@@ -0,0 +1,3 @@
1sort -r ../README > logfile.gnu
2busybox sort -r ../README > logfile.bb
3cmp logfile.gnu logfile.bb
diff --git a/testsuite/sort/sort-works b/testsuite/sort/sort-works
new file mode 100644
index 000000000..0110aa010
--- /dev/null
+++ b/testsuite/sort/sort-works
@@ -0,0 +1,3 @@
1sort ../README > logfile.gnu
2busybox sort ../README > logfile.bb
3cmp logfile.gnu logfile.bb
diff --git a/testsuite/strings/strings-works-like-GNU b/testsuite/strings/strings-works-like-GNU
index 02e423134..2d6471033 100644
--- a/testsuite/strings/strings-works-like-GNU
+++ b/testsuite/strings/strings-works-like-GNU
@@ -1,8 +1,9 @@
1rm -f foo bar 1rm -f foo bar
2strings -af ../../busybox > foo 2strings -af ../../busybox > foo
3busybox strings -af ../../busybox > bar 3busybox strings -af ../../busybox > bar
4set +e
4test ! -f foo -a -f bar 5test ! -f foo -a -f bar
5if [ $? = 0 ] ; then 6if [ $? = 0 ] ; then
6 diff -q foo bar 7 set -e
7fi; 8 diff -q foo bar
8 9fi
diff --git a/testsuite/tail/tail-n-works b/testsuite/tail/tail-n-works
new file mode 100644
index 000000000..321db7f8a
--- /dev/null
+++ b/testsuite/tail/tail-n-works
@@ -0,0 +1,3 @@
1tail -n 2 ../README > logfile.gnu
2busybox tail -n 2 ../README > logfile.bb
3cmp logfile.gnu logfile.bb
diff --git a/testsuite/tail/tail-works b/testsuite/tail/tail-works
new file mode 100644
index 000000000..321db7f8a
--- /dev/null
+++ b/testsuite/tail/tail-works
@@ -0,0 +1,3 @@
1tail -n 2 ../README > logfile.gnu
2busybox tail -n 2 ../README > logfile.bb
3cmp logfile.gnu logfile.bb
diff --git a/testsuite/tar/tar-extracts-multiple-files b/testsuite/tar/tar-extracts-multiple-files
index e26901e8c..46701dc3f 100644
--- a/testsuite/tar/tar-extracts-multiple-files
+++ b/testsuite/tar/tar-extracts-multiple-files
@@ -1,5 +1,6 @@
1touch foo bar 1touch foo bar
2tar cf foo.tar foo bar 2tar cf foo.tar foo bar
3rm foo bar 3rm foo bar
4busybox tar xf foo.tar 4busybox tar -xf foo.tar
5test -f foo -a -f bar 5test -f foo -a -f bar
6exit 99;
diff --git a/testsuite/tr/tr-d-works b/testsuite/tr/tr-d-works
new file mode 100644
index 000000000..d939e8b0f
--- /dev/null
+++ b/testsuite/tr/tr-d-works
@@ -0,0 +1,4 @@
1echo testing | tr -d aeiou > logfile.gnu
2echo testing | busybox tr -d aeiou > logfile.bb
3
4cmp logfile.gnu logfile.bb
diff --git a/testsuite/tr/tr-non-gnu b/testsuite/tr/tr-non-gnu
new file mode 100644
index 000000000..ffa6951ae
--- /dev/null
+++ b/testsuite/tr/tr-non-gnu
@@ -0,0 +1 @@
echo fdhrnzvfu bffvsentr | busybox tr '[a-z]' '[n-z][a-m]'
diff --git a/testsuite/tr/tr-works b/testsuite/tr/tr-works
new file mode 100644
index 000000000..8753a3f28
--- /dev/null
+++ b/testsuite/tr/tr-works
@@ -0,0 +1,9 @@
1echo "cbaab" | tr abc zyx > logfile.gnu
2echo "TESTING A B C" | tr [A-Z] [a-z] >> logfile.gnu
3echo abc[] | tr a[b AXB >> logfile.gnu
4
5echo "cbaab" | busybox tr abc zyx > logfile.bb
6echo "TESTING A B C" | busybox tr [A-Z] [a-z] >> logfile.bb
7echo abc[] | busybox tr a[b AXB >> logfile.bb
8
9cmp logfile.gnu logfile.bb
diff --git a/testsuite/uptime/uptime-works b/testsuite/uptime/uptime-works
new file mode 100644
index 000000000..80e578778
--- /dev/null
+++ b/testsuite/uptime/uptime-works
@@ -0,0 +1,2 @@
1busybox uptime
2
diff --git a/testsuite/uuencode/uuencode-sets-standard-input-mode-correctly b/testsuite/uuencode/uuencode-sets-standard-input-mode-correctly
index 0ccf23b59..1a48a6656 100644
--- a/testsuite/uuencode/uuencode-sets-standard-input-mode-correctly
+++ b/testsuite/uuencode/uuencode-sets-standard-input-mode-correctly
@@ -1,6 +1,4 @@
1saved_umask=$(umask) 1saved_umask=$(umask)
2umask 0 2umask 0
3busybox uuencode foo </dev/null | head -n 1 | grep -q 666 3busybox uuencode foo </dev/null | head -n 1 | grep -q 666
4status=$?
5umask $saved_umask 4umask $saved_umask
6return $status
diff --git a/testsuite/which/which-uses-default-path b/testsuite/which/which-uses-default-path
index f612aeb54..63ceb9f8f 100644
--- a/testsuite/which/which-uses-default-path
+++ b/testsuite/which/which-uses-default-path
@@ -2,6 +2,3 @@ BUSYBOX=$(type -p busybox)
2SAVED_PATH=$PATH 2SAVED_PATH=$PATH
3unset PATH 3unset PATH
4$BUSYBOX which ls 4$BUSYBOX which ls
5STATUS=$?
6export PATH=$SAVED_PATH
7return $STATUS
diff --git a/testsuite/xargs/xargs-works b/testsuite/xargs/xargs-works
new file mode 100644
index 000000000..4ad581804
--- /dev/null
+++ b/testsuite/xargs/xargs-works
@@ -0,0 +1,3 @@
1find -name \*works -type f | xargs md5sum > logfile.gnu
2find -name \*works -type f | busybox xargs md5sum > logfile.bb
3diff -u logfile.gnu logfile.bb