diff options
Diffstat (limited to 'shell/ash_test')
-rw-r--r-- | shell/ash_test/ash-misc/exitcode2.right | 4 | ||||
-rwxr-xr-x | shell/ash_test/ash-misc/exitcode2.tests | 12 | ||||
-rw-r--r-- | shell/ash_test/ash-redir/redir_leak.right | 6 | ||||
-rwxr-xr-x | shell/ash_test/ash-redir/redir_leak.tests | 10 |
4 files changed, 32 insertions, 0 deletions
diff --git a/shell/ash_test/ash-misc/exitcode2.right b/shell/ash_test/ash-misc/exitcode2.right new file mode 100644 index 000000000..f7cb983c6 --- /dev/null +++ b/shell/ash_test/ash-misc/exitcode2.right | |||
@@ -0,0 +1,4 @@ | |||
1 | ./test.sh: line 1: syntax error: unexpected ")" | ||
2 | Done:2 | ||
3 | ./exitcode2.tests: line 11: can't open does_not_exist: no such file | ||
4 | Done:1 | ||
diff --git a/shell/ash_test/ash-misc/exitcode2.tests b/shell/ash_test/ash-misc/exitcode2.tests new file mode 100755 index 000000000..79a6ebd50 --- /dev/null +++ b/shell/ash_test/ash-misc/exitcode2.tests | |||
@@ -0,0 +1,12 @@ | |||
1 | # syntax error should return status 2 | ||
2 | cat >test.sh <<EOF | ||
3 | ) | ||
4 | EOF | ||
5 | chmod +x test.sh | ||
6 | $THIS_SH ./test.sh | ||
7 | echo Done:$? | ||
8 | rm -f test.sh | ||
9 | |||
10 | # redirection error with special builtin should return status 1 | ||
11 | (eval cat <does_not_exist) | ||
12 | echo Done:$? | ||
diff --git a/shell/ash_test/ash-redir/redir_leak.right b/shell/ash_test/ash-redir/redir_leak.right new file mode 100644 index 000000000..b1c48292b --- /dev/null +++ b/shell/ash_test/ash-redir/redir_leak.right | |||
@@ -0,0 +1,6 @@ | |||
1 | 4 | ||
2 | 4 | ||
3 | 4 | ||
4 | 4 | ||
5 | 4 | ||
6 | 4 | ||
diff --git a/shell/ash_test/ash-redir/redir_leak.tests b/shell/ash_test/ash-redir/redir_leak.tests new file mode 100755 index 000000000..c8a9c6343 --- /dev/null +++ b/shell/ash_test/ash-redir/redir_leak.tests | |||
@@ -0,0 +1,10 @@ | |||
1 | # Each of these should show only four lines: | ||
2 | # fds 0,1,2 are stdio; fd 3 is open by opendir() in ls. | ||
3 | # This test detects bugs where redirects leave stray open fds. | ||
4 | |||
5 | ls -1 /proc/self/fd | wc -l | ||
6 | ls -1 /proc/self/fd >/proc/self/fd/1 | wc -l | ||
7 | ls -1 /proc/self/fd >/proc/self/fd/1 2>&1 | wc -l | ||
8 | echo "`ls -1 /proc/self/fd `" | wc -l | ||
9 | echo "`ls -1 /proc/self/fd >/proc/self/fd/1 `" | wc -l | ||
10 | echo "`ls -1 /proc/self/fd >/proc/self/fd/1 2>&1 `" | wc -l | ||