aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2004-04-06 11:10:30 +0000
committerEric Andersen <andersen@codepoet.org>2004-04-06 11:10:30 +0000
commit650fe63467e693990cf357c51b74db3278088a56 (patch)
tree660b1fb0e4d7f99802a85cdd00166fafbf3132dc /tests
parent39396b95fc7c46bfa29ec576357fb7f8e755762c (diff)
downloadbusybox-w32-650fe63467e693990cf357c51b74db3278088a56.tar.gz
busybox-w32-650fe63467e693990cf357c51b74db3278088a56.tar.bz2
busybox-w32-650fe63467e693990cf357c51b74db3278088a56.zip
Kill off the old 'tests' stuff. Write a ton of new tests for the
'testsuite' dir. Fix a bunch of broken tests. Fix the testsuite 'runtest' script so it actually reports all failures and provides meaningful feedback. -Erik
Diffstat (limited to 'tests')
-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
12 files changed, 0 insertions, 1520 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