diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/.cvsignore | 16 | ||||
-rw-r--r-- | tests/Makefile | 36 | ||||
-rw-r--r-- | tests/cp_tests.mk | 360 | ||||
-rw-r--r-- | tests/ln_tests.mk | 71 | ||||
-rwxr-xr-x | tests/multibuild.pl | 73 | ||||
-rwxr-xr-x | tests/multifeat.pl | 83 | ||||
-rw-r--r-- | tests/mv_tests.mk | 167 | ||||
-rw-r--r-- | tests/sh.testcases | 89 | ||||
-rw-r--r-- | tests/syslog_test.c | 19 | ||||
-rw-r--r-- | tests/testcases | 404 | ||||
-rwxr-xr-x | tests/tester.sh | 158 | ||||
-rw-r--r-- | tests/tst-syslogd.c | 44 |
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 @@ -cp -cp_*.bb -cp_*.gnu -cp_tests -date -df -du -ln -ln_*.bb -ln_*.gnu -ln_tests -mv -mv_*.bb -mv_*.gnu -mv_tests -syslog_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 @@ -# busybox/tests/Makefile - Run through all defined tests. -# ------------------------ -# Copyright (C) 2000 Karl M. Hegbloom <karlheg@debian.org> GPL - -all:: message_header - -message_header: - @echo - @echo BusyBox Test Suite. - @echo - (cd ..; tests/busybox.REGRESS.sh) - -clean:: - rm -f *.o - rm -f tester.log - -distclean: clean - -.PHONY: all clean distclean message_header - -include $(wildcard *_tests.mk) - -BBL := $(shell pushd .. >/dev/null && \ - ${MAKE} busybox.links >/dev/null && \ - popd >/dev/null && \ - cat ../busybox.links | \ - sed -e 's,.*/\(.*\)$$,\1,') - -../busybox: - cd .. && ${MAKE} busybox - -${BBL}: ../busybox - rm -f $@ - ln ../busybox $@ - -syslog_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 @@ -# cp_tests.mk - Set of test cases for busybox cp -# ------------- -# Copyright (C) 2000 Karl M. Hegbloom <karlheg@debian.org> GPL -# - -# GNU `cp' -GCP = /bin/cp -# BusyBox `cp' -BCP = $(shell pwd)/cp - -all:: cp_tests -clean:: cp_clean - -cp_clean: - - rm -rf cp_tests cp_*.{gnu,bb} cp - -# check_cp_dir_to_dir_wo_a removed from this list; see below -cp_tests: cp_clean cp check_exists check_simple_cp check_cp_symlnk \ - check_cp_symlink_w_a check_cp_files_to_dir check_cp_files_to_dir_w_d \ - check_cp_files_to_dir_w_p check_cp_files_to_dir_w_p_and_d \ - check_cp_dir_to_dir_w_a \ - check_cp_dir_to_dir_w_a_take_two - -check_exists: - @echo; - @echo "No output from diff means busybox cp is functioning properly."; - @echo "Some tests might show timestamp differences that are Ok."; - - @echo; - @echo Verify that busybox cp exists; - @echo ------------------------------; - [ -x ${BCP} ] || exit 0 - - @echo; - mkdir cp_tests; - -check_simple_cp: - @echo Copy a file to a copy of the file; - @echo ------------------------------; - cd cp_tests; \ - echo A file > afile; \ - ls -l afile > ../cp_afile_afilecopy.gnu; \ - ${GCP} afile afilecopy; \ - ls -l afile afilecopy >> ../cp_afile_afilecopy.gnu; - - @echo; - rm -rf cp_tests/*; - - @echo; - cd cp_tests; \ - echo A file > afile; \ - ls -l afile > ../cp_afile_afilecopy.bb; \ - ${BCP} afile afilecopy; \ - ls -l afile afilecopy >> ../cp_afile_afilecopy.bb; - - @echo; - @echo Might show timestamp differences. - -diff -u cp_afile_afilecopy.gnu cp_afile_afilecopy.bb; - - @echo; - rm -rf cp_tests/*; - -check_cp_symlnk: - @echo; echo Copy a file pointed to by a symlink; - @echo ------------------------------; - cd cp_tests; \ - mkdir here there; \ - echo A file > afile; \ - cd here; \ - ln -s ../afile .; \ - - @echo; - cd cp_tests; \ - ls -lR . > ../cp_symlink.gnu; \ - ${GCP} here/afile there; \ - ls -lR . >> ../cp_symlink.gnu; - - @echo; - rm -rf cp_tests/there/*; - - sleep 1; - - @echo; - cd cp_tests; \ - ls -lR . > ../cp_symlink.bb; \ - ${BCP} here/afile there; \ - ls -lR . >> ../cp_symlink.bb; - - @echo; - @echo Will show timestamp difference. - -diff -u cp_symlink.gnu cp_symlink.bb; - - @echo; - rm -rf cp_tests/* - -check_cp_symlink_w_a: - @echo; echo Copy a symlink, useing the -a switch.; - @echo ------------------------------; - cd cp_tests; \ - echo A file > afile; \ - mkdir here there; \ - cd here; \ - ln -s ../afile . - - cd cp_tests; \ - ls -lR . > ../cp_a_symlink.gnu; \ - ${GCP} -a here/afile there; \ - ls -lR . >> ../cp_a_symlink.gnu; - - @echo; - rm -rf cp_tests/there/*; - - sleep 1; - - @echo; - cd cp_tests; \ - echo A file > afile; \ - ls -lR . > ../cp_a_symlink.bb; \ - ${BCP} -a here/afile there; \ - ls -lR . >> ../cp_a_symlink.bb; - - @echo; - diff -u cp_a_symlink.gnu cp_a_symlink.bb; - - @echo; - rm -rf cp_tests/*; - - -check_cp_files_to_dir: - # Copy a set of files to a directory. - @echo; echo Copy a set of files to a directory.; - @echo ------------------------------; - cd cp_tests; \ - echo A file number one > afile1; \ - echo A file number two, blah. > afile2; \ - ln -s afile1 symlink1; \ - mkdir there; - - cd cp_tests; \ - ${GCP} afile1 afile2 symlink1 there/; \ - ls -lR > ../cp_files_dir.gnu; - - @echo; - rm -rf cp_tests/there/*; - - @echo; - cd cp_tests; \ - ${BCP} afile1 afile2 symlink1 there/; \ - ls -lR > ../cp_files_dir.bb; - - @echo; - diff -u cp_files_dir.gnu cp_files_dir.bb; - - @echo; - rm -rf cp_tests/*; - -check_cp_files_to_dir_w_d: - # Copy a set of files to a directory with the -d switch. - @echo; echo Copy a set of files to a directory with the -d switch.; - @echo ------------------------------; - cd cp_tests; \ - echo A file number one > afile1; \ - echo A file number two, blah. > afile2; \ - ln -s afile1 symlink1; \ - mkdir there1; \ - ${GCP} -d afile1 afile2 symlink1 there1/; \ - ls -lR > ../cp_d_files_dir.gnu; - - @echo; - rm -rf cp_tests/{afile{1,2},symlink1,there1}; - - @echo; - cd cp_tests; \ - echo A file number one > afile1; \ - echo A file number two, blah. > afile2; \ - ln -s afile1 symlink1; \ - mkdir there1; \ - ${BCP} -d afile1 afile2 symlink1 there1/; \ - ls -lR > ../cp_d_files_dir.bb; - - @echo; - diff -u cp_d_files_dir.gnu cp_d_files_dir.bb; - - @echo; - rm -rf cp_tests/{afile{1,2},symlink1,there1}; - -check_cp_files_to_dir_w_p: - # Copy a set of files to a directory with the -p switch. - @echo; echo Copy a set of files to a directory with the -p switch.; - @echo ------------------------------; - cd cp_tests; \ - echo A file number one > afile1; \ - echo A file number two, blah. > afile2; \ - touch --date='Sat Jan 29 21:24:08 PST 2000' afile1; \ - ln -s afile1 symlink1; \ - mkdir there1; \ - ${GCP} -p afile1 afile2 symlink1 there1/; \ - ls -lR > ../cp_p_files_dir.gnu; - - @echo; - rm -rf cp_tests/{afile{1,2},symlink1,there1}; - - @echo; - cd cp_tests; \ - echo A file number one > afile1; \ - echo A file number two, blah. > afile2; \ - touch --date='Sat Jan 29 21:24:08 PST 2000' afile1; \ - ln -s afile1 symlink1; \ - mkdir there1; \ - ${BCP} -p afile1 afile2 symlink1 there1/; \ - ls -lR > ../cp_p_files_dir.bb; - - @echo; - diff -u cp_p_files_dir.gnu cp_p_files_dir.bb; - - @echo; - rm -rf cp_tests/{afile{1,2},symlink1,there1}; - - -check_cp_files_to_dir_w_p_and_d: - @echo; echo Copy a set of files to a directory with -p and -d switches. - @echo ------------------------------; - cd cp_tests; \ - echo A file number one > afile1; \ - echo A file number two, blah. > afile2; \ - touch --date='Sat Jan 29 21:24:08 PST 2000' afile1; \ - ln -s afile1 symlink1; \ - mkdir there1; \ - ${GCP} -p -d afile1 afile2 symlink1 there1/; \ - ls -lR > ../cp_pd_files_dir.gnu; - - @echo; - rm -rf cp_tests/{afile{1,2},symlink1,there1}; - - @echo; - cd cp_tests; \ - echo A file number one > afile1; \ - echo A file number two, blah. > afile2; \ - touch --date='Sat Jan 29 21:24:08 PST 2000' afile1; \ - ln -s afile1 symlink1; \ - mkdir there1; \ - ${BCP} -p -d afile1 afile2 symlink1 there1/; \ - ls -lR > ../cp_pd_files_dir.bb; - - @echo; - diff -u cp_pd_files_dir.gnu cp_pd_files_dir.bb; - - @echo; - rm -rf cp_tests/{afile{1,2},symlink1,there1}; - -# This test doesn't work any more; gnu cp now _does_ copy a directory -# to a subdirectory of itself. What's worse, that "feature" has no -# (documented) way to be disabled with command line switches. -# It's not obvious that busybox cp should mimic this behavior. -# For now, this test is removed from the cp_tests list, above. -check_cp_dir_to_dir_wo_a: - # Copy a directory to another directory, without the -a switch. - @echo; echo Copy a directory to another directory, without the -a switch. - @echo ------------------------------; - @echo There should be an error message about cannot cp a dir to a subdir of itself. - cd cp_tests; \ - touch a b c; \ - mkdir adir; \ - ls -lR . > ../cp_a_star_adir.gnu; \ - ${GCP} -a * adir; \ - ls -lR . >> ../cp_a_star_adir.gnu; - - @echo - @echo There should be an error message about cannot cp a dir to a subdir of itself. - cd cp_tests; \ - rm -rf adir; \ - mkdir adir; \ - ls -lR . > ../cp_a_star_adir.bb; \ - ${BCP} -a * adir; \ - ls -lR . >> ../cp_a_star_adir.bb; - - @echo; - diff -u cp_a_star_adir.gnu cp_a_star_adir.bb; - - # Done - @echo; - rm -rf cp_tests; - @echo; echo Done. - - -check_cp_dir_to_dir_w_a: - @echo; echo Copy a directory into another directory with the -a switch. - @echo ------------------------------; - cd cp_tests; \ - mkdir dir{a,b}; \ - echo A file > dira/afile; \ - echo A file in dirb > dirb/afileindirb; \ - ln -s dira/afile dira/alinktoafile; \ - mkdir dira/subdir1; \ - echo Another file > dira/subdir1/anotherfile; \ - ls -lR . > ../cp_a_dira_dirb.gnu; \ - ${GCP} -a dira dirb; \ - ls -lR . >> ../cp_a_dira_dirb.gnu; - - @echo; - rm -rf cp_tests/dir{a,b}; - - @echo; - cd cp_tests; \ - mkdir dir{a,b}; \ - echo A file > dira/afile; \ - echo A file in dirb > dirb/afileindirb; \ - ln -s dira/afile dira/alinktoafile; \ - mkdir dira/subdir1; \ - echo Another file > dira/subdir1/anotherfile; \ - ls -lR . > ../cp_a_dira_dirb.bb; \ - ${BCP} -a dira dirb; \ - ls -lR . >> ../cp_a_dira_dirb.bb; - - @echo; - diff -u cp_a_dira_dirb.gnu cp_a_dira_dirb.bb; - - @echo; - rm -rf cp_tests/dir{a,b}; - - -check_cp_dir_to_dir_w_a_take_two: - @echo; echo Copy a directory into another directory with the -a switch; - @echo ------------------------------; - mkdir -p cp_tests/gnu; \ - mkdir -p cp_tests/bb; \ - cd cp_tests; \ - mkdir here there; \ - echo A file > here/afile; \ - mkdir here/adir; \ - touch here/adir/afileinadir; \ - ln -s $$(pwd) here/alink; - - @echo; - cd cp_tests/gnu; \ - ls -lR . > ../../cp_a_dir_dir.gnu; \ - ${GCP} -a here/ there/; \ - ls -lR . >> ../../cp_a_dir_dir.gnu; - - @echo; - rm -rf cp_tests/there/*; - - sleep 1; - - @echo; - cd cp_tests/bb; \ - ls -lR . > ../../cp_a_dir_dir.bb; \ - ${BCP} -a here/ there/; \ - ls -lR . >> ../../cp_a_dir_dir.bb; - - @echo; - echo "Erik 1" - diff -u cp_a_dir_dir.gnu cp_a_dir_dir.bb; - echo "Erik 2" - - @echo; - echo "Erik 3" - rm -rf cp_tests/*; - - 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 @@ -# ln_tests.mk - Set of tests for busybox ln -# ------------- -# Copyright (C) 2000 Karl M. Hegbloom <karlheg@debian.org> GPL -# - -# GNU `ln' -GLN = /bin/ln -# BusyBox `ln' -BLN = $(shell pwd)/ln - -all:: ln_tests -clean:: ln_clean - -ln_clean: - rm -rf ln_tests ln_*.{gnu,bb} ln - -ln_tests: ln_clean ln - @echo; - @echo "No output from diff means busybox ln is functioning properly."; - - @echo; - ${BLN} || true; - - @echo; - mkdir ln_tests; - - @echo; - cd ln_tests; \ - echo A file > afile; \ - ls -l afile > ../ln_afile_newname.gnu; \ - ${GLN} afile newname; \ - ls -l afile newname >> ../ln_afile_newname.gnu; - - @echo; - rm -f ln_tests/{afile,newname}; - - @echo; - cd ln_tests; \ - echo A file > afile; \ - ls -l afile > ../ln_afile_newname.bb; \ - ${BLN} afile newname; \ - ls -l afile newname >> ../ln_afile_newname.bb; - - @echo; - diff -u ln_afile_newname.gnu ln_afile_newname.bb - - @echo; - rm -f ln_tests/{afile,newname}; - - @echo; - cd ln_tests; \ - echo A file > afile; \ - ls -l afile > ../ln_s_afile_newname.gnu; \ - ${GLN} -s afile newname; \ - ls -l afile newname >> ../ln_s_afile_newname.gnu; - - @echo; - rm -f ln_tests/{afile,newname}; - - @echo; - cd ln_tests; \ - echo A file > afile; \ - ls -l afile > ../ln_s_afile_newname.bb; \ - ${BLN} -s afile newname; \ - ls -l afile newname >> ../ln_s_afile_newname.bb; - - @echo; - diff -u ln_s_afile_newname.gnu ln_s_afile_newname.bb - - @echo; - 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 @@ -#!/usr/bin/perl - -# multibuild.pl -# Tests BusyBox-0.48 (at least) to see if each applet builds -# properly on its own. The most likely problems this will -# flush out are those involving preprocessor instructions in -# utility.c. -# -# TODO: some time it might be nice to list absolute and -# differential object sizes for each option... -# - -$logfile = "multibuild.log"; - -# How to handle all the CONFIG_FEATURE_FOO lines -if ($ARGV[0] eq "-all" ) { shift(@ARGV); $choice="all"; } -if ($ARGV[0] eq "-none") { shift(@ARGV); $choice="none"; } -# neither means, leave that part of Config.h alone - -# Support building from pristine source -$make_opt = "-f $ARGV[0]/Makefile CONFIG_SRC_DIR=$ARGV[0]" if ($ARGV[0] ne ""); - -# Move the config file to a safe place --e "Config.h.orig" || 0==system("mv -f Config.h Config.h.orig") || die; - -# Clear previous log file, if any -unlink($logfile); - -# Parse the config file -open(C,"<Config.h.orig") || die; -while (<C>) { - if ($in_trailer) { - if (!$in_olympus) { - s/^\/\/#/#/ if ($choice eq "all" && !/USE_DEVPS_PATCH/); - s/^#/\/\/#/ if ($choice eq "none"); - } - $in_olympus=1 if /End of Features List/; - $trailer .= $_; - } else { - $in_trailer=1 if /End of Applications List/; - if (/^\/*#define CONFIG_([A-Z0-9_]*)/) { - push @apps, $1; - } - } -} -close C; - -# Do the real work ... -$failed_tests=0; -for $a (@apps) { - # print "Testing build of applet $a ...\n"; - open (O, ">Config.h") || die; - print O "#define CONFIG_$a\n", $trailer; - close O; - system("echo -e '\n***\n$a\n***' >>$logfile"); - # With a fast computer and 1-second resolution on file timestamps, this - # process pushes beyond the limits of what unix make can understand. - # That's why need to weed out obsolete files before restarting make. - $result{$a} = system("rm -f *.o applet_source_list; make $make_opt busybox >>$logfile 2>&1"); - $flag = $result{$a} ? "FAILED!!!" : "ok"; - printf("Applet %-20s: %s\n", $a, $flag); - $total_tests++; - $failed_tests++ if $flag eq "FAILED!!!"; - # pause long enough to let user stop us with a ^C - select(undef, undef, undef, 0.03); -} - -# Clean up our mess -system("mv -f Config.h.orig Config.h"); - -print "$total_tests applets tested, $failed_tests failures\n"; -print "See $logfile for details.\n"; - 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 @@ -#!/usr/bin/perl -# -# multifeat.pl -# -# Turns on all applets, then tests turning on one feature at a time through -# iterative compilations. Tests if any features depend on each other in any -# weird ways or such-like problems. -# -# Hacked by Mark Whitley, but based *heavily* on multibuild.pl which was -# written by Larry Doolittle. - -$logfile = "multifeat.log"; - -# How to handle all the CONFIG_APPLET lines -# (most thorough testing occurs when you call it with the -all switch) -if ($ARGV[0] eq "-all" ) { shift(@ARGV); $choice="all"; } -if ($ARGV[0] eq "-none") { shift(@ARGV); $choice="none"; } -# neither means, leave that part of Config.h alone - -# Support building from pristine source -$make_opt = "-f $ARGV[0]/Makefile CONFIG_SRC_DIR=$ARGV[0]" if ($ARGV[0] ne ""); - -# Move the config file to a safe place --e "Config.h.orig" || 0==system("mv -f Config.h Config.h.orig") || die; - -# Clear previous log file, if any -unlink($logfile); - -# Parse the config file -open(C,"<Config.h.orig") || die; -$in_applist=1; -$in_features=0; -$in_olympus=0; -while (<C>) { - if ($in_applist) { - s/^\/\/#/#/ if ($choice eq "all"); - s/^#/\/\/#/ if ($choice eq "none"); - $header .= $_; - if (/End of Applications List/) { - $in_applist=0; - $in_features=1 - } - } - elsif ($in_features) { - if (/^\/*#define CONFIG_FEATURE_([A-Z0-9_]*)/) { - push @features, $1; - } - if (/End of Features List/) { - $in_features=0; - $in_olympus=1 - } - } elsif ($in_olympus) { - $trailer .= $_; - } -} -close C; - -# Do the real work ... -$failed_tests=0; -for $f (@features) { - # print "Testing build with feature $f ...\n"; - open (O, ">Config.h") || die; - print O $header, "#define CONFIG_FEATURE_$f\n", $trailer; - close O; - system("echo -e '\n***\n$f\n***' >>$logfile"); - # With a fast computer and 1-second resolution on file timestamps, this - # process pushes beyond the limits of what unix make can understand. - # That's why need to weed out obsolete files before restarting make. - $result{$f} = system("rm -f *.o applet_source_list; make $make_opt busybox >>$logfile 2>&1"); - $flag = $result{$f} ? "FAILED!!!" : "ok"; - printf("Feature %-20s: %s\n", $f, $flag); - $total_tests++; - $failed_tests++ if $flag eq "FAILED!!!"; - # pause long enough to let user stop us with a ^C - select(undef, undef, undef, 0.03); -} - -# Clean up our mess -system("mv -f Config.h.orig Config.h"); - -print "$total_tests applets tested, $failed_tests failures\n"; -print "See $logfile for details.\n"; - 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 @@ -# mv_tests.mk - Set of tests cases for busybox mv -# ------------- -# Copyright (C) 2000 Karl M. Hegbloom <karlheg@debian.org> GPL -# - -# GNU `mv' -GMV = /bin/mv -# BusyBox `mv' -BMV = $(shell pwd)/mv - -all:: mv_tests -clean:: mv_clean - -mv_clean: - rm -rf mv_tests mv_*.{gnu,bb} mv - -mv_tests: mv_clean mv - @echo; - @echo "No output from diff means busybox mv is functioning properly."; - @echo; - @echo "No such file or directory is good; it means the old file got removed."; - @echo; - ${BMV} || true; - - @echo; - mkdir mv_tests; - - @echo; - cd mv_tests; \ - echo A file > afile; \ - ls -l afile > ../mv_afile_newname.gnu; \ - ${GMV} afile newname; \ - ls -l newname >> ../mv_afile_newname.gnu; - -ls -l mv_tests/afile; - - @echo; - rm -f mv_tests/{afile,newname}; - - @echo; - cd mv_tests; \ - echo A file > afile; \ - ls -l afile > ../mv_afile_newname.bb; \ - ${BMV} afile newname; \ - ls -l newname >> ../mv_afile_newname.bb; - -ls -l mv_tests/afile; - - @echo; - diff -u mv_afile_newname.gnu mv_afile_newname.bb; - - @echo; - rm -f mv_tests/{afile,newname}; - - @echo; echo ------------------------------; - cd mv_tests; \ - echo A file > afile; \ - ln -s afile symlink; \ - ls -l afile symlink > ../mv_symlink_newname.gnu; \ - ${GMV} symlink newname; \ - ls -l afile newname >> ../mv_symlink_newname.gnu; - -ls -l mv_tests/symlink; - - @echo; - rm -f mv_tests/{afile,newname}; - - @echo; - cd mv_tests; \ - echo A file > afile; \ - ln -s afile symlink; \ - ls -l afile symlink > ../mv_symlink_newname.bb;\ - ${BMV} symlink newname; \ - ls -l afile newname >> ../mv_symlink_newname.bb; - -ls -l mv_tests/symlink; - - @echo; - diff -u mv_symlink_newname.gnu mv_symlink_newname.bb; - - @echo; - rm -rf mv_tests/*; - - @echo; echo ------------------------------; - cd mv_tests; \ - echo A file > afile; \ - ln -s afile symlink; \ - mkdir newdir; \ - ls -lR > ../mv_file_symlink_dir.gnu; \ - ${GMV} symlink afile newdir; \ - ls -lR >> ../mv_file_symlink_dir.gnu; - -ls -l mv_tests/{symlink,afile}; - - @echo; - rm -rf mv_tests/* - - @echo; echo ------------------------------; - cd mv_tests; \ - echo A file > afile; \ - ln -s afile symlink; \ - mkdir newdir; \ - ls -lR > ../mv_file_symlink_dir.bb; \ - ${BMV} symlink afile newdir; \ - ls -lR >> ../mv_file_symlink_dir.bb; - -ls -l mv_tests/{symlink,afile}; - - @echo; - diff -u mv_file_symlink_dir.gnu mv_file_symlink_dir.bb; - - @echo; - rm -rf mv_tests/*; - - @echo; echo ------------------------------; - cd mv_tests; \ - mkdir dir{a,b}; \ - echo A file > dira/afile; \ - echo A file in dirb > dirb/afileindirb; \ - ln -s dira/afile dira/alinktoafile; \ - mkdir dira/subdir1; \ - echo Another file > dira/subdir1/anotherfile; \ - ls -lR . > ../mv_dira_dirb.gnu; \ - ${GMV} dira dirb; \ - ls -lR . >> ../mv_dira_dirb.gnu; - - # false; - @echo; - rm -rf mv_tests/dir{a,b}; - - @echo; - cd mv_tests; \ - mkdir dir{a,b}; \ - echo A file > dira/afile; \ - echo A file in dirb > dirb/afileindirb; \ - ln -s dira/afile dira/alinktoafile; \ - mkdir dira/subdir1; \ - echo Another file > dira/subdir1/anotherfile; \ - ls -lR . > ../mv_dira_dirb.bb; \ - ${BMV} dira dirb; \ - ls -lR . >> ../mv_dira_dirb.bb; - - @echo; - diff -u mv_dira_dirb.gnu mv_dira_dirb.bb; - - # false; - @echo; - rm -rf mv_tests/dir{a,b}; - - @echo; echo ------------------------------; - @echo There should be an error message about cannot mv a dir to a subdir of itself. - cd mv_tests; \ - mkdir adir; \ - touch -r . a b c adir; \ - ls -lR . > ../mv_a_star_adir.gnu; \ - ${GMV} * adir; \ - ls -lR . >> ../mv_a_star_adir.gnu; - - @echo - @echo There should be an error message about cannot mv a dir to a subdir of itself. - cd mv_tests; \ - rm -rf a b c adir; \ - mkdir adir; \ - touch -r . a b c adir; \ - ls -lR . > ../mv_a_star_adir.bb; \ - ${BMV} * adir; \ - ls -lR . >> ../mv_a_star_adir.bb; - - @echo; - diff -u mv_a_star_adir.gnu mv_a_star_adir.bb; - - @echo; - 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 @@ -# try running this with bash, ksh, ash, and hush. - -# simple quoting rules. -echo a b -echo "a b" -echo a "" b -echo a '' b -echo hello? -echo "hello?" -echo t* hello -echo t\* hello - -# quick and painless exit for lash -if false; then true; exit; fi - -# fairly simple command substitution -echo `echo -e foo\\\necho bar` - -echo THIS IS A TEST >foo -cat $(echo FOO | tr 'A-Z' 'a-z') -cat foo | tr 'A-Z' 'a-z' -cat $(echo FOO | tr 'A-Z' 'a-z') | tr 'A-Z' 'a-z' - -cat foo | if true; then tr 'A-Z' 'a-z'; else echo bar1; fi -cat foo | if false; then tr 'A-Z' 'a-z'; else echo bar2; fi -if true; then tr 'A-Z' 'a-z'; else echo bar3; fi <foo -if false; then tr 'A-Z' 'a-z'; else echo bar4; fi <foo -if true || false; then echo foo; else echo bar5; fi -if true && false; then echo bar6; else echo foo; fi - -# basic distinction between local and env variables -unset FOO -FOO=bar env | grep FOO -echo "but not here: $FOO" -FOO=bar -env | grep FOO -echo "yes, here: $FOO" -FOO= -echo a $FOO b -echo "a $FOO b" - -# not quite so basic variables. Credit to Matt Kraai. -unset FOO -FOO=bar -export FOO -env | grep FOO -unset FOO -export FOO=bar -FOO=baz -env | grep FOO - -# interaction between environment variables and if/then and subshells -FOO=default -if true; then FOO=new; fi -echo $FOO -FOO=default -(FOO=bogus) -echo $FOO - -# make sure we can duplicate file descriptors properly -echo replacement >foo 2>&1 -cat foo -cat doesnt_exist >foo 2>&1 -tr 'a-z' 'A-Z' <foo - -# fairly simple example of hush expanding variables too early -unset TMP -rm -f fish -TMP=fish && >$TMP -ls fish - -# ash, lash, and hush do not create wish; bash and ksh do. -# Thanks to Tapani Tarvainen <tt@mit.jyu.fi> for this stress test. -unset TMP -rm -f wish -TMP=wish >$TMP -ls wish - -# The following example shows that hush's parser is -# not _really_ Bourne compatible -echo "echo Hello World" >"a=b" -unset a -chmod a+x "a=b" -PATH=$PATH:. -"a=b" -echo $a - -# assuming the shell wasn't too buggy, clean up the mess -rm -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 @@ -#include <syslog.h> - -int do_log(char* msg, int delay) -{ - openlog("testlog", LOG_PID, LOG_DAEMON); - while(1) { - syslog(LOG_ERR, "%s: testing one, two, three\n", msg); - sleep(delay); - } - closelog(); - return(0); -}; - -int main(void) -{ - if (fork()==0) - do_log("A", 2); - do_log("B", 3); -} diff --git a/tests/testcases b/tests/testcases deleted file mode 100644 index 37e741260..000000000 --- a/tests/testcases +++ /dev/null @@ -1,404 +0,0 @@ -# testcases -# -# This file should be filled with test cases to test applets that: -# -# - can somehow produce output (we can't test sync or sleep) -# - have a GNU (or other) counterpart -# - are not interactive (don't require a ^C or anything) -# - don't require extensive setup or cleanup (a litte setup is fine) -# - don't have huge and possibly damaging effects (fsck, swapoff) -# -# If possible, a test case should be made that tests each option the applet -# supports. When a new option is added, a new test case should be written for -# it. When somebody reports a bug with a testcase, that testcase should be -# added here as well. -# -# Some other guidelines to follow: -# -# - please try to keep applets alphabetized, it will make life easier -# - use the file tester.sh or testcases when you need to do a non-destructive -# test on a file (i.e., cat, md5sum) -# - try to make the applet you're testing the first thing on the line (this -# not always possible) -# - (???) if you have to create a temporary file, call it TMPFILE -# - pipe symbols that represent real pipes need a space in front of them -# (so the test script can find them and add the "../busybox" after it). -# - pipe symbols that are not used for pipes need to be shell-escaped, -# with a double \. See the expr test cases. - - -# ar - -# basename -basename `pwd` - -# cat -cat tester.sh -echo hello there | cat tester.sh - - -# chmod -# chown -# chgrp -# chroot -# chvt - can't be tested here -# clear - can't be tested here -# cmp -# cp - -# cut -echo "1234" | cut -c1 -echo "1234" | cut -c 1 -echo "1234567890" | cut -c2-7 -echo "1234567890" | cut -c 2-7 -echo "f1 f2" | cut -f2 -echo "f1 f2" | cut -f 2 -echo "f1 f2 f3 f4 f5" | cut -f2-4 -echo "f1 f2 f3 f4 f5" | cut -f 2-4 - -# date -date -date -R -date -u -date +%d/%m/%y - -# dc - needs an input file - -# dd -# BUG: record count line goes to stdout instead of stderr -dd if=/dev/urandom of=O bs=1k count=1 ; ls -l O ; rm O - -# deallocvt - -# df -# XXX: minor formatting differences -df -df . -df -k -df -h -df -m - -# dirname -dirname `pwd` - -# dmesg (XXX: change the silly cmd business in the source) -dmesg -dmesg -n 8 -dmesg -s 512 -# I really don't want to do this next one -#dmesg -c - -# dos2unix - needs an input file -# dpkg -# dpkg_deb - -# du -# BUG: rounding behavior differs from GNU du -du -du -s -du -l -du -k -du -h -du -m - -# dumpkmap - no counterprt? -# dutmp - no counterprt? - -# echo -echo "foo bar baz" -echo -n "no newline" - - -# expr -expr 1 \\| 1 -expr 1 \\| 0 -expr 0 \\| 1 -expr 0 \\| 0 - -expr 1 \\& 1 -expr 1 \\& 0 -expr 0 \\& 1 -expr 0 \\& 0 - -expr 0 \\< 1 -expr 1 \\< 0 - -expr 1 \\> 0 -expr 0 \\> 1 - -expr 0 \\<= 1 -expr 1 \\<= 0 -expr 1 \\<= 1 - -expr 1 \\>= 0 -expr 0 \\>= 1 -expr 1 \\>= 1 - -expr 1 + 2 -expr 2 - 1 -expr 2 \\* 3 -expr 12 / 2 -expr 12 % 5 - -# somebody else can do all the string stuff - - -# fbset - can't be tested here -# fdflush -# find -find . - -# free -# XXX: minor formatting differences -free - -# freeramdisk -# fsck.minix - won't test -# getopt - -# grep -grep -l strdup ../*utils/*.c -grep -c strdup ../*utils/*.c -grep -lc strdup ../*utils/*.c -grep -cv strdup ../*utils/*.c -grep -i null ../findutils/grep.c -grep -e strdup -e regcomp -e atexit ../findutils/grep.c - -# gunzip - -# gzip -# XXX: compressed output differs from gzip-1.2.4, but decompresses fine -echo testing 1 2 3 >tmpfile1; gzip tmpfile1; echo tmpfile*; md5sum tmpfile1.gz; rm tmpfile1.gz -echo testing 1 2 3 | gzip >tmpfile1.gz; md5sum tmpfile1.gz; rm tmpfile1.gz - - -# halt - won't test, dangerous - -# head -head tester.sh -head -n 2 tester.sh - -# hostid -hostid - -# hostname -# XXX: minor formatting differences -hostname -hostname -s -hostname -i -hostname -d -# not going to do this next one -#hostname -F - -# id -# BUG: Busybox id doesn't print supplemental groups -id -id -u -id -g -id -ur -id -un - - -# ifconfig -# requires CONFIG_FEATURE_IFCONFIG_STATUS -ifconfig -#ifconfig -a -#ifconfig eth0 -#ifconfig lo - -# init - won't test -# insmod - won't test - -# kill -#kill -l -# not going to do any more - -# length -# ln - see ln_tests.mk -# loadacm -# loadfont -# loadkmap -# logger -# logname - -# ls -# XXX: minor formatting differences -ls ../e* -ls -l ../e* -ls -s ../e* -ls -h ../e* -ls -1 ../e* - -# lsmod -lsmod - -# makedevs - -# md5sum -md5sum tester.sh - -# mkdir -mkdir D ; ls -ld D ; rmdir D - -# mkfifo -# -# we will test making one. actually testing pushing data through it requires -# more interaction than we can manage here. -# (these lines turn up an existing ls bug) -mkfifo F ; ls -l F ; rm F -mkfifo -m 0600 F ; ls -l F ; rm F - -# mkfs.minix - won't test -# mknod -# mkswap - won't test -# mktemp -# more - can't test: interactive - -# mount -# BUG: proc line starts with /proc instead of proc -mount -# not going to test mount with any args, can't be done safely or sanely - -# mt -# mv - see mv_tests.mk -# nc -# nfsmount -# nslookup -# ping -ping -c 3 yahoo.com -# pivot_root -# poweroff - won't test -# printf -# ps - there's lotsa differences between busybox ps and any other ps - -# pwd -pwd - -# rdate - won't test - -# readlink -ln -sf tester.sh L ; readlink L ; rm -f L - -# reboot - won't test -# renice - won't test -# reset - can't test: no output - -# rm -touch F ; rm F - -# rmdir -# rmmod - won't test: dangerous - -# route -# XXX: doesn't DNS resolve -route - -# rpm2cpio - -# sed - we can do some one-liners here, some testing is a little -# difficult to do in just this space (like a,i,c cmds). - -# test ^$ matching -echo foo | sed -ne '/^$/p' -echo -e "foo\\n\\nbar" | sed -ne '/^$/p' - -sed -e '/test$/d' testcases -sed -e '/^echo/d' testcases -sed -e '/test/s/dangerous/PELIGROSO/' testcases -sed -ne '1,/getopt/p' ../shellutils/pwd.c -sed -e '/getopt/r ../shellutils/pwd.c' ../editors/sed.c - - -# setkeycodes - -# sh - note that we cannot test the shell interactively here -sh -c "echo a b c" -sh -c ">" -sh -c "a" -sh sh.testcases - - -# sleep - can't test: produces no output - -# sort -sort tester.sh -sort -n tester.sh -sort -r tester.sh - -# stty -# swapon - won't test: dangerous -# swapoff - won't test: dangerous -# sync - can't test: no output -# syslogd - won't test: too involved - -# tail -tail tester.sh -tail -n 2 tester.sh - -# tar - -# tee -echo "please tee me!" | tee A B C ; cat A B C -echo "please tee me!" | tee A B C ; echo "tee me too!" | tee -a A B C ; cat A B C ; rm A B C - -# telnet - can't test: interactive - -# test -# tftp - -# touch -touch tmpfile1; ls tmpfile1; rm -f tmpfile1 -touch -c tmpfile1; ls tmpfile1; rm -f tmpfile1 - -# tr -# BUG: Busybox tr range handling minix style [a-z] instead of GNU # style a-z -echo "cbaab" | tr abc zyx -echo "TESTING A B C" | tr [A-Z] [a-z] -# not GNU compatible -echo fdhrnzvfu bffvsentr | tr [a-z] [n-z][a-m] -echo abc[] | tr a[b AXB -echo testing | tr -d aeiou - -# true -true ; echo $? - -# false -false ; echo $? - -# tty -# umount -# uname -# uniq -# unix2dos -# update - -# uptime -# BUG: doesn't print number of users -uptime - -# usleep -# uudecode -# uuencode -# watchdog - -# wc -wc tester.sh -wc -c tester.sh -wc -w tester.sh -wc -l tester.sh -wc -L tester.sh - -# wget - -# which -which ls - -# whoami -whoami - -# xargs -# XXX: Busygox xargs divides filenames with '\n' instead of ' ' -ls -1 ../e* | xargs -ls -1 ../e* | xargs md5sum - -# yes - can't test: interactive (needs ^C) - 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 @@ -#!/bin/bash -# -# tester.sh - reads testcases from file and tests busybox applets vs GNU -# counterparts -# -# This should be run from within the tests/ directory. Before you run it, you -# should compile up a busybox that has all applets and all features turned on. - -# set up defaults (can be changed with cmd-line options) -BUSYBOX=../busybox -TESTCASES=testcases -LOGFILE=tester.log -CONFIG_OUT=bb.out -GNU_OUT=gnu.out -SETUP="" -CLEANUP="" -KEEPTMPFILES="no" -DEBUG=2 - - -#while getopts 'p:t:l:b:g:s:c:kd:' opt -while getopts 'p:t:l:s:c:kd:' opt -do - case $opt in - p) BUSYBOX=$OPTARG; ;; - t) TESTCASES=$OPTARG; ;; - l) LOGFILE=$OPTARG; ;; -# b) CONFIG_OUT=$OPTARG; ;; -# g) GNU_OUT=$OPTARG; ;; - s) SETUP=$OPTARG; ;; - c) CLEANUP=$OPTARG; ;; - k) KEEPTMPFILES="yes"; ;; - d) DEBUG=$OPTARG; ;; - *) - echo "usage: $0 [-ptlbgsc]" - echo " -p PATH path to busybox executable (default=$BUSYBOX)" - echo " -t FILE run testcases in FILE (default=$TESTCASES)" - echo " -l FILE log test results in FILE (default=$LOGFILE)" -# echo " -b FILE store temporary busybox output in FILE" -# echo " -g FILE store temporary GNU output in FILE" - echo " -s FILE (setup) run commands in FILE before testcases" - echo " -c FILE (cleanup) run commands in FILE after testcases" - echo " -k keep temporary output files (don't delete them)" - echo " -d NUM set level of debugging output" - echo " 0 = no output" - echo " 1 = output failures / whoops lines only" - echo " 2 = (default) output setup / cleanup msgs and testcase lines" - echo " 3+= other debug noise (internal stuff)" - exit 1 - ;; - esac -done -#shift `expr $OPTIND - 1` - - -# maybe print some debug output -if [ $DEBUG -ge 3 ] -then - echo "BUSYBOX=$BUSYBOX" - echo "TESTCASES=$TESTCASES" - echo "LOGFILE=$LOGFILE" - echo "CONFIG_OUT=$CONFIG_OUT" - echo "GNU_OUT=$GNU_OUT" - echo "SETUP=$SETUP" - echo "CLEANUP=$CLEANUP" - echo "DEBUG=$DEBUG" -fi - - -# do sanity checks -if [ ! -e $BUSYBOX ] -then - echo "Busybox executable: $BUSYBOX not found!" - exit 1 -fi - -if [ ! -e $TESTCASES ] -then - echo "Testcases file: $TESTCASES not found!" - exit 1 -fi - - -# do normal setup -[ -e $LOGFILE ] && rm $LOGFILE -unalias -a # gets rid of aliases that might create different output - - -# do extra setup (if any) -if [ ! -z "$SETUP" ] -then - [ $DEBUG -ge 2 ] && echo "running setup commands in $SETUP" - source $SETUP -fi - - -# go through each line in the testcase file -cat $TESTCASES | while read line -do - #echo $line - # only process non-blank lines and non-comment lines - if [ "$line" ] - then - if [ `echo "$line" | cut -c1` != "#" ] - then - - # test if the applet was compiled into busybox - # (this only tests the applet at the beginning of the line) - #applet=`echo $line | cut -d' ' -f1` - applet=`echo $line | sed 's/\(^[^ ;]*\)[ ;].*/\1/'` - $BUSYBOX 2>&1 | grep -qw $applet - if [ $? -eq 1 ] - then - echo "WHOOPS: $applet not compiled into busybox" | tee -a $LOGFILE - else - - # execute line using gnu / system programs - [ $DEBUG -ge 2 ] && echo "testing: $line" | tee -a $LOGFILE - sh -c "$line" > $GNU_OUT - - # change line to include "busybox" before every statement - line="$BUSYBOX $line" - # is this a bash-2-ism? - # line=${line//;/; $BUSYBOX } - # line=${line//|/| $BUSYBOX } - # assume $BUSYBOX has no commas - line=`echo "$line" | sed -e 's,;,; '$BUSYBOX, \ - -e 's, |, | '$BUSYBOX,` - - # execute line using busybox programs - [ $DEBUG -ge 2 ] && echo "testing: $line" | tee -a $LOGFILE - sh -c "$line" > $CONFIG_OUT - - # see if they match - diff -q $CONFIG_OUT $GNU_OUT > /dev/null - if [ $? -eq 1 ] - then - [ $DEBUG -ge 1 ] && echo "FAILED: $line" | tee -a $LOGFILE - diff -u $CONFIG_OUT $GNU_OUT >> $LOGFILE - fi - fi - fi - fi -done - -[ $DEBUG -gt 0 ] && echo "Finished. Results are in $LOGFILE" - - -# do normal cleanup -[ "$KEEPTMPFILES" = "no" ] && rm -f $CONFIG_OUT $GNU_OUT - - -# do extra cleanup (if any) -if [ ! -z "$CLEANUP" ] -then - [ $DEBUG -ge 2 ] && echo "running cleanup commands in $CLEANUP" - source $CLEANUP -fi 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 @@ -/* - * tst-syslogd.c - tests concurrent threads calling syslog - * - * build with: gcc -Wall tst-syslogd.c -lpthread - */ - -#include <stdio.h> -#include <pthread.h> -#include <syslog.h> -#include <unistd.h> - -void *log_func(void *arg) -{ - int i; - int thrid = (int)arg; - - openlog(NULL, LOG_PERROR | LOG_PID, LOG_USER); - for (i = 0; i < 10; i++) { - syslog(LOG_DEBUG, "thread %i iter %i\n", thrid, i); - sleep(thrid); /* this mixes things up a bit */ - } - closelog(); - - return NULL; -} - -int main(int argc, char **argv) -{ - pthread_t thr1, thr2, thr3; - int id1 = 1; - int id2 = 2; - int id3 = 3; - - pthread_create(&thr1, NULL, log_func, (void *)id1); - pthread_create(&thr2, NULL, log_func, (void *)id2); - pthread_create(&thr3, NULL, log_func, (void *)id3); - - pthread_join(thr1, NULL); - pthread_join(thr2, NULL); - pthread_join(thr3, NULL); - - return 0; -} - |