From 650fe63467e693990cf357c51b74db3278088a56 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Tue, 6 Apr 2004 11:10:30 +0000 Subject: [PATCH] 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 --- tests/.cvsignore | 16 - tests/Makefile | 36 -- tests/cp_tests.mk | 360 ---------------- tests/ln_tests.mk | 71 --- tests/multibuild.pl | 73 ---- tests/multifeat.pl | 83 ---- tests/mv_tests.mk | 167 -------- tests/sh.testcases | 89 ---- tests/syslog_test.c | 19 - tests/testcases | 404 ------------------ tests/tester.sh | 158 ------- tests/tst-syslogd.c | 44 -- testsuite/basename/basename-works | 2 + testsuite/cmp/cmp-detects-difference | 8 +- testsuite/cp/cp-a-files-to-dir | 8 +- testsuite/cp/cp-a-preserves-links | 2 +- testsuite/cp/cp-d-files-to-dir | 4 +- testsuite/cp/cp-does-not-copy-unreadable-file | 2 + testsuite/cp/cp-preserves-links | 2 +- testsuite/date/date-R-works | 2 + testsuite/date/date-format-works | 1 + testsuite/date/date-u-works | 2 + testsuite/date/date-works | 2 + testsuite/dirname/dirname-works | 2 + testsuite/du/du-h-works | 3 + testsuite/du/du-k-works | 3 + testsuite/du/du-l-works | 3 + testsuite/du/du-m-works | 3 + testsuite/du/du-s-works | 3 + testsuite/du/du-works | 3 + testsuite/echo/echo-prints-argument | 2 +- testsuite/expr/expr-works | 59 +++ testsuite/grep/grep-matches-NUL | 8 +- testsuite/head/head-n-works | 3 + testsuite/head/head-works | 3 + testsuite/hostid/hostid-works | 2 + testsuite/hostname/hostname-d-works | 2 + testsuite/hostname/hostname-i-works | 2 + testsuite/hostname/hostname-s-works | 1 + testsuite/hostname/hostname-works | 1 + testsuite/id/id-g-works | 1 + testsuite/id/id-u-works | 1 + testsuite/id/id-un-works | 1 + testsuite/id/id-ur-works | 1 + testsuite/ln/ln-creates-hard-links | 4 + testsuite/ln/ln-creates-soft-links | 4 + testsuite/ln/ln-force-creates-hard-links | 5 + testsuite/ln/ln-force-creates-soft-links | 5 + testsuite/ln/ln-preserves-hard-links | 8 + testsuite/ln/ln-preserves-soft-links | 9 + testsuite/ls/ls-1-works | 3 + testsuite/ls/ls-h-works | 3 + testsuite/ls/ls-l-works | 3 + testsuite/ls/ls-s-works | 3 + testsuite/mv/mv-files-to-dir | 16 + testsuite/mv/mv-follows-links | 4 + testsuite/mv/mv-moves-empty-file | 4 + testsuite/mv/mv-moves-hardlinks | 4 + testsuite/mv/mv-moves-large-file | 4 + testsuite/mv/mv-moves-small-file | 4 + testsuite/mv/mv-moves-symlinks | 6 + testsuite/mv/mv-moves-unreadable-files | 5 + testsuite/mv/mv-preserves-hard-links | 6 + testsuite/mv/mv-preserves-links | 5 + testsuite/mv/mv-refuses-mv-dir-to-subdir | 23 + testsuite/mv/mv-removes-source-file | 4 + testsuite/pwd/pwd-prints-working-directory | 2 +- testsuite/runtest | 34 +- testsuite/sed/sed-append-next-line | 7 +- testsuite/sort/sort-n-works | 3 + testsuite/sort/sort-r-works | 3 + testsuite/sort/sort-works | 3 + testsuite/strings/strings-works-like-GNU | 7 +- testsuite/tail/tail-n-works | 3 + testsuite/tail/tail-works | 3 + testsuite/tar/tar-extracts-multiple-files | 3 +- testsuite/tr/tr-d-works | 4 + testsuite/tr/tr-non-gnu | 1 + testsuite/tr/tr-works | 9 + testsuite/uptime/uptime-works | 2 + ...uencode-sets-standard-input-mode-correctly | 2 - testsuite/which/which-uses-default-path | 3 - testsuite/xargs/xargs-works | 3 + 83 files changed, 316 insertions(+), 1570 deletions(-) delete mode 100644 tests/.cvsignore delete mode 100644 tests/Makefile delete mode 100644 tests/cp_tests.mk delete mode 100644 tests/ln_tests.mk delete mode 100755 tests/multibuild.pl delete mode 100755 tests/multifeat.pl delete mode 100644 tests/mv_tests.mk delete mode 100644 tests/sh.testcases delete mode 100644 tests/syslog_test.c delete mode 100644 tests/testcases delete mode 100755 tests/tester.sh delete mode 100644 tests/tst-syslogd.c create mode 100644 testsuite/basename/basename-works create mode 100644 testsuite/date/date-R-works create mode 100644 testsuite/date/date-format-works create mode 100644 testsuite/date/date-u-works create mode 100644 testsuite/date/date-works create mode 100644 testsuite/dirname/dirname-works create mode 100644 testsuite/du/du-h-works create mode 100644 testsuite/du/du-k-works create mode 100644 testsuite/du/du-l-works create mode 100644 testsuite/du/du-m-works create mode 100644 testsuite/du/du-s-works create mode 100644 testsuite/du/du-works create mode 100644 testsuite/expr/expr-works create mode 100644 testsuite/head/head-n-works create mode 100644 testsuite/head/head-works create mode 100644 testsuite/hostid/hostid-works create mode 100644 testsuite/hostname/hostname-d-works create mode 100644 testsuite/hostname/hostname-i-works create mode 100644 testsuite/hostname/hostname-s-works create mode 100644 testsuite/hostname/hostname-works create mode 100644 testsuite/id/id-g-works create mode 100644 testsuite/id/id-u-works create mode 100644 testsuite/id/id-un-works create mode 100644 testsuite/id/id-ur-works create mode 100644 testsuite/ln/ln-creates-hard-links create mode 100644 testsuite/ln/ln-creates-soft-links create mode 100644 testsuite/ln/ln-force-creates-hard-links create mode 100644 testsuite/ln/ln-force-creates-soft-links create mode 100644 testsuite/ln/ln-preserves-hard-links create mode 100644 testsuite/ln/ln-preserves-soft-links create mode 100644 testsuite/ls/ls-1-works create mode 100644 testsuite/ls/ls-h-works create mode 100644 testsuite/ls/ls-l-works create mode 100644 testsuite/ls/ls-s-works create mode 100644 testsuite/mv/mv-files-to-dir create mode 100644 testsuite/mv/mv-follows-links create mode 100644 testsuite/mv/mv-moves-empty-file create mode 100644 testsuite/mv/mv-moves-hardlinks create mode 100644 testsuite/mv/mv-moves-large-file create mode 100644 testsuite/mv/mv-moves-small-file create mode 100644 testsuite/mv/mv-moves-symlinks create mode 100644 testsuite/mv/mv-moves-unreadable-files create mode 100644 testsuite/mv/mv-preserves-hard-links create mode 100644 testsuite/mv/mv-preserves-links create mode 100644 testsuite/mv/mv-refuses-mv-dir-to-subdir create mode 100644 testsuite/mv/mv-removes-source-file create mode 100644 testsuite/sort/sort-n-works create mode 100644 testsuite/sort/sort-r-works create mode 100644 testsuite/sort/sort-works create mode 100644 testsuite/tail/tail-n-works create mode 100644 testsuite/tail/tail-works create mode 100644 testsuite/tr/tr-d-works create mode 100644 testsuite/tr/tr-non-gnu create mode 100644 testsuite/tr/tr-works create mode 100644 testsuite/uptime/uptime-works create mode 100644 testsuite/xargs/xargs-works 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 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 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 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,") { - 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,") { - 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 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 2>&1 -cat foo -cat doesnt_exist >foo 2>&1 -tr 'a-z' 'A-Z' $TMP -ls fish - -# ash, lash, and hush do not create wish; bash and ksh do. -# Thanks to Tapani Tarvainen 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 - -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 -#include -#include -#include - -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; -} - 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 @@ +test x$(basename $(pwd)) = x$(busybox basename $(pwd)) + 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 @@ echo foo >foo echo bar >bar -! busybox cmp -s foo bar +set +e +busybox cmp -s foo bar +if [ $? != 0 ] ; then + exit 0; +fi + +exit 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 test -f there/file1 test -f there/file2 test ! -s there/dir1/file3 -test -l there/link1 -test `readlink there/link1` = "file2" -test ! file3 -ot there/dir1/file3 -test ! file3 -nt there/dir1/file3 +test -L there/link1 +test xfile2 = x`readlink there/link1` +test ! dir1/file3 -ot there/dir1/file3 +test ! 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 ln -s foo bar busybox cp -a bar baz test -L baz -test `readlink baz` = "foo" +test 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 test -f there/file1 test -f there/file2 test ! -s there/file3 -test -l there/link1 -test `readlink there/link1` = "file2" +test -L there/link1 +test 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 @@ touch foo chmod a-r foo +set +e busybox cp foo bar +set -e test ! -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 ln -s foo bar busybox cp -d bar baz test -L baz -test `readlink baz` = "foo" +test 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 @@ +test x"`date -R`" = x"`busybox date -R`" + 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 @@ +test x"`date -u`" = x"`busybox date -u`" + 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 @@ +test x"`date`" = x"`busybox date`" + 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 @@ +test x$(dirname $(pwd)) = x$(busybox dirname $(pwd)) + 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 @@ +du -h .. > logfile.gnu +busybox du -h .. > logfile.bb +cmp 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 @@ +du -k .. > logfile.gnu +busybox du -k .. > logfile.bb +cmp 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 @@ +du -l .. > logfile.gnu +busybox du -l .. > logfile.bb +cmp 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 @@ +du -m .. > logfile.gnu +busybox du -m .. > logfile.bb +cmp 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 @@ +du -s .. > logfile.gnu +busybox du -s .. > logfile.bb +cmp 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 @@ +du .. > logfile.gnu +busybox du .. > logfile.bb +cmp 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 @@ +# busybox expr +busybox expr 1 \| 1 +busybox expr 1 \| 0 +busybox expr 0 \| 1 +busybox expr 1 \& 1 +busybox expr 0 \< 1 +busybox expr 1 \> 0 +busybox expr 0 \<= 1 +busybox expr 1 \<= 1 +busybox expr 1 \>= 0 +busybox expr 1 \>= 1 +busybox expr 1 + 2 +busybox expr 2 - 1 +busybox expr 2 \* 3 +busybox expr 12 / 2 +busybox expr 12 % 5 + + +set +e +busybox expr 0 \| 0 +if [ $? != 1 ] ; then + exit 1; +fi; + +busybox expr 1 \& 0 +if [ $? != 1 ] ; then + exit 1; +fi; + +busybox expr 0 \& 1 +if [ $? != 1 ] ; then + exit 1; +fi; + +busybox expr 0 \& 0 +if [ $? != 1 ] ; then + exit 1; +fi; + +busybox expr 1 \< 0 +if [ $? != 1 ] ; then + exit 1; +fi; + +busybox expr 0 \> 1 +if [ $? != 1 ] ; then + exit 1; +fi; + +busybox expr 1 \<= 0 +if [ $? != 1 ] ; then + exit 1; +fi; + +busybox expr 0 \>= 1 +if [ $? != 1 ] ; then + exit 1; +fi; + 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 @@ -# XFAIL +set +e echo -e '\0' | busybox grep . +if [ $? != 0 ] ; then + exit 0; +fi + +exit 1; + 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 @@ +head -n 2 ../README > logfile.gnu +busybox head -n 2 ../README > logfile.bb +cmp 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 @@ +head ../README > logfile.gnu +busybox head ../README > logfile.bb +cmp 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 @@ +test x$(hostid) = x$(busybox hostid) + 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 @@ +test x$(hostname -d) = x$(busybox hostname -d) + 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 @@ +test x$(hostname -i) = x$(busybox hostname -i) + 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 @@ +echo file number one > file1 +busybox ln file1 link1 +test -f file1 +test -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 @@ +echo file number one > file1 +busybox ln -s file1 link1 +test -L link1 +test 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 @@ +echo file number one > file1 +echo file number two > link1 +busybox ln -f file1 link1 +test -f file1 +test -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 @@ +echo file number one > file1 +echo file number two > link1 +busybox ln -f -s file1 link1 +test -L link1 +test 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 @@ +echo file number one > file1 +echo file number two > link1 +set +e +busybox ln file1 link1 +if [ $? != 0 ] ; then + exit 0; +fi +exit 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 @@ +echo file number one > file1 +echo file number two > link1 +set +e +busybox ln -s file1 link1 +if [ $? != 0 ] ; then + exit 0; +fi +exit 1; + 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 @@ +ls -1 .. > logfile.gnu +busybox ls -1 .. > logfile.bb +cmp 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 @@ +ls -h .. > logfile.gnu +busybox ls -h .. > logfile.bb +cmp 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 @@ +ls -l .. > logfile.gnu +busybox ls -l .. > logfile.bb +cmp 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 @@ +ls -1s .. > logfile.gnu +busybox ls -1s .. > logfile.bb +cmp 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 @@ +echo file number one > file1 +echo file number two > file2 +ln -s file2 link1 +mkdir dir1 +touch --date='Sat Jan 29 21:24:08 PST 2000' dir1/file3 +mkdir there +busybox mv file1 file2 link1 dir1 there +test -f there/file1 +test -f there/file2 +test -f there/dir1/file3 +test -L there/link1 +test xfile2 = x`readlink there/link1` +test ! -e file1 +test ! -e file2 +test ! -e link1 +test ! -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 @@ +touch foo +ln -s foo bar +busybox mv bar baz +test -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 @@ +touch foo +busybox mv foo bar +test ! -e foo +test -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 @@ +touch foo +ln foo bar +busybox mv bar baz +test ! -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 @@ +dd if=/dev/zero of=foo seek=10k count=1 2>/dev/null +busybox mv foo bar +test ! -e foo +test -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 @@ +echo I WANT > foo +busybox mv foo bar +test ! -e foo +test -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 @@ +touch foo +ln -s foo bar +busybox mv bar baz +test -f foo +test ! -e bar +test -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 @@ +touch foo +chmod a-r foo +busybox mv foo bar +test ! -e foo +test -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 @@ +# FEATURE: CONFIG_FEATURE_PRESERVE_HARDLINKS +touch foo +ln foo bar +mkdir baz +busybox mv foo bar baz +test 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 @@ +touch foo +ln -s foo bar +busybox mv bar baz +test -L baz +test 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 @@ +echo file number one > file1 +echo file number two > file2 +ln -s file2 link1 +mkdir dir1 +touch --date='Sat Jan 29 21:24:08 PST 2000' dir1/file3 +mkdir there +busybox mv file1 file2 link1 dir1 there +test -f there/file1 +test -f there/file2 +test -f there/dir1/file3 +test -L there/link1 +test xfile2 = x`readlink there/link1` +test ! -e file1 +test ! -e file2 +test ! -e link1 +test ! -e dir1/file3 +set +e +busybox mv there there/dir1 +if [ $? != 0 ] ; then + exit 0; +fi + +exit 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 @@ +touch foo +busybox mv foo bar +test ! -e foo +test -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 @@ PATH=$(dirname $(pwd)):$PATH -show_result () -{ - local resolution=$1 - local testcase=$2 - local status=0 - - if [ $resolution = XPASS -o $resolution = FAIL ]; then - status=1 - fi - - if [ "$verbose" -o $status -eq 1 ]; then - echo "$resolution: $testcase" - fi - - return $status -} - run_applet_testcase () { local applet=$1 local testcase=$2 local status=0 - local X= local RES= local uc_applet=$(echo $applet | tr a-z A-Z) local testname=$(basename $testcase) if grep -q "^# CONFIG_${uc_applet} is not set$" ../.config; then - show_result UNTESTED $testname + echo UNTESTED: $testname return 0 fi @@ -40,15 +22,11 @@ run_applet_testcase () local feature=`sed -ne 's/^# FEATURE: //p' $testcase` if grep -q "^# ${feature} is not set$" ../.config; then - show_result UNTESTED $testname + echo UNTESTED: $testname return 0 fi fi - if grep -q "^# XFAIL$" $testcase; then - X=X - fi - rm -rf tmp mkdir -p tmp pushd tmp >/dev/null @@ -56,14 +34,14 @@ run_applet_testcase () sh -x -e ../$testcase >.logfile.txt 2>&1 if [ $? != 0 ] ; then - show_result ${X}FAIL $testname - if [ "$verbose" == 1 ]; then + echo FAIL: $testname + if [ "$verbose" = 1 ]; then cat .logfile.txt - exit 1; + #exit 1; fi; status=$? else - show_result ${X}PASS $testname + echo PASS: $testname rm -f .logfile.txt status=$? 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 @@ -# XFAIL # This will fail if CONFIG_FEATURE_SED_GNU_COMPATABILITY is defined busybox sed 'N;p'>output < logfile.gnu +busybox sort -n ../README > logfile.bb +cmp 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 @@ +sort -r ../README > logfile.gnu +busybox sort -r ../README > logfile.bb +cmp 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 @@ +sort ../README > logfile.gnu +busybox sort ../README > logfile.bb +cmp 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 @@ rm -f foo bar strings -af ../../busybox > foo busybox strings -af ../../busybox > bar +set +e test ! -f foo -a -f bar if [ $? = 0 ] ; then - diff -q foo bar -fi; - + set -e + diff -q foo bar +fi 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 @@ +tail -n 2 ../README > logfile.gnu +busybox tail -n 2 ../README > logfile.bb +cmp 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 @@ +tail -n 2 ../README > logfile.gnu +busybox tail -n 2 ../README > logfile.bb +cmp 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 @@ touch foo bar tar cf foo.tar foo bar rm foo bar -busybox tar xf foo.tar +busybox tar -xf foo.tar test -f foo -a -f bar +exit 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 @@ +echo testing | tr -d aeiou > logfile.gnu +echo testing | busybox tr -d aeiou > logfile.bb + +cmp 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 @@ +echo "cbaab" | tr abc zyx > logfile.gnu +echo "TESTING A B C" | tr [A-Z] [a-z] >> logfile.gnu +echo abc[] | tr a[b AXB >> logfile.gnu + +echo "cbaab" | busybox tr abc zyx > logfile.bb +echo "TESTING A B C" | busybox tr [A-Z] [a-z] >> logfile.bb +echo abc[] | busybox tr a[b AXB >> logfile.bb + +cmp 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 @@ +busybox uptime + 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 @@ saved_umask=$(umask) umask 0 busybox uuencode foo logfile.gnu +find -name \*works -type f | busybox xargs md5sum > logfile.bb +diff -u logfile.gnu logfile.bb -- 2.25.1