more randomconfig testsuite fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
diff --git a/scripts/gen_build_files.sh b/scripts/gen_build_files.sh
index 3d75750..2baefa2 100755
--- a/scripts/gen_build_files.sh
+++ b/scripts/gen_build_files.sh
@@ -3,52 +3,52 @@
test $# -ge 2 || { echo "Syntax: $0 SRCTREE OBJTREE"; exit 1; }
# cd to objtree
-cd "$2" || { echo "Syntax: $0 SRCTREE OBJTREE"; exit 1; }
+cd -- "$2" || { echo "Syntax: $0 SRCTREE OBJTREE"; exit 1; }
srctree="$1"
find -type d | while read; do
- d="$REPLY"
+ d="$REPLY"
- src="$srctree/$d/Kbuild.src"
- dst="$d/Kbuild"
- if test -f "$src"; then
- echo " CHK $dst"
+ src="$srctree/$d/Kbuild.src"
+ dst="$d/Kbuild"
+ if test -f "$src"; then
+ echo " CHK $dst"
- s=`sed -n 's@^//kbuild:@@p' "$srctree/$d"/*.c`
- echo "# DO NOT EDIT. This file is generated from Kbuild.src" >"$dst.$$.tmp"
- while read; do
- test x"$REPLY" = x"INSERT" && REPLY="$s"
- printf "%s\n" "$REPLY"
- done <"$src" >>"$dst.$$.tmp"
+ s=`sed -n 's@^//kbuild:@@p' -- "$srctree/$d"/*.c`
+ echo "# DO NOT EDIT. This file is generated from Kbuild.src" >"$dst.$$.tmp"
+ while read; do
+ test x"$REPLY" = x"INSERT" && REPLY="$s"
+ printf "%s\n" "$REPLY"
+ done <"$src" >>"$dst.$$.tmp"
- if test -f "$dst" && cmp -s "$dst.$$.tmp" "$dst"; then
- rm "$dst.$$.tmp"
- else
- echo " GEN $dst"
- mv "$dst.$$.tmp" "$dst"
+ if test -f "$dst" && cmp -s "$dst.$$.tmp" "$dst"; then
+ rm -- "$dst.$$.tmp"
+ else
+ echo " GEN $dst"
+ mv -- "$dst.$$.tmp" "$dst"
+ fi
fi
- fi
- src="$srctree/$d/Config.src"
- dst="$d/Config.in"
- if test -f "$src"; then
- echo " CHK $dst"
+ src="$srctree/$d/Config.src"
+ dst="$d/Config.in"
+ if test -f "$src"; then
+ echo " CHK $dst"
- s=`sed -n 's@^//config:@@p' "$srctree/$d"/*.c`
- echo "# DO NOT EDIT. This file is generated from Config.src" >"$dst.$$.tmp"
- while read; do
- test x"$REPLY" = x"INSERT" && REPLY="$s"
- printf "%s\n" "$REPLY"
- done <"$src" >>"$dst.$$.tmp"
+ s=`sed -n 's@^//config:@@p' -- "$srctree/$d"/*.c`
+ echo "# DO NOT EDIT. This file is generated from Config.src" >"$dst.$$.tmp"
+ while read; do
+ test x"$REPLY" = x"INSERT" && REPLY="$s"
+ printf "%s\n" "$REPLY"
+ done <"$src" >>"$dst.$$.tmp"
- if test -f "$dst" && cmp -s "$dst.$$.tmp" "$dst"; then
- rm "$dst.$$.tmp"
- else
- echo " GEN $dst"
- mv "$dst.$$.tmp" "$dst"
+ if test -f "$dst" && cmp -s "$dst.$$.tmp" "$dst"; then
+ rm -- "$dst.$$.tmp"
+ else
+ echo " GEN $dst"
+ mv -- "$dst.$$.tmp" "$dst"
+ fi
fi
- fi
done
diff --git a/testsuite/awk.tests b/testsuite/awk.tests
index 5dea2e9..efa03a7 100755
--- a/testsuite/awk.tests
+++ b/testsuite/awk.tests
@@ -33,7 +33,7 @@
testing "awk gsub falls back to non-extended-regex" \
"awk 'gsub(\"@(samp|code|file)\{\",\"\");'; echo \$?" "0\n" "" "Hi\n"
-optional FEATURE_SEAMLESS_BZ2
+optional TAR BUNZIP2 FEATURE_SEAMLESS_BZ2
test x"$SKIP" != x"1" && tar xjf awk_t1.tar.bz2
testing "awk 'gcc build bug'" \
"awk -f awk_t1_opt-functions.awk -f awk_t1_opth-gen.awk <awk_t1_input | md5sum" \
diff --git a/testsuite/cpio.tests b/testsuite/cpio.tests
index 2b8f0d0..b4c41dd 100755
--- a/testsuite/cpio.tests
+++ b/testsuite/cpio.tests
@@ -69,7 +69,7 @@
ln cpio.testdir/nonempty cpio.testdir/nonempty1
mkdir cpio.testdir2
-optional FEATURE_CPIO_O
+optional FEATURE_CPIO_O LONG_OPTS
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" \
diff --git a/testsuite/makedevs.tests b/testsuite/makedevs.tests
index 5d6b0f2..72fc933 100755
--- a/testsuite/makedevs.tests
+++ b/testsuite/makedevs.tests
@@ -16,7 +16,7 @@
rm -rf makedevs.testdir
mkdir makedevs.testdir
-optional FEATURE_LS_RECURSIVE
+optional FEATURE_MAKEDEVS_TABLE FEATURE_FIND_NOT FEATURE_FIND_TYPE FEATURE_LS_RECURSIVE
testing "makedevs -d ../makedevs.device_table.txt ." \
"(cd makedevs.testdir && makedevs -d ../makedevs.device_table.txt . 2>&1);
find makedevs.testdir ! -type d | sort | xargs ls -lnR | $FILTER_LS" \
diff --git a/testsuite/mdev.tests b/testsuite/mdev.tests
index a21d9bd..270f629 100755
--- a/testsuite/mdev.tests
+++ b/testsuite/mdev.tests
@@ -27,6 +27,7 @@
# env - PATH=$PATH: on some systems chroot binary won't otherwise be found
+optional STATIC
testing "mdev add /block/sda" \
"env - PATH=$PATH ACTION=add DEVPATH=/block/sda chroot mdev.testdir /mdev 2>&1;
ls -ln mdev.testdir/dev | $FILTER_LS" \
@@ -34,11 +35,13 @@
brw-rw---- 1 0 0 8,0 sda
" \
"" ""
+SKIP=
# continuing to use directory structure from prev test
rm -rf mdev.testdir/dev/*
echo ".* 1:1 666" >mdev.testdir/etc/mdev.conf
echo "sda 2:2 444" >>mdev.testdir/etc/mdev.conf
+optional STATIC FEATURE_MDEV_CONF
testing "mdev stops on first rule" \
"env - PATH=$PATH ACTION=add DEVPATH=/block/sda chroot mdev.testdir /mdev 2>&1;
ls -ln mdev.testdir/dev | $FILTER_LS" \
@@ -46,11 +49,13 @@
brw-rw-rw- 1 1 1 8,0 sda
" \
"" ""
+SKIP=
# continuing to use directory structure from prev test
rm -rf mdev.testdir/dev/*
echo "-.* 1:1 666" >mdev.testdir/etc/mdev.conf
echo "sda 2:2 444" >>mdev.testdir/etc/mdev.conf
+optional STATIC FEATURE_MDEV_CONF
testing "mdev does not stop on dash-rule" \
"env - PATH=$PATH ACTION=add DEVPATH=/block/sda chroot mdev.testdir /mdev 2>&1;
ls -ln mdev.testdir/dev | $FILTER_LS" \
@@ -58,12 +63,14 @@
br--r--r-- 1 2 2 8,0 sda
" \
"" ""
+SKIP=
# continuing to use directory structure from prev test
rm -rf mdev.testdir/dev/*
echo "\$MODALIAS=qw 1:1 666" >mdev.testdir/etc/mdev.conf
echo "\$MODALIAS=qw. 2:2 444" >>mdev.testdir/etc/mdev.conf
echo "\$MODALIAS=qw. 3:3 400" >>mdev.testdir/etc/mdev.conf
+optional STATIC FEATURE_MDEV_CONF
testing "mdev \$ENVVAR=regex match" \
"env - PATH=$PATH ACTION=add DEVPATH=/block/sda MODALIAS=qwe chroot mdev.testdir /mdev 2>&1;
ls -ln mdev.testdir/dev | $FILTER_LS" \
@@ -71,11 +78,12 @@
br--r--r-- 1 2 2 8,0 sda
" \
"" ""
+SKIP=
# continuing to use directory structure from prev test
rm -rf mdev.testdir/dev/*
echo "sda 0:0 444 >disk/scsiA" >mdev.testdir/etc/mdev.conf
-optional FEATURE_LS_RECURSIVE
+optional STATIC FEATURE_MDEV_CONF FEATURE_MDEV_RENAME FEATURE_LS_RECURSIVE
testing "mdev move/symlink rule '>bar/baz'" \
"env - PATH=$PATH ACTION=add DEVPATH=/block/sda chroot mdev.testdir /mdev 2>&1;
ls -lnR mdev.testdir/dev | $FILTER_LS2" \
@@ -93,7 +101,7 @@
# continuing to use directory structure from prev test
rm -rf mdev.testdir/dev/*
echo "sda 0:0 444 >disk/" >mdev.testdir/etc/mdev.conf
-optional FEATURE_LS_RECURSIVE
+optional STATIC FEATURE_MDEV_CONF FEATURE_MDEV_RENAME FEATURE_LS_RECURSIVE
testing "mdev move/symlink rule '>bar/'" \
"env - PATH=$PATH ACTION=add DEVPATH=/block/sda chroot mdev.testdir /mdev 2>&1;
ls -lnR mdev.testdir/dev | $FILTER_LS2" \
@@ -112,7 +120,7 @@
rm -rf mdev.testdir/dev/*
# here we complicate things by having non-matching group 1 and using %0
echo "s([0-9])*d([a-z]+) 0:0 644 >sd/%2_%0" >mdev.testdir/etc/mdev.conf
-optional FEATURE_LS_RECURSIVE
+optional STATIC FEATURE_MDEV_CONF FEATURE_MDEV_RENAME FEATURE_MDEV_RENAME_REGEXP FEATURE_LS_RECURSIVE
testing "mdev regexp substring match + replace" \
"env - PATH=$PATH ACTION=add DEVPATH=/block/sda chroot mdev.testdir /mdev 2>&1;
ls -lnR mdev.testdir/dev | $FILTER_LS2" \
@@ -130,7 +138,7 @@
# continuing to use directory structure from prev test
rm -rf mdev.testdir/dev/*
echo "sda 0:0 644 @echo @echo TEST" >mdev.testdir/etc/mdev.conf
-optional FEATURE_LS_RECURSIVE
+optional STATIC FEATURE_MDEV_CONF FEATURE_MDEV_EXEC FEATURE_LS_RECURSIVE
testing "mdev command" \
"env - PATH=$PATH ACTION=add DEVPATH=/block/sda chroot mdev.testdir /mdev 2>&1;
ls -lnR mdev.testdir/dev | $FILTER_LS" \
@@ -145,7 +153,7 @@
# continuing to use directory structure from prev test
rm -rf mdev.testdir/dev/*
echo "sda 0:0 644 =block/ @echo @echo TEST:\$MDEV" >mdev.testdir/etc/mdev.conf
-optional FEATURE_LS_RECURSIVE
+optional STATIC FEATURE_MDEV_CONF FEATURE_MDEV_RENAME FEATURE_MDEV_EXEC FEATURE_LS_RECURSIVE
testing "mdev move and command" \
"env - PATH=$PATH ACTION=add DEVPATH=/block/sda chroot mdev.testdir /mdev 2>&1;
ls -lnR mdev.testdir/dev | $FILTER_LS2" \
@@ -163,7 +171,7 @@
# continuing to use directory structure from prev test
rm -rf mdev.testdir/dev/*
echo "@8,0 0:1 644" >mdev.testdir/etc/mdev.conf
-optional FEATURE_LS_RECURSIVE
+optional STATIC FEATURE_MDEV_CONF FEATURE_MDEV_RENAME FEATURE_MDEV_RENAME_REGEXP FEATURE_LS_RECURSIVE
testing "mdev #maj,min and no explicit uid" \
"env - PATH=$PATH ACTION=add DEVPATH=/block/sda chroot mdev.testdir /mdev 2>&1;
ls -lnR mdev.testdir/dev | $FILTER_LS" \
@@ -186,7 +194,7 @@
echo "capi([0-9]) 0:0 0660 =capi20.0%1" >>mdev.testdir/etc/mdev.conf
echo "capi([0-9]*) 0:0 0660 =capi20.%1" >>mdev.testdir/etc/mdev.conf
# mdev invocation with DEVPATH=/class/tty/capi20 was deleting /dev/capi20
-optional FEATURE_LS_RECURSIVE
+optional STATIC FEATURE_MDEV_CONF FEATURE_MDEV_RENAME FEATURE_MDEV_RENAME_REGEXP FEATURE_LS_RECURSIVE
testing "move rule does not delete node with name == device_name" \
"\
env - PATH=$PATH ACTION=add DEVPATH=/class/tty/capi chroot mdev.testdir /mdev 2>&1;
diff --git a/testsuite/testing.sh b/testsuite/testing.sh
index 22c640f..65a0f65 100755
--- a/testsuite/testing.sh
+++ b/testsuite/testing.sh
@@ -54,14 +54,14 @@
optional()
{
- option=`echo ":$OPTIONFLAGS:" | grep ":$1:"`
- # Not set?
- if [ -z "$1" ] || [ -z "$OPTIONFLAGS" ] || [ ${#option} -ne 0 ]
- then
- SKIP=
- return
- fi
- SKIP=1
+ SKIP=
+ while test "$1"; do
+ if test x"${OPTIONFLAGS/*:$1:*/y}" != x"y"; then
+ SKIP=1
+ return
+ fi
+ shift
+ done
}
# The testing function