aboutsummaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2010-08-23 02:53:58 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2010-08-23 02:53:58 +0200
commitdc04439450e5929880205d920de3a26409727563 (patch)
tree5ee9110f0cb3ddd01f2ca6a5d7da87ee4a910443 /testsuite
parent941fce89fa346e06e936d4d3b58773c836127fd7 (diff)
downloadbusybox-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-xtestsuite/grep.tests4
-rwxr-xr-xtestsuite/mdev.tests10
-rwxr-xr-xtestsuite/patch.tests74
-rwxr-xr-xtestsuite/sed.tests21
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"
101testing "grep -o does not loop forever on zero-length match" \
102 'grep -o "" | head -n1' \
103 "" \
104 "" "test\n"
101 105
102exit $FAILCOUNT 106exit $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
38SKIP= 38SKIP=
39 39
40# continuing to use directory structure from prev test 40# continuing to use directory structure from prev test
41optional STATIC FEATURE_MDEV_CONF FEATURE_LS_TIMESTAMPS FEATURE_LS_USERNAME
42testing "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 "" ""
48SKIP=
49
50# continuing to use directory structure from prev test
41rm -rf mdev.testdir/dev/* 51rm -rf mdev.testdir/dev/*
42echo ".* 1:1 666" >mdev.testdir/etc/mdev.conf 52echo ".* 1:1 666" >mdev.testdir/etc/mdev.conf
43echo "sda 2:2 444" >>mdev.testdir/etc/mdev.conf 53echo "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
9testing "patch with old_file == new_file" \ 9testing "patch with old_file == new_file" \
10 'patch; echo $?; cat input' \ 10 'patch 2>&1; echo $?; cat input' \
11"\ 11"\
12patching file input 12patching file input
130 130
@@ -29,7 +29,7 @@ zxc
29" \ 29" \
30 30
31testing "patch with nonexistent old_file" \ 31testing "patch with nonexistent old_file" \
32 'patch; echo $?; cat input' \ 32 'patch 2>&1; echo $?; cat input' \
33"\ 33"\
34patching file input 34patching file input
350 350
@@ -51,7 +51,7 @@ zxc
51" \ 51" \
52 52
53testing "patch -R with nonexistent old_file" \ 53testing "patch -R with nonexistent old_file" \
54 'patch -R; echo $?; cat input' \ 54 'patch -R 2>&1; echo $?; cat input' \
55"\ 55"\
56patching file input 56patching file input
570 570
@@ -75,9 +75,12 @@ zxc
75testing "patch detects already applied hunk" \ 75testing "patch detects already applied hunk" \
76 'patch 2>&1; echo $?; cat input' \ 76 'patch 2>&1; echo $?; cat input' \
77"\ 77"\
78Possibly reversed hunk 1 at 2
79Hunk 1 FAILED 1/1.
80 abc
81+def
82 123
78patching file input 83patching file input
79patch: hunk #1 FAILED at 1
80patch: 1 out of 1 hunk FAILED
811 841
82abc 85abc
83def 86def
@@ -97,13 +100,15 @@ def
97 123 100 123
98" \ 101" \
99 102
100# Currently fails (erroneously appends second "456" line): 103testing "patch detects already applied hunk at the EOF" \
101false && testing "patch detects already applied hunk" \
102 'patch 2>&1; echo $?; cat input' \ 104 'patch 2>&1; echo $?; cat input' \
103"\ 105"\
106Possibly reversed hunk 1 at 3
107Hunk 1 FAILED 1/1.
108 abc
109 123
110+456
104patching file input 111patching file input
105patch: hunk #1 FAILED at 2
106patch: 1 out of 1 hunk FAILED
1071 1121
108abc 113abc
109123 114123
@@ -123,6 +128,53 @@ abc
123+456 128+456
124" \ 129" \
125 130
131# testing "test name" "command(s)" "expected result" "file input" "stdin"
132testing "patch -N ignores already applied hunk" \
133 'patch -N 2>&1; echo $?; cat input' \
134"\
135patching file input
1360
137abc
138def
139123
140" \
141"\
142abc
143def
144123
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"
156testing "patch FILE PATCH" \
157 'cat >a.patch; patch input a.patch 2>&1; echo $?; cat input; rm a.patch' \
158"\
159patching file input
1600
161abc
162def
163123
164" \
165"\
166abc
167123
168" \
169"\
170--- foo.old
171+++ foo
172@@ -1,2 +1,3 @@
173 abc
174+def
175 123
176" \
177
126rm input.orig 2>/dev/null 178rm input.orig 2>/dev/null
127 179
128exit $FAILCOUNT 180exit $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?
81testing "sed n (flushes pattern space, terminates early)" "sed -e 'n;p'" \ 81testing "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.
84testing "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
86testing "sed N (flushes pattern space (GNU behavior))" "sed -e 'N;p'" \
87 "a\nb\na\nb\nc\n" "" "a\nb\nc\n"
88
89testing "sed N test2" "sed ':a;N;s/\n/ /;ta'" \
90 "a b c\n" "" "a\nb\nc\n"
91
92testing "sed N test3" "sed 'N;s/\n/ /'" \
93 "a b\nc\n" "" "a\nb\nc\n"
94
87testing "sed address match newline" 'sed "/b/N;/b\\nc/i woo"' \ 95testing "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
274testing "sed with N skipping lines past ranges on next cmds" \ 282testing "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
286testing "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
280exit $FAILCOUNT 293exit $FAILCOUNT