aboutsummaryrefslogtreecommitdiff
path: root/testsuite/parse.tests
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/parse.tests
parentfeb79e8742eb3cef211804dadcc7f3ddfd154c72 (diff)
downloadbusybox-w32-9cf89cdf84fb20154088145980b676d2b28fc55d.tar.gz
busybox-w32-9cf89cdf84fb20154088145980b676d2b28fc55d.tar.bz2
busybox-w32-9cf89cdf84fb20154088145980b676d2b28fc55d.zip
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 '')
-rwxr-xr-xtestsuite/parse.tests44
1 files changed, 37 insertions, 7 deletions
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 @@
5 5
6. ./testing.sh 6. ./testing.sh
7 7
8COLLAPSE=$(( 0x00010000)) 8COLLAPSE=$(( 0x00010000))
9TRIM=$(( 0x00020000)) 9TRIM=$(( 0x00020000))
10GREEDY=$(( 0x00040000)) 10GREEDY=$(( 0x00040000))
11MIN_DIE=$(( 0x00100000)) 11MIN_DIE=$(( 0x00100000))
12KEEP_COPY=$((0x00200000)) 12KEEP_COPY=$(( 0x00200000))
13ESCAPE=$(( 0x00400000)) 13EOL_COMMENTS=$((0x00400000))
14NORMAL=$(( COLLAPSE | TRIM | GREEDY)) 14NORMAL=$(( COLLAPSE | TRIM | GREEDY | EOL_COMMENTS))
15 15
16# testing "description" "command" "result" "infile" "stdin" 16# testing "description" "command" "result" "infile" "stdin"
17 17
@@ -27,6 +27,34 @@ testing "parse notrim" \
27 "-" \ 27 "-" \
28 " sda 0:0 644 @echo @echo TEST \n" 28 " sda 0:0 644 @echo @echo TEST \n"
29 29
30testing "parse comments" \
31 "parse -n 4 -m 3 -f $((NORMAL - EOL_COMMENTS)) -" \
32 "[sda][0:0][644][@echo @echo TEST #this is not eaten]\n" \
33 "-" \
34 "\
35# sda 0:0 644 @echo @echo TEST - this gets eaten
36 sda 0:0 644 @echo @echo TEST #this is not eaten
37"
38
39testing "parse bad comment" \
40 "parse -n 2 -m 2 -d '#=' -f $((GREEDY)) - 2>&1" \
41 "\
42[var][val]
43parse: bad line 3: 1 tokens found, 2 needed
44[ #this][ok]
45[ #this][=ok]
46[ #this][=ok=ok=ok=]
47" \
48 "-" \
49 "\
50# this gets eaten
51var=val
52 #this causes error msg
53 #this=ok
54 #this==ok
55 #this==ok=ok=ok=
56"
57
30FILE=__parse 58FILE=__parse
31cat >$FILE <<EOF 59cat >$FILE <<EOF
32# 60#
@@ -96,6 +124,8 @@ cat >$FILE.res <<EOF
96[option][dns][129.219.13.81] 124[option][dns][129.219.13.81]
97[option][domain][local] 125[option][domain][local]
98[option][lease][864000] 126[option][lease][864000]
127[option][msstaticroutes][10.0.0.0/8][10.127.0.1]
128[option][staticroutes][10.0.0.0/8][10.127.0.1,][10.11.12.0/24][10.11.12.1]
99[option][0x08][01020304] 129[option][0x08][01020304]
100EOF 130EOF
101 131