aboutsummaryrefslogtreecommitdiff
path: root/shell/hush_test
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2010-05-20 14:27:09 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2010-05-20 14:27:09 +0200
commitcddbb610cb0ea8d74668653aeaded710d2d13768 (patch)
treefea97f7c4fd0871543502d2fcefc189ee5d68288 /shell/hush_test
parent131ed3bcc9c9eabcb4bd6a063c24c6f9922f1491 (diff)
downloadbusybox-w32-cddbb610cb0ea8d74668653aeaded710d2d13768.tar.gz
busybox-w32-cddbb610cb0ea8d74668653aeaded710d2d13768.tar.bz2
busybox-w32-cddbb610cb0ea8d74668653aeaded710d2d13768.zip
hush: fix var=`exit 2` not setting $? to 2
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell/hush_test')
-rw-r--r--shell/hush_test/hush-psubst/falsetick.right27
-rwxr-xr-xshell/hush_test/hush-psubst/falsetick.tests22
2 files changed, 49 insertions, 0 deletions
diff --git a/shell/hush_test/hush-psubst/falsetick.right b/shell/hush_test/hush-psubst/falsetick.right
new file mode 100644
index 000000000..0b98fb778
--- /dev/null
+++ b/shell/hush_test/hush-psubst/falsetick.right
@@ -0,0 +1,27 @@
10
20
30
40
52
62
72
82
9hush: can't open '/does/not/exist': No such file or directory
101
11hush: can't open '/does/not/exist': No such file or directory
121
13hush: can't open '/does/not/exist': No such file or directory
141
15hush: can't open '/does/not/exist': No such file or directory
161
17hush: can't open '/does/not/exist': No such file or directory
181
19hush: can't open '/does/not/exist': No such file or directory
201
21hush: can't open '/does/not/exist': No such file or directory
221
23hush: can't open '/does/not/exist': No such file or directory
241
25hush: can't open '/does/not/exist': No such file or directory
261
27Done: a=b
diff --git a/shell/hush_test/hush-psubst/falsetick.tests b/shell/hush_test/hush-psubst/falsetick.tests
new file mode 100755
index 000000000..44d2eae8b
--- /dev/null
+++ b/shell/hush_test/hush-psubst/falsetick.tests
@@ -0,0 +1,22 @@
1# Exitcode 0 (`` has no exitcode, but assignment has):
2true; a=``; echo $?
3false; a=``; echo $?
4true; a=$(); echo $?
5false; a=$(); echo $?
6# Exitcode 2 (`cmd` expansion sets exitcode after assignment set it to 0):
7true; a=`exit 2`; echo $?
8false; a=`exit 2`; echo $?
9true; a=$(exit 2); echo $?
10false; a=$(exit 2); echo $?
11# Exitcode 1 (redirect sets exitcode to 1 on error after them):
12true; a=`` >/does/not/exist; echo $?
13false; a=`` >/does/not/exist; echo $?
14true; a=$() >/does/not/exist; echo $?
15false; a=$() >/does/not/exist; echo $?
16true; a=`exit 2` >/does/not/exist; echo $?
17false; a=`exit 2` >/does/not/exist; echo $?
18true; a=$(exit 2) >/does/not/exist; echo $?
19false; a=$(exit 2) >/does/not/exist; echo $?
20# ...and assignment still happens despite redirect error:
21true; a=$(echo b) >/does/not/exist; echo $?
22echo "Done: a=$a"