diff options
| author | Denys Vlasenko <vda.linux@googlemail.com> | 2010-05-10 04:16:43 +0200 |
|---|---|---|
| committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-05-10 04:16:43 +0200 |
| commit | ff0e875e02487b61dcc520b295feb6477b859065 (patch) | |
| tree | 234845d306bf04446b9839c51b06d18d5f9dc9a6 | |
| parent | 572b9a3019caf0929a41a45e1f3a8c7e59ec141c (diff) | |
| download | busybox-w32-ff0e875e02487b61dcc520b295feb6477b859065.tar.gz busybox-w32-ff0e875e02487b61dcc520b295feb6477b859065.tar.bz2 busybox-w32-ff0e875e02487b61dcc520b295feb6477b859065.zip | |
work on adding testsuite runs to randomconfig test builds
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| -rw-r--r-- | archival/cpio.c | 1 | ||||
| -rw-r--r-- | coreutils/Kbuild | 1 | ||||
| -rw-r--r-- | networking/telnetd.c | 2 | ||||
| -rwxr-xr-x | scripts/randomtest | 130 | ||||
| -rwxr-xr-x | scripts/randomtest.loop | 36 | ||||
| -rwxr-xr-x | testsuite/ash.tests | 4 | ||||
| -rwxr-xr-x | testsuite/cpio.tests | 4 |
7 files changed, 109 insertions, 69 deletions
diff --git a/archival/cpio.c b/archival/cpio.c index 2698f0791..e0ca7fa5c 100644 --- a/archival/cpio.c +++ b/archival/cpio.c | |||
| @@ -311,6 +311,7 @@ int cpio_main(int argc UNUSED_PARAM, char **argv) | |||
| 311 | /* no parameters */ | 311 | /* no parameters */ |
| 312 | opt_complementary = "=0"; | 312 | opt_complementary = "=0"; |
| 313 | opt = getopt32(argv, OPTION_STR, &cpio_filename); | 313 | opt = getopt32(argv, OPTION_STR, &cpio_filename); |
| 314 | argv += optind; | ||
| 314 | if (opt & CPIO_OPT_FILE) { /* -F */ | 315 | if (opt & CPIO_OPT_FILE) { /* -F */ |
| 315 | xmove_fd(xopen(cpio_filename, O_RDONLY), STDIN_FILENO); | 316 | xmove_fd(xopen(cpio_filename, O_RDONLY), STDIN_FILENO); |
| 316 | } | 317 | } |
diff --git a/coreutils/Kbuild b/coreutils/Kbuild index 460d62d3f..ee22a3f7b 100644 --- a/coreutils/Kbuild +++ b/coreutils/Kbuild | |||
| @@ -17,6 +17,7 @@ lib-$(CONFIG_CATV) += catv.o | |||
| 17 | lib-$(CONFIG_CHGRP) += chgrp.o chown.o | 17 | lib-$(CONFIG_CHGRP) += chgrp.o chown.o |
| 18 | lib-$(CONFIG_CHMOD) += chmod.o | 18 | lib-$(CONFIG_CHMOD) += chmod.o |
| 19 | lib-$(CONFIG_CHOWN) += chown.o | 19 | lib-$(CONFIG_CHOWN) += chown.o |
| 20 | lib-$(CONFIG_ADDUSER) += chown.o # used by adduser | ||
| 20 | lib-$(CONFIG_ADDGROUP) += chown.o # used by adduser | 21 | lib-$(CONFIG_ADDGROUP) += chown.o # used by adduser |
| 21 | lib-$(CONFIG_CHROOT) += chroot.o | 22 | lib-$(CONFIG_CHROOT) += chroot.o |
| 22 | lib-$(CONFIG_CKSUM) += cksum.o | 23 | lib-$(CONFIG_CKSUM) += cksum.o |
diff --git a/networking/telnetd.c b/networking/telnetd.c index a8c86b62f..ea66a25c0 100644 --- a/networking/telnetd.c +++ b/networking/telnetd.c | |||
| @@ -227,7 +227,7 @@ make_new_session( | |||
| 227 | IF_NOT_FEATURE_TELNETD_STANDALONE(void) | 227 | IF_NOT_FEATURE_TELNETD_STANDALONE(void) |
| 228 | ) { | 228 | ) { |
| 229 | #if !ENABLE_FEATURE_TELNETD_STANDALONE | 229 | #if !ENABLE_FEATURE_TELNETD_STANDALONE |
| 230 | enum { sock = 0 ); | 230 | enum { sock = 0 }; |
| 231 | #endif | 231 | #endif |
| 232 | const char *login_argv[2]; | 232 | const char *login_argv[2]; |
| 233 | struct termios termbuf; | 233 | struct termios termbuf; |
diff --git a/scripts/randomtest b/scripts/randomtest index 6b7db9239..8d0d79e64 100755 --- a/scripts/randomtest +++ b/scripts/randomtest | |||
| @@ -1,86 +1,88 @@ | |||
| 1 | #!/bin/sh | 1 | #!/bin/sh |
| 2 | 2 | ||
| 3 | # Select which libc to build against | 3 | # If not specified in environment... |
| 4 | libc="glibc" # assumed native | 4 | if ! test "$LIBC"; then |
| 5 | # static, cross-compilation | 5 | # Select which libc to build against |
| 6 | libc="uclibc" | 6 | LIBC="glibc" |
| 7 | LIBC="uclibc" | ||
| 8 | fi | ||
| 7 | # x86 32-bit: | 9 | # x86 32-bit: |
| 8 | uclibc_cross="i486-linux-uclibc-" | 10 | #CROSS_COMPILER_PREFIX="i486-linux-uclibc-" |
| 9 | # My system has strange prefix for x86 64-bit uclibc: | 11 | # My system has strange prefix for x86 64-bit uclibc: |
| 10 | #uclibc_cross="x86_64-pc-linux-gnu-" | 12 | #CROSS_COMPILER_PREFIX="x86_64-pc-linux-gnu-" |
| 11 | 13 | ||
| 12 | test -d tree || exit 1 | 14 | if test $# -lt 2 || ! test -d "$1" || test -e "$2"; then |
| 15 | echo "Usage: $0 SRC_DIR TMP_DIR" | ||
| 16 | echo | ||
| 17 | echo "SRC_DIR will be copied to TMP_DIR directory." | ||
| 18 | echo "Then a random build will be performed." | ||
| 19 | echo | ||
| 20 | echo "Useful variables:" | ||
| 21 | echo "\$LIBC, \$CROSS_COMPILER_PREFIX, \$MAKEOPTS" | ||
| 22 | exit 1 | ||
| 23 | fi | ||
| 13 | 24 | ||
| 14 | dir=test.$$ | 25 | cp -dpr -- "$1" "$2" || { echo "copy error"; exit 1; } |
| 15 | while test -e "$dir" -o -e failed."$dir"; do | 26 | cd -- "$2" || { echo "cd $dir error"; exit 1; } |
| 16 | dir=test."$RANDOM" | ||
| 17 | done | ||
| 18 | 27 | ||
| 19 | cp -dpr tree "$dir" || exit 1 | 28 | # Generate random config |
| 20 | cd "$dir" || exit 1 | 29 | make randconfig >/dev/null || { echo "randconfig error"; exit 1; } |
| 21 | |||
| 22 | echo "Running randconfig test in $dir..." >&2 | ||
| 23 | |||
| 24 | make randconfig >/dev/null || exit 1 | ||
| 25 | 30 | ||
| 31 | # Tweak resulting config | ||
| 26 | cat .config \ | 32 | cat .config \ |
| 27 | | grep -v ^CONFIG_DEBUG_PESSIMIZE= \ | 33 | | grep -v CONFIG_DEBUG_PESSIMIZE \ |
| 28 | | grep -v CONFIG_WERROR \ | 34 | | grep -v CONFIG_WERROR \ |
| 29 | | cat >.config.new | 35 | | grep -v CONFIG_CROSS_COMPILER_PREFIX \ |
| 30 | mv .config.new .config | ||
| 31 | #echo CONFIG_WERROR=y >>.config | ||
| 32 | echo '# CONFIG_WERROR is not set' >>.config | ||
| 33 | |||
| 34 | test "$libc" = glibc && { | ||
| 35 | cat .config \ | ||
| 36 | | grep -v CONFIG_STATIC \ | ||
| 37 | | grep -v CONFIG_SELINUX \ | 36 | | grep -v CONFIG_SELINUX \ |
| 38 | | grep -v CONFIG_EFENCE \ | 37 | | grep -v CONFIG_EFENCE \ |
| 39 | | grep -v CONFIG_DMALLOC \ | 38 | | grep -v CONFIG_DMALLOC \ |
| 40 | | cat >.config.new | 39 | \ |
| 40 | | grep -v CONFIG_RFKILL \ | ||
| 41 | >.config.new | ||
| 41 | mv .config.new .config | 42 | mv .config.new .config |
| 42 | echo '# CONFIG_STATIC is not set' >>.config | 43 | echo '# CONFIG_DEBUG_PESSIMIZE is not set' >>.config |
| 43 | } | 44 | echo '# CONFIG_WERROR is not set' >>.config |
| 45 | echo "CONFIG_CROSS_COMPILER_PREFIX=\"${CROSS_COMPILER_PREFIX}\"" >>.config | ||
| 44 | 46 | ||
| 45 | test "$libc" = uclibc && { | 47 | # If glibc, don't build static |
| 46 | cat .config \ | 48 | if test x"$LIBC" = x"glibc"; then |
| 47 | | grep -v ^CONFIG_SELINUX= \ | 49 | cat .config \ |
| 48 | | grep -v ^CONFIG_EFENCE= \ | 50 | | grep -v CONFIG_STATIC \ |
| 49 | | grep -v ^CONFIG_DMALLOC= \ | 51 | >.config.new |
| 50 | | grep -v ^CONFIG_BUILD_LIBBUSYBOX= \ | 52 | mv .config.new .config |
| 51 | | grep -v ^CONFIG_PAM= \ | 53 | echo '# CONFIG_STATIC is not set' >>.config |
| 52 | | grep -v ^CONFIG_TASKSET= \ | 54 | fi |
| 53 | | grep -v ^CONFIG_UNICODE_SUPPORT= \ | 55 | |
| 54 | | grep -v ^CONFIG_PIE= \ | 56 | # If glibc, build static, and remove some things |
| 55 | | grep -v CONFIG_STATIC \ | 57 | # likely to not work on uclibc. |
| 56 | | grep -v CONFIG_CROSS_COMPILER_PREFIX \ | 58 | if test x"$LIBC" = x"uclibc"; then |
| 57 | | cat >.config.new | 59 | cat .config \ |
| 58 | mv .config.new .config | 60 | | grep -v CONFIG_STATIC \ |
| 59 | echo 'CONFIG_CROSS_COMPILER_PREFIX="'"$uclibc_cross"'"' >>.config | 61 | | grep -v CONFIG_BUILD_LIBBUSYBOX \ |
| 60 | echo 'CONFIG_STATIC=y' >>.config | 62 | | grep -v CONFIG_TASKSET \ |
| 61 | } | 63 | | grep -v CONFIG_UNICODE_SUPPORT \ |
| 64 | | grep -v CONFIG_PIE \ | ||
| 65 | >.config.new | ||
| 66 | mv .config.new .config | ||
| 67 | echo 'CONFIG_STATIC=y' >>.config | ||
| 68 | fi | ||
| 62 | 69 | ||
| 63 | # If STATIC, remove some things | 70 | # If STATIC, remove some things. |
| 64 | # PAM with static linking is probably pointless | 71 | # PAM with static linking is probably pointless |
| 65 | # (but I need to try - now I don't have libpam.a on my system, only libpam.so) | 72 | # (but I need to try - now I don't have libpam.a on my system, only libpam.so) |
| 66 | grep -q ^CONFIG_STATIC= .config && { | 73 | if grep -q "^CONFIG_STATIC=y" .config; then |
| 67 | cat .config \ | 74 | cat .config \ |
| 68 | | grep -v ^CONFIG_PAM= \ | 75 | | grep -v CONFIG_PAM \ |
| 69 | | cat >.config.new | 76 | >.config.new |
| 70 | mv .config.new .config | 77 | mv .config.new .config |
| 71 | } | 78 | fi |
| 72 | 79 | ||
| 73 | # Regenerate .config with default answers for yanked-off options | 80 | # Regenerate .config with default answers for yanked-off options |
| 74 | { yes "" | make oldconfig >/dev/null; } || exit 1 | 81 | # (most of default answers are "no"). |
| 75 | 82 | { yes "" | make oldconfig >/dev/null; } || { echo "oldconfig error"; exit 1; } | |
| 76 | nice -n 10 make $MAKEOPTS 2>&1 | tee -a make.log | ||
| 77 | 83 | ||
| 78 | test -x busybox && { | 84 | # Build! |
| 79 | cd .. | 85 | nice -n 10 make $MAKEOPTS 2>&1 | tee make.log |
| 80 | rm -rf "$dir" | ||
| 81 | exit 0 | ||
| 82 | } | ||
| 83 | 86 | ||
| 84 | cd .. | 87 | # Return exitcode 1 if busybox executable does not exist |
| 85 | mv "$dir" "failed.$dir" | 88 | test -x busybox |
| 86 | exit 1 | ||
diff --git a/scripts/randomtest.loop b/scripts/randomtest.loop index 28edb6732..311536df8 100755 --- a/scripts/randomtest.loop +++ b/scripts/randomtest.loop | |||
| @@ -1,10 +1,38 @@ | |||
| 1 | #!/bin/sh | 1 | #!/bin/sh |
| 2 | 2 | ||
| 3 | test -d "$1" || { echo "'$1' is not a directory"; exit 1; } | ||
| 4 | test -x "$1/scripts/randomtest" || { echo "No scripts/randomtest in '$1'"; exit 1; } | ||
| 5 | |||
| 6 | export LIBC="uclibc" | ||
| 7 | export CROSS_COMPILER_PREFIX="i486-linux-uclibc-" | ||
| 8 | export MAKEOPTS="-j9" | ||
| 9 | |||
| 3 | cnt=0 | 10 | cnt=0 |
| 4 | fail=0 | 11 | fail=0 |
| 5 | |||
| 6 | while sleep 1; do | 12 | while sleep 1; do |
| 7 | echo "Passes: $cnt Failures: $fail" | 13 | echo "Passes: $cnt Failures: $fail" |
| 8 | ./randomtest >/dev/null || exit #let fail++ | 14 | dir="test.$$" |
| 9 | let cnt++ | 15 | while test -e "$dir" -o -e "failed.$dir"; do |
| 16 | dir="test.$$.$RANDOM" | ||
| 17 | done | ||
| 18 | echo "Running randconfig test in $dir..." | ||
| 19 | if ! "$1/scripts/randomtest" "$1" "$dir" >/dev/null; then | ||
| 20 | mv -- "$dir" "failed.$dir" | ||
| 21 | echo "Failed build in: failed.$dir" | ||
| 22 | exit 1 # you may comment this out... | ||
| 23 | let fail++ | ||
| 24 | else | ||
| 25 | ( | ||
| 26 | cd -- "$dir/testsuite" || exit 1 | ||
| 27 | echo "Running testsuite in $dir..." | ||
| 28 | SKIP_KNOWN_BUGS=1 SKIP_INTERNET_TESTS=1 ./runtest -v >runtest.log 2>&1 | ||
| 29 | ) | ||
| 30 | if test $? != 0; then | ||
| 31 | echo "Failed runtest in $dir" | ||
| 32 | exit 1 | ||
| 33 | fi | ||
| 34 | tail -n10 -- "$dir/testsuite/runtest.log" | ||
| 35 | rm -rf -- "$dir" | ||
| 36 | fi | ||
| 37 | let cnt++ | ||
| 10 | done | 38 | done |
diff --git a/testsuite/ash.tests b/testsuite/ash.tests index ce585beb1..183394a20 100755 --- a/testsuite/ash.tests +++ b/testsuite/ash.tests | |||
| @@ -9,6 +9,10 @@ | |||
| 9 | 9 | ||
| 10 | test -f "$bindir/.config" && . "$bindir/.config" | 10 | test -f "$bindir/.config" && . "$bindir/.config" |
| 11 | 11 | ||
| 12 | test x"CONFIG_SCRIPT" = x"y" || exit 0 | ||
| 13 | test x"CONFIG_HEXDUMP" = x"y" || exit 0 | ||
| 14 | test x"CONFIG_FEATURE_DEVPTS" = x"y" || exit 0 | ||
| 15 | |||
| 12 | # testing "test name" "options" "expected result" "file input" "stdin" | 16 | # testing "test name" "options" "expected result" "file input" "stdin" |
| 13 | 17 | ||
| 14 | if test x"$CONFIG_UNICODE_PRESERVE_BROKEN" = x"y"; then | 18 | if test x"$CONFIG_UNICODE_PRESERVE_BROKEN" = x"y"; then |
diff --git a/testsuite/cpio.tests b/testsuite/cpio.tests index 325664d71..2b8f0d030 100755 --- a/testsuite/cpio.tests +++ b/testsuite/cpio.tests | |||
| @@ -69,6 +69,7 @@ ln cpio.testdir/empty cpio.testdir/empty1 | |||
| 69 | ln cpio.testdir/nonempty cpio.testdir/nonempty1 | 69 | ln cpio.testdir/nonempty cpio.testdir/nonempty1 |
| 70 | mkdir cpio.testdir2 | 70 | mkdir cpio.testdir2 |
| 71 | 71 | ||
| 72 | optional FEATURE_CPIO_O | ||
| 72 | testing "cpio extracts zero-sized hardlinks 2" \ | 73 | testing "cpio extracts zero-sized hardlinks 2" \ |
| 73 | "find cpio.testdir | cpio -H newc --create | (cd cpio.testdir2 && cpio -i 2>&1); echo \$?; | 74 | "find cpio.testdir | cpio -H newc --create | (cd cpio.testdir2 && cpio -i 2>&1); echo \$?; |
| 74 | ls -ln cpio.testdir2/cpio.testdir | $FILTER_LS" \ | 75 | ls -ln cpio.testdir2/cpio.testdir | $FILTER_LS" \ |
| @@ -82,10 +83,12 @@ ls -ln cpio.testdir2/cpio.testdir | $FILTER_LS" \ | |||
| 82 | -rw-r--r-- 1 $user $group 0 solo | 83 | -rw-r--r-- 1 $user $group 0 solo |
| 83 | " \ | 84 | " \ |
| 84 | "" "" | 85 | "" "" |
| 86 | SKIP= | ||
| 85 | 87 | ||
| 86 | 88 | ||
| 87 | # Was trying to create "/usr/bin", correct is "usr/bin". | 89 | # Was trying to create "/usr/bin", correct is "usr/bin". |
| 88 | rm -rf cpio.testdir | 90 | rm -rf cpio.testdir |
| 91 | optional FEATURE_CPIO_P | ||
| 89 | testing "cpio -p with absolute paths" \ | 92 | testing "cpio -p with absolute paths" \ |
| 90 | "echo /usr/bin | cpio -dp cpio.testdir 2>&1; echo \$?; | 93 | "echo /usr/bin | cpio -dp cpio.testdir 2>&1; echo \$?; |
| 91 | ls cpio.testdir" \ | 94 | ls cpio.testdir" \ |
| @@ -95,6 +98,7 @@ ls cpio.testdir" \ | |||
| 95 | usr | 98 | usr |
| 96 | " \ | 99 | " \ |
| 97 | "" "" | 100 | "" "" |
| 101 | SKIP= | ||
| 98 | 102 | ||
| 99 | 103 | ||
| 100 | # Clean up | 104 | # Clean up |
