diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2009-04-06 18:08:35 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2009-04-06 18:08:35 +0000 |
commit | cd418a26700629ad3f240ef6fd2e351ec0c2f87e (patch) | |
tree | 5964e28502c10867fdb76037b9879950c300ee3b /shell/hush_test | |
parent | 8f8d013afc3ec24056f2180ec38e469615632094 (diff) | |
download | busybox-w32-cd418a26700629ad3f240ef6fd2e351ec0c2f87e.tar.gz busybox-w32-cd418a26700629ad3f240ef6fd2e351ec0c2f87e.tar.bz2 busybox-w32-cd418a26700629ad3f240ef6fd2e351ec0c2f87e.zip |
hush: fix a bunch of obscure while/until/continue bugs
function old new delta
run_list 1159 1214 +55
done_pipe 106 123 +17
done_command 86 98 +12
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 84/0) Total: 84 bytes
Diffstat (limited to 'shell/hush_test')
-rw-r--r-- | shell/hush_test/hush-misc/continue2.right | 1 | ||||
-rw-r--r-- | shell/hush_test/hush-misc/continue2.tests | 3 | ||||
-rw-r--r-- | shell/hush_test/hush-misc/continue3.right | 2 | ||||
-rw-r--r-- | shell/hush_test/hush-misc/continue3.tests | 3 | ||||
-rw-r--r-- | shell/hush_test/hush-misc/until1.right | 3 | ||||
-rw-r--r-- | shell/hush_test/hush-misc/until1.tests | 11 | ||||
-rw-r--r-- | shell/hush_test/hush-misc/while2.right | 2 | ||||
-rw-r--r-- | shell/hush_test/hush-misc/while2.tests | 2 | ||||
-rwxr-xr-x | shell/hush_test/run-all | 2 |
9 files changed, 28 insertions, 1 deletions
diff --git a/shell/hush_test/hush-misc/continue2.right b/shell/hush_test/hush-misc/continue2.right new file mode 100644 index 000000000..49d3ebd3a --- /dev/null +++ b/shell/hush_test/hush-misc/continue2.right | |||
@@ -0,0 +1 @@ | |||
Ok:1 | |||
diff --git a/shell/hush_test/hush-misc/continue2.tests b/shell/hush_test/hush-misc/continue2.tests new file mode 100644 index 000000000..c2df07195 --- /dev/null +++ b/shell/hush_test/hush-misc/continue2.tests | |||
@@ -0,0 +1,3 @@ | |||
1 | e='' | ||
2 | (while test $e && exit 1; true; do e=1; continue; done) | ||
3 | echo Ok:$? | ||
diff --git a/shell/hush_test/hush-misc/continue3.right b/shell/hush_test/hush-misc/continue3.right new file mode 100644 index 000000000..aa47d0d46 --- /dev/null +++ b/shell/hush_test/hush-misc/continue3.right | |||
@@ -0,0 +1,2 @@ | |||
1 | 0 | ||
2 | 0 | ||
diff --git a/shell/hush_test/hush-misc/continue3.tests b/shell/hush_test/hush-misc/continue3.tests new file mode 100644 index 000000000..0aff867cd --- /dev/null +++ b/shell/hush_test/hush-misc/continue3.tests | |||
@@ -0,0 +1,3 @@ | |||
1 | # Test that "continue" does affect exitcode (sets to 0) | ||
2 | e='' | ||
3 | while echo $?; test $e && exit; true; do e=1; false; continue; done | ||
diff --git a/shell/hush_test/hush-misc/until1.right b/shell/hush_test/hush-misc/until1.right new file mode 100644 index 000000000..be2daad95 --- /dev/null +++ b/shell/hush_test/hush-misc/until1.right | |||
@@ -0,0 +1,3 @@ | |||
1 | 1 | ||
2 | 1 | ||
3 | Ok:0 | ||
diff --git a/shell/hush_test/hush-misc/until1.tests b/shell/hush_test/hush-misc/until1.tests new file mode 100644 index 000000000..10ab28381 --- /dev/null +++ b/shell/hush_test/hush-misc/until1.tests | |||
@@ -0,0 +1,11 @@ | |||
1 | x=1 | ||
2 | until test "$x" = 4; do echo $x; x=4; done | ||
3 | |||
4 | # We had a bug in multi-line form | ||
5 | x=1 | ||
6 | until test "$x" = 4; do | ||
7 | echo $x | ||
8 | x=4 | ||
9 | done | ||
10 | |||
11 | echo Ok:$? | ||
diff --git a/shell/hush_test/hush-misc/while2.right b/shell/hush_test/hush-misc/while2.right new file mode 100644 index 000000000..07207cc84 --- /dev/null +++ b/shell/hush_test/hush-misc/while2.right | |||
@@ -0,0 +1,2 @@ | |||
1 | Hello | ||
2 | OK:0 | ||
diff --git a/shell/hush_test/hush-misc/while2.tests b/shell/hush_test/hush-misc/while2.tests new file mode 100644 index 000000000..2247adc74 --- /dev/null +++ b/shell/hush_test/hush-misc/while2.tests | |||
@@ -0,0 +1,2 @@ | |||
1 | while echo Hello; false; do echo NOT SHOWN; done | ||
2 | echo OK:$? | ||
diff --git a/shell/hush_test/run-all b/shell/hush_test/run-all index 3fe3ba51d..c7989a172 100755 --- a/shell/hush_test/run-all +++ b/shell/hush_test/run-all | |||
@@ -46,7 +46,7 @@ do_test() | |||
46 | test -x "$x" || continue | 46 | test -x "$x" || continue |
47 | name="${x%%.tests}" | 47 | name="${x%%.tests}" |
48 | test -f "$name.right" || continue | 48 | test -f "$name.right" || continue |
49 | # echo Running test: "$name.right" | 49 | # echo Running test: "$x" |
50 | { | 50 | { |
51 | "$THIS_SH" "./$x" >"$name.xx" 2>&1 | 51 | "$THIS_SH" "./$x" >"$name.xx" 2>&1 |
52 | diff -u "$name.xx" "$name.right" >"../$1-$x.fail" && rm -f "$name.xx" "../$1-$x.fail" | 52 | diff -u "$name.xx" "$name.right" >"../$1-$x.fail" && rm -f "$name.xx" "../$1-$x.fail" |