diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2010-08-23 02:53:58 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-08-23 02:53:58 +0200 |
commit | dc04439450e5929880205d920de3a26409727563 (patch) | |
tree | 5ee9110f0cb3ddd01f2ca6a5d7da87ee4a910443 /testsuite | |
parent | 941fce89fa346e06e936d4d3b58773c836127fd7 (diff) | |
download | busybox-w32-dc04439450e5929880205d920de3a26409727563.tar.gz busybox-w32-dc04439450e5929880205d920de3a26409727563.tar.bz2 busybox-w32-dc04439450e5929880205d920de3a26409727563.zip |
Version 1.17.2: apply post 1.17.1 fixes, replace patch applet by Rob's version
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'testsuite')
-rwxr-xr-x | testsuite/grep.tests | 4 | ||||
-rwxr-xr-x | testsuite/mdev.tests | 10 | ||||
-rwxr-xr-x | testsuite/patch.tests | 74 | ||||
-rwxr-xr-x | testsuite/sed.tests | 21 |
4 files changed, 94 insertions, 15 deletions
diff --git a/testsuite/grep.tests b/testsuite/grep.tests index d4bf80d83..e0135dcbb 100755 --- a/testsuite/grep.tests +++ b/testsuite/grep.tests | |||
@@ -98,5 +98,9 @@ testing "grep -o does not loop forever" \ | |||
98 | 'grep -o "[^/]*$"' \ | 98 | 'grep -o "[^/]*$"' \ |
99 | "test\n" \ | 99 | "test\n" \ |
100 | "" "/var/test\n" | 100 | "" "/var/test\n" |
101 | testing "grep -o does not loop forever on zero-length match" \ | ||
102 | 'grep -o "" | head -n1' \ | ||
103 | "" \ | ||
104 | "" "test\n" | ||
101 | 105 | ||
102 | exit $FAILCOUNT | 106 | exit $FAILCOUNT |
diff --git a/testsuite/mdev.tests b/testsuite/mdev.tests index c375fc774..a46929b3a 100755 --- a/testsuite/mdev.tests +++ b/testsuite/mdev.tests | |||
@@ -38,6 +38,16 @@ brw-rw---- 1 0 0 8,0 sda | |||
38 | SKIP= | 38 | SKIP= |
39 | 39 | ||
40 | # continuing to use directory structure from prev test | 40 | # continuing to use directory structure from prev test |
41 | optional STATIC FEATURE_MDEV_CONF FEATURE_LS_TIMESTAMPS FEATURE_LS_USERNAME | ||
42 | testing "mdev deletes /block/sda" \ | ||
43 | "env - PATH=$PATH ACTION=remove DEVPATH=/block/sda chroot mdev.testdir /mdev 2>&1; | ||
44 | ls -ln mdev.testdir/dev | $FILTER_LS" \ | ||
45 | "\ | ||
46 | " \ | ||
47 | "" "" | ||
48 | SKIP= | ||
49 | |||
50 | # continuing to use directory structure from prev test | ||
41 | rm -rf mdev.testdir/dev/* | 51 | rm -rf mdev.testdir/dev/* |
42 | echo ".* 1:1 666" >mdev.testdir/etc/mdev.conf | 52 | echo ".* 1:1 666" >mdev.testdir/etc/mdev.conf |
43 | echo "sda 2:2 444" >>mdev.testdir/etc/mdev.conf | 53 | echo "sda 2:2 444" >>mdev.testdir/etc/mdev.conf |
diff --git a/testsuite/patch.tests b/testsuite/patch.tests index 749d936ea..e482304f6 100755 --- a/testsuite/patch.tests +++ b/testsuite/patch.tests | |||
@@ -1,13 +1,13 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/sh |
2 | # Copyright 2008 by Denys Vlasenko | 2 | # Copyright 2008 by Denys Vlasenko |
3 | # Licensed under GPL v2, see file LICENSE for details. | 3 | # Licensed under GPLv2, see file LICENSE in this source tree. |
4 | 4 | ||
5 | . ./testing.sh | 5 | . ./testing.sh |
6 | 6 | ||
7 | # testing "test name" "options" "expected result" "file input" "stdin" | 7 | # testing "test name" "command(s)" "expected result" "file input" "stdin" |
8 | 8 | ||
9 | testing "patch with old_file == new_file" \ | 9 | testing "patch with old_file == new_file" \ |
10 | 'patch; echo $?; cat input' \ | 10 | 'patch 2>&1; echo $?; cat input' \ |
11 | "\ | 11 | "\ |
12 | patching file input | 12 | patching file input |
13 | 0 | 13 | 0 |
@@ -29,7 +29,7 @@ zxc | |||
29 | " \ | 29 | " \ |
30 | 30 | ||
31 | testing "patch with nonexistent old_file" \ | 31 | testing "patch with nonexistent old_file" \ |
32 | 'patch; echo $?; cat input' \ | 32 | 'patch 2>&1; echo $?; cat input' \ |
33 | "\ | 33 | "\ |
34 | patching file input | 34 | patching file input |
35 | 0 | 35 | 0 |
@@ -51,7 +51,7 @@ zxc | |||
51 | " \ | 51 | " \ |
52 | 52 | ||
53 | testing "patch -R with nonexistent old_file" \ | 53 | testing "patch -R with nonexistent old_file" \ |
54 | 'patch -R; echo $?; cat input' \ | 54 | 'patch -R 2>&1; echo $?; cat input' \ |
55 | "\ | 55 | "\ |
56 | patching file input | 56 | patching file input |
57 | 0 | 57 | 0 |
@@ -75,9 +75,12 @@ zxc | |||
75 | testing "patch detects already applied hunk" \ | 75 | testing "patch detects already applied hunk" \ |
76 | 'patch 2>&1; echo $?; cat input' \ | 76 | 'patch 2>&1; echo $?; cat input' \ |
77 | "\ | 77 | "\ |
78 | Possibly reversed hunk 1 at 2 | ||
79 | Hunk 1 FAILED 1/1. | ||
80 | abc | ||
81 | +def | ||
82 | 123 | ||
78 | patching file input | 83 | patching file input |
79 | patch: hunk #1 FAILED at 1 | ||
80 | patch: 1 out of 1 hunk FAILED | ||
81 | 1 | 84 | 1 |
82 | abc | 85 | abc |
83 | def | 86 | def |
@@ -97,13 +100,15 @@ def | |||
97 | 123 | 100 | 123 |
98 | " \ | 101 | " \ |
99 | 102 | ||
100 | # Currently fails (erroneously appends second "456" line): | 103 | testing "patch detects already applied hunk at the EOF" \ |
101 | false && testing "patch detects already applied hunk" \ | ||
102 | 'patch 2>&1; echo $?; cat input' \ | 104 | 'patch 2>&1; echo $?; cat input' \ |
103 | "\ | 105 | "\ |
106 | Possibly reversed hunk 1 at 3 | ||
107 | Hunk 1 FAILED 1/1. | ||
108 | abc | ||
109 | 123 | ||
110 | +456 | ||
104 | patching file input | 111 | patching file input |
105 | patch: hunk #1 FAILED at 2 | ||
106 | patch: 1 out of 1 hunk FAILED | ||
107 | 1 | 112 | 1 |
108 | abc | 113 | abc |
109 | 123 | 114 | 123 |
@@ -123,6 +128,53 @@ abc | |||
123 | +456 | 128 | +456 |
124 | " \ | 129 | " \ |
125 | 130 | ||
131 | # testing "test name" "command(s)" "expected result" "file input" "stdin" | ||
132 | testing "patch -N ignores already applied hunk" \ | ||
133 | 'patch -N 2>&1; echo $?; cat input' \ | ||
134 | "\ | ||
135 | patching file input | ||
136 | 0 | ||
137 | abc | ||
138 | def | ||
139 | 123 | ||
140 | " \ | ||
141 | "\ | ||
142 | abc | ||
143 | def | ||
144 | 123 | ||
145 | " \ | ||
146 | "\ | ||
147 | --- input | ||
148 | +++ input | ||
149 | @@ -1,2 +1,3 @@ | ||
150 | abc | ||
151 | +def | ||
152 | 123 | ||
153 | " \ | ||
154 | |||
155 | # testing "test name" "command(s)" "expected result" "file input" "stdin" | ||
156 | testing "patch FILE PATCH" \ | ||
157 | 'cat >a.patch; patch input a.patch 2>&1; echo $?; cat input; rm a.patch' \ | ||
158 | "\ | ||
159 | patching file input | ||
160 | 0 | ||
161 | abc | ||
162 | def | ||
163 | 123 | ||
164 | " \ | ||
165 | "\ | ||
166 | abc | ||
167 | 123 | ||
168 | " \ | ||
169 | "\ | ||
170 | --- foo.old | ||
171 | +++ foo | ||
172 | @@ -1,2 +1,3 @@ | ||
173 | abc | ||
174 | +def | ||
175 | 123 | ||
176 | " \ | ||
177 | |||
126 | rm input.orig 2>/dev/null | 178 | rm input.orig 2>/dev/null |
127 | 179 | ||
128 | exit $FAILCOUNT | 180 | exit $FAILCOUNT |
diff --git a/testsuite/sed.tests b/testsuite/sed.tests index 3301a25f8..61551e31c 100755 --- a/testsuite/sed.tests +++ b/testsuite/sed.tests | |||
@@ -80,10 +80,18 @@ test x"$SKIP_KNOWN_BUGS" = x"" && { | |||
80 | # Query: how does this interact with no newline at EOF? | 80 | # Query: how does this interact with no newline at EOF? |
81 | testing "sed n (flushes pattern space, terminates early)" "sed -e 'n;p'" \ | 81 | testing "sed n (flushes pattern space, terminates early)" "sed -e 'n;p'" \ |
82 | "a\nb\nb\nc\n" "" "a\nb\nc\n" | 82 | "a\nb\nb\nc\n" "" "a\nb\nc\n" |
83 | # N does _not_ flush pattern space, therefore c is still in there @ script end. | ||
84 | testing "sed N (doesn't flush pattern space when terminating)" "sed -e 'N;p'" \ | ||
85 | "a\nb\na\nb\nc\n" "" "a\nb\nc\n" | ||
86 | } | 83 | } |
84 | # non-GNU sed: N does _not_ flush pattern space, therefore c is eaten @ script end | ||
85 | # GNU sed: N flushes pattern space, therefore c is printed too @ script end | ||
86 | testing "sed N (flushes pattern space (GNU behavior))" "sed -e 'N;p'" \ | ||
87 | "a\nb\na\nb\nc\n" "" "a\nb\nc\n" | ||
88 | |||
89 | testing "sed N test2" "sed ':a;N;s/\n/ /;ta'" \ | ||
90 | "a b c\n" "" "a\nb\nc\n" | ||
91 | |||
92 | testing "sed N test3" "sed 'N;s/\n/ /'" \ | ||
93 | "a b\nc\n" "" "a\nb\nc\n" | ||
94 | |||
87 | testing "sed address match newline" 'sed "/b/N;/b\\nc/i woo"' \ | 95 | testing "sed address match newline" 'sed "/b/N;/b\\nc/i woo"' \ |
88 | "a\nwoo\nb\nc\nd\n" "" "a\nb\nc\nd\n" | 96 | "a\nwoo\nb\nc\nd\n" "" "a\nb\nc\nd\n" |
89 | 97 | ||
@@ -270,11 +278,16 @@ testing "sed a cmd ended by double backslash" \ | |||
270 | | two \\ | 278 | | two \\ |
271 | ' | 279 | ' |
272 | 280 | ||
273 | # fisrt three lines are deleted; 4th line is matched and printed by "2,3" and by "4" ranges | 281 | # first three lines are deleted; 4th line is matched and printed by "2,3" and by "4" ranges |
274 | testing "sed with N skipping lines past ranges on next cmds" \ | 282 | testing "sed with N skipping lines past ranges on next cmds" \ |
275 | "sed -n '1{N;N;d};1p;2,3p;3p;4p'" \ | 283 | "sed -n '1{N;N;d};1p;2,3p;3p;4p'" \ |
276 | "4\n4\n" "" "1\n2\n3\n4\n" | 284 | "4\n4\n" "" "1\n2\n3\n4\n" |
277 | 285 | ||
286 | testing "sed -i with address modifies all files, not only first" \ | ||
287 | "cp input input2; sed -i -e '1s/foo/bar/' input input2 && cat input input2; rm input2" \ | ||
288 | "bar\nbar\n" "foo\n" "" | ||
289 | |||
290 | |||
278 | # testing "description" "arguments" "result" "infile" "stdin" | 291 | # testing "description" "arguments" "result" "infile" "stdin" |
279 | 292 | ||
280 | exit $FAILCOUNT | 293 | exit $FAILCOUNT |