diff options
-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 2698f07..e0ca7fa 100644 --- a/archival/cpio.c +++ b/archival/cpio.c @@ -311,6 +311,7 @@ int cpio_main(int argc UNUSED_PARAM, char **argv) /* no parameters */ opt_complementary = "=0"; opt = getopt32(argv, OPTION_STR, &cpio_filename); + argv += optind; if (opt & CPIO_OPT_FILE) { /* -F */ xmove_fd(xopen(cpio_filename, O_RDONLY), STDIN_FILENO); } diff --git a/coreutils/Kbuild b/coreutils/Kbuild index 460d62d..ee22a3f 100644 --- a/coreutils/Kbuild +++ b/coreutils/Kbuild @@ -17,6 +17,7 @@ lib-$(CONFIG_CATV) += catv.o lib-$(CONFIG_CHGRP) += chgrp.o chown.o lib-$(CONFIG_CHMOD) += chmod.o lib-$(CONFIG_CHOWN) += chown.o +lib-$(CONFIG_ADDUSER) += chown.o # used by adduser lib-$(CONFIG_ADDGROUP) += chown.o # used by adduser lib-$(CONFIG_CHROOT) += chroot.o lib-$(CONFIG_CKSUM) += cksum.o diff --git a/networking/telnetd.c b/networking/telnetd.c index a8c86b6..ea66a25 100644 --- a/networking/telnetd.c +++ b/networking/telnetd.c @@ -227,7 +227,7 @@ make_new_session( IF_NOT_FEATURE_TELNETD_STANDALONE(void) ) { #if !ENABLE_FEATURE_TELNETD_STANDALONE - enum { sock = 0 ); + enum { sock = 0 }; #endif const char *login_argv[2]; struct termios termbuf; diff --git a/scripts/randomtest b/scripts/randomtest index 6b7db92..8d0d79e 100755 --- a/scripts/randomtest +++ b/scripts/randomtest @@ -1,86 +1,88 @@ #!/bin/sh -# Select which libc to build against -libc="glibc" # assumed native -# static, cross-compilation -libc="uclibc" +# If not specified in environment... +if ! test "$LIBC"; then + # Select which libc to build against + LIBC="glibc" + LIBC="uclibc" +fi # x86 32-bit: -uclibc_cross="i486-linux-uclibc-" +#CROSS_COMPILER_PREFIX="i486-linux-uclibc-" # My system has strange prefix for x86 64-bit uclibc: -#uclibc_cross="x86_64-pc-linux-gnu-" +#CROSS_COMPILER_PREFIX="x86_64-pc-linux-gnu-" -test -d tree || exit 1 +if test $# -lt 2 || ! test -d "$1" || test -e "$2"; then + echo "Usage: $0 SRC_DIR TMP_DIR" + echo + echo "SRC_DIR will be copied to TMP_DIR directory." + echo "Then a random build will be performed." + echo + echo "Useful variables:" + echo "\$LIBC, \$CROSS_COMPILER_PREFIX, \$MAKEOPTS" + exit 1 +fi -dir=test.$$ -while test -e "$dir" -o -e failed."$dir"; do - dir=test."$RANDOM" -done +cp -dpr -- "$1" "$2" || { echo "copy error"; exit 1; } +cd -- "$2" || { echo "cd $dir error"; exit 1; } -cp -dpr tree "$dir" || exit 1 -cd "$dir" || exit 1 - -echo "Running randconfig test in $dir..." >&2 - -make randconfig >/dev/null || exit 1 +# Generate random config +make randconfig >/dev/null || { echo "randconfig error"; exit 1; } +# Tweak resulting config cat .config \ -| grep -v ^CONFIG_DEBUG_PESSIMIZE= \ +| grep -v CONFIG_DEBUG_PESSIMIZE \ | grep -v CONFIG_WERROR \ -| cat >.config.new -mv .config.new .config -#echo CONFIG_WERROR=y >>.config -echo '# CONFIG_WERROR is not set' >>.config - -test "$libc" = glibc && { -cat .config \ -| grep -v CONFIG_STATIC \ +| grep -v CONFIG_CROSS_COMPILER_PREFIX \ | grep -v CONFIG_SELINUX \ | grep -v CONFIG_EFENCE \ | grep -v CONFIG_DMALLOC \ -| cat >.config.new +\ +| grep -v CONFIG_RFKILL \ +>.config.new mv .config.new .config -echo '# CONFIG_STATIC is not set' >>.config -} +echo '# CONFIG_DEBUG_PESSIMIZE is not set' >>.config +echo '# CONFIG_WERROR is not set' >>.config +echo "CONFIG_CROSS_COMPILER_PREFIX=\"${CROSS_COMPILER_PREFIX}\"" >>.config -test "$libc" = uclibc && { -cat .config \ -| grep -v ^CONFIG_SELINUX= \ -| grep -v ^CONFIG_EFENCE= \ -| grep -v ^CONFIG_DMALLOC= \ -| grep -v ^CONFIG_BUILD_LIBBUSYBOX= \ -| grep -v ^CONFIG_PAM= \ -| grep -v ^CONFIG_TASKSET= \ -| grep -v ^CONFIG_UNICODE_SUPPORT= \ -| grep -v ^CONFIG_PIE= \ -| grep -v CONFIG_STATIC \ -| grep -v CONFIG_CROSS_COMPILER_PREFIX \ -| cat >.config.new -mv .config.new .config -echo 'CONFIG_CROSS_COMPILER_PREFIX="'"$uclibc_cross"'"' >>.config -echo 'CONFIG_STATIC=y' >>.config -} +# If glibc, don't build static +if test x"$LIBC" = x"glibc"; then + cat .config \ + | grep -v CONFIG_STATIC \ + >.config.new + mv .config.new .config + echo '# CONFIG_STATIC is not set' >>.config +fi + +# If glibc, build static, and remove some things +# likely to not work on uclibc. +if test x"$LIBC" = x"uclibc"; then + cat .config \ + | grep -v CONFIG_STATIC \ + | grep -v CONFIG_BUILD_LIBBUSYBOX \ + | grep -v CONFIG_TASKSET \ + | grep -v CONFIG_UNICODE_SUPPORT \ + | grep -v CONFIG_PIE \ + >.config.new + mv .config.new .config + echo 'CONFIG_STATIC=y' >>.config +fi -# If STATIC, remove some things +# If STATIC, remove some things. # PAM with static linking is probably pointless # (but I need to try - now I don't have libpam.a on my system, only libpam.so) -grep -q ^CONFIG_STATIC= .config && { -cat .config \ -| grep -v ^CONFIG_PAM= \ -| cat >.config.new -mv .config.new .config -} +if grep -q "^CONFIG_STATIC=y" .config; then + cat .config \ + | grep -v CONFIG_PAM \ + >.config.new + mv .config.new .config +fi # Regenerate .config with default answers for yanked-off options -{ yes "" | make oldconfig >/dev/null; } || exit 1 - -nice -n 10 make $MAKEOPTS 2>&1 | tee -a make.log +# (most of default answers are "no"). +{ yes "" | make oldconfig >/dev/null; } || { echo "oldconfig error"; exit 1; } -test -x busybox && { - cd .. - rm -rf "$dir" - exit 0 -} +# Build! +nice -n 10 make $MAKEOPTS 2>&1 | tee make.log -cd .. -mv "$dir" "failed.$dir" -exit 1 +# Return exitcode 1 if busybox executable does not exist +test -x busybox diff --git a/scripts/randomtest.loop b/scripts/randomtest.loop index 28edb67..311536d 100755 --- a/scripts/randomtest.loop +++ b/scripts/randomtest.loop @@ -1,10 +1,38 @@ #!/bin/sh +test -d "$1" || { echo "'$1' is not a directory"; exit 1; } +test -x "$1/scripts/randomtest" || { echo "No scripts/randomtest in '$1'"; exit 1; } + +export LIBC="uclibc" +export CROSS_COMPILER_PREFIX="i486-linux-uclibc-" +export MAKEOPTS="-j9" + cnt=0 fail=0 - while sleep 1; do - echo "Passes: $cnt Failures: $fail" - ./randomtest >/dev/null || exit #let fail++ - let cnt++ + echo "Passes: $cnt Failures: $fail" + dir="test.$$" + while test -e "$dir" -o -e "failed.$dir"; do + dir="test.$$.$RANDOM" + done + echo "Running randconfig test in $dir..." + if ! "$1/scripts/randomtest" "$1" "$dir" >/dev/null; then + mv -- "$dir" "failed.$dir" + echo "Failed build in: failed.$dir" + exit 1 # you may comment this out... + let fail++ + else + ( + cd -- "$dir/testsuite" || exit 1 + echo "Running testsuite in $dir..." + SKIP_KNOWN_BUGS=1 SKIP_INTERNET_TESTS=1 ./runtest -v >runtest.log 2>&1 + ) + if test $? != 0; then + echo "Failed runtest in $dir" + exit 1 + fi + tail -n10 -- "$dir/testsuite/runtest.log" + rm -rf -- "$dir" + fi + let cnt++ done diff --git a/testsuite/ash.tests b/testsuite/ash.tests index ce585be..183394a 100755 --- a/testsuite/ash.tests +++ b/testsuite/ash.tests @@ -9,6 +9,10 @@ test -f "$bindir/.config" && . "$bindir/.config" +test x"CONFIG_SCRIPT" = x"y" || exit 0 +test x"CONFIG_HEXDUMP" = x"y" || exit 0 +test x"CONFIG_FEATURE_DEVPTS" = x"y" || exit 0 + # testing "test name" "options" "expected result" "file input" "stdin" if test x"$CONFIG_UNICODE_PRESERVE_BROKEN" = x"y"; then diff --git a/testsuite/cpio.tests b/testsuite/cpio.tests index 325664d..2b8f0d0 100755 --- a/testsuite/cpio.tests +++ b/testsuite/cpio.tests @@ -69,6 +69,7 @@ ln cpio.testdir/empty cpio.testdir/empty1 ln cpio.testdir/nonempty cpio.testdir/nonempty1 mkdir cpio.testdir2 +optional FEATURE_CPIO_O testing "cpio extracts zero-sized hardlinks 2" \ "find cpio.testdir | cpio -H newc --create | (cd cpio.testdir2 && cpio -i 2>&1); echo \$?; ls -ln cpio.testdir2/cpio.testdir | $FILTER_LS" \ @@ -82,10 +83,12 @@ ls -ln cpio.testdir2/cpio.testdir | $FILTER_LS" \ -rw-r--r-- 1 $user $group 0 solo " \ "" "" +SKIP= # Was trying to create "/usr/bin", correct is "usr/bin". rm -rf cpio.testdir +optional FEATURE_CPIO_P testing "cpio -p with absolute paths" \ "echo /usr/bin | cpio -dp cpio.testdir 2>&1; echo \$?; ls cpio.testdir" \ @@ -95,6 +98,7 @@ ls cpio.testdir" \ usr " \ "" "" +SKIP= # Clean up |