aboutsummaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2017-08-05 13:45:22 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2017-08-05 13:45:22 +0200
commit9cf89cdf84fb20154088145980b676d2b28fc55d (patch)
tree436a0d02edc588782ca00796e14469288c3baa8d /testsuite
parentfeb79e8742eb3cef211804dadcc7f3ddfd154c72 (diff)
downloadbusybox-9cf89cdf84fb20154088145980b676d2b28fc55d.tar.gz
sysctl: fix file parsing, do not require -w for VAR=VAL
function old new delta sysctl_act_on_setting - 451 +451 sysctl_main 222 282 +60 packed_usage 31744 31793 +49 config_read 604 639 +35 sysctl_act_recursive 612 163 -449 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 3/1 up/down: 595/-449) Total: 146 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'testsuite')
-rwxr-xr-xtestsuite/mdev.tests4
-rwxr-xr-xtestsuite/parse.tests44
2 files changed, 39 insertions, 9 deletions
diff --git a/testsuite/mdev.tests b/testsuite/mdev.tests
index 8515aff31..8e53ec564 100755
--- a/testsuite/mdev.tests
+++ b/testsuite/mdev.tests
@@ -168,7 +168,7 @@ SKIP=
# 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 STATIC FEATURE_MDEV_CONF FEATURE_MDEV_EXEC FEATURE_LS_RECURSIVE FEATURE_LS_TIMESTAMPS FEATURE_LS_USERNAME FEATURE_SH_IS_ASH ASH_ECHO
+optional STATIC FEATURE_MDEV_CONF FEATURE_MDEV_EXEC FEATURE_LS_RECURSIVE FEATURE_LS_TIMESTAMPS FEATURE_LS_USERNAME SH_IS_ASH ASH_ECHO
testing "mdev command" \
"env - PATH=$PATH ACTION=add DEVPATH=/block/sda chroot mdev.testdir /mdev 2>&1;
ls -lnR mdev.testdir/dev | $FILTER_LS" \
@@ -183,7 +183,7 @@ SKIP=
# 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 STATIC FEATURE_MDEV_CONF FEATURE_MDEV_RENAME FEATURE_MDEV_EXEC FEATURE_LS_RECURSIVE FEATURE_LS_TIMESTAMPS FEATURE_LS_USERNAME FEATURE_SH_IS_ASH
+optional STATIC FEATURE_MDEV_CONF FEATURE_MDEV_RENAME FEATURE_MDEV_EXEC FEATURE_LS_RECURSIVE FEATURE_LS_TIMESTAMPS FEATURE_LS_USERNAME SH_IS_ASH
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" \
diff --git a/testsuite/parse.tests b/testsuite/parse.tests
index 904e1a17a..2cbed6f31 100755
--- a/testsuite/parse.tests
+++ b/testsuite/parse.tests
@@ -5,13 +5,13 @@
. ./testing.sh
-COLLAPSE=$(( 0x00010000))
-TRIM=$(( 0x00020000))
-GREEDY=$(( 0x00040000))
-MIN_DIE=$(( 0x00100000))
-KEEP_COPY=$((0x00200000))
-ESCAPE=$(( 0x00400000))
-NORMAL=$(( COLLAPSE | TRIM | GREEDY))
+COLLAPSE=$(( 0x00010000))
+TRIM=$(( 0x00020000))
+GREEDY=$(( 0x00040000))
+MIN_DIE=$(( 0x00100000))
+KEEP_COPY=$(( 0x00200000))
+EOL_COMMENTS=$((0x00400000))
+NORMAL=$(( COLLAPSE | TRIM | GREEDY | EOL_COMMENTS))
# testing "description" "command" "result" "infile" "stdin"
@@ -27,6 +27,34 @@ testing "parse notrim" \
"-" \
" sda 0:0 644 @echo @echo TEST \n"
+testing "parse comments" \
+ "parse -n 4 -m 3 -f $((NORMAL - EOL_COMMENTS)) -" \
+ "[sda][0:0][644][@echo @echo TEST #this is not eaten]\n" \
+ "-" \
+ "\
+# sda 0:0 644 @echo @echo TEST - this gets eaten
+ sda 0:0 644 @echo @echo TEST #this is not eaten
+"
+
+testing "parse bad comment" \
+ "parse -n 2 -m 2 -d '#=' -f $((GREEDY)) - 2>&1" \
+ "\
+[var][val]
+parse: bad line 3: 1 tokens found, 2 needed
+[ #this][ok]
+[ #this][=ok]
+[ #this][=ok=ok=ok=]
+" \
+ "-" \
+ "\
+# this gets eaten
+var=val
+ #this causes error msg
+ #this=ok
+ #this==ok
+ #this==ok=ok=ok=
+"
+
FILE=__parse
cat >$FILE <<EOF
#
@@ -96,6 +124,8 @@ cat >$FILE.res <<EOF
[option][dns][129.219.13.81]
[option][domain][local]
[option][lease][864000]
+[option][msstaticroutes][10.0.0.0/8][10.127.0.1]
+[option][staticroutes][10.0.0.0/8][10.127.0.1,][10.11.12.0/24][10.11.12.1]
[option][0x08][01020304]
EOF