diff options
Diffstat (limited to 'shell/hush_test')
-rw-r--r-- | shell/hush_test/hush-heredoc/heredoc_empty2.right | 4 | ||||
-rwxr-xr-x | shell/hush_test/hush-heredoc/heredoc_empty2.tests | 14 | ||||
-rw-r--r-- | shell/hush_test/hush-misc/func_prio_over_builtins.right | 5 | ||||
-rwxr-xr-x | shell/hush_test/hush-misc/func_prio_over_builtins.tests | 5 | ||||
-rw-r--r-- | shell/hush_test/hush-misc/func_return1.right (renamed from shell/hush_test/hush-misc/func6.right) | 0 | ||||
-rwxr-xr-x | shell/hush_test/hush-misc/func_return1.tests (renamed from shell/hush_test/hush-misc/func6.tests) | 0 | ||||
-rw-r--r-- | shell/hush_test/hush-misc/func_return2.right | 2 | ||||
-rwxr-xr-x | shell/hush_test/hush-misc/func_return2.tests | 6 | ||||
-rwxr-xr-x | shell/hush_test/hush-redir/redir_script.tests | 9 | ||||
-rw-r--r-- | shell/hush_test/hush-redir/redir_to_bad_fd255.right | 1 | ||||
-rwxr-xr-x | shell/hush_test/hush-redir/redir_to_bad_fd255.tests | 3 | ||||
-rw-r--r-- | shell/hush_test/hush-redir/redir_to_bad_fd3.right | 1 | ||||
-rwxr-xr-x | shell/hush_test/hush-redir/redir_to_bad_fd3.tests | 3 |
13 files changed, 51 insertions, 2 deletions
diff --git a/shell/hush_test/hush-heredoc/heredoc_empty2.right b/shell/hush_test/hush-heredoc/heredoc_empty2.right new file mode 100644 index 000000000..e32c6ea58 --- /dev/null +++ b/shell/hush_test/hush-heredoc/heredoc_empty2.right | |||
@@ -0,0 +1,4 @@ | |||
1 | OK1 | ||
2 | Ok:0 | ||
3 | OK2 | ||
4 | Ok:0 | ||
diff --git a/shell/hush_test/hush-heredoc/heredoc_empty2.tests b/shell/hush_test/hush-heredoc/heredoc_empty2.tests new file mode 100755 index 000000000..20fc35fe9 --- /dev/null +++ b/shell/hush_test/hush-heredoc/heredoc_empty2.tests | |||
@@ -0,0 +1,14 @@ | |||
1 | unset a | ||
2 | |||
3 | # Heredoc with empty delimiter | ||
4 | cat <<- "" | ||
5 | OK1 | ||
6 | |||
7 | echo Ok:$? | ||
8 | |||
9 | # Heredoc with empty delimiter | ||
10 | cat <<- "" | ||
11 | OK2 | ||
12 | |||
13 | |||
14 | echo Ok:$? | ||
diff --git a/shell/hush_test/hush-misc/func_prio_over_builtins.right b/shell/hush_test/hush-misc/func_prio_over_builtins.right new file mode 100644 index 000000000..54e56dff4 --- /dev/null +++ b/shell/hush_test/hush-misc/func_prio_over_builtins.right | |||
@@ -0,0 +1,5 @@ | |||
1 | YES | ||
2 | YES | ||
3 | YES | ||
4 | YES | ||
5 | Ok:YES | ||
diff --git a/shell/hush_test/hush-misc/func_prio_over_builtins.tests b/shell/hush_test/hush-misc/func_prio_over_builtins.tests new file mode 100755 index 000000000..4f71bfda0 --- /dev/null +++ b/shell/hush_test/hush-misc/func_prio_over_builtins.tests | |||
@@ -0,0 +1,5 @@ | |||
1 | true() { echo YES >&2; } | ||
2 | true | ||
3 | true | true | ||
4 | (true) | ||
5 | echo Ok:`true 2>&1` | ||
diff --git a/shell/hush_test/hush-misc/func6.right b/shell/hush_test/hush-misc/func_return1.right index 0ebd8e5a3..0ebd8e5a3 100644 --- a/shell/hush_test/hush-misc/func6.right +++ b/shell/hush_test/hush-misc/func_return1.right | |||
diff --git a/shell/hush_test/hush-misc/func6.tests b/shell/hush_test/hush-misc/func_return1.tests index 029c3e85e..029c3e85e 100755 --- a/shell/hush_test/hush-misc/func6.tests +++ b/shell/hush_test/hush-misc/func_return1.tests | |||
diff --git a/shell/hush_test/hush-misc/func_return2.right b/shell/hush_test/hush-misc/func_return2.right new file mode 100644 index 000000000..0ebd8e5a3 --- /dev/null +++ b/shell/hush_test/hush-misc/func_return2.right | |||
@@ -0,0 +1,2 @@ | |||
1 | Two:2 | ||
2 | Two:2 | ||
diff --git a/shell/hush_test/hush-misc/func_return2.tests b/shell/hush_test/hush-misc/func_return2.tests new file mode 100755 index 000000000..a049dd180 --- /dev/null +++ b/shell/hush_test/hush-misc/func_return2.tests | |||
@@ -0,0 +1,6 @@ | |||
1 | f1() { return 2; } | ||
2 | f1 | ||
3 | echo Two:$? | ||
4 | false | ||
5 | true | f1 | ||
6 | echo Two:$? | ||
diff --git a/shell/hush_test/hush-redir/redir_script.tests b/shell/hush_test/hush-redir/redir_script.tests index ccc497d7b..740daa461 100755 --- a/shell/hush_test/hush-redir/redir_script.tests +++ b/shell/hush_test/hush-redir/redir_script.tests | |||
@@ -20,10 +20,15 @@ eval "find_fds $fds" | |||
20 | 20 | ||
21 | # Shell should not lose that fd. Did it? | 21 | # Shell should not lose that fd. Did it? |
22 | find_fds | 22 | find_fds |
23 | test x"$fds1" = x"$fds" && { echo "Ok: script fd is not closed"; exit 0; } | 23 | test x"$fds1" = x"$fds" \ |
24 | && { echo "Ok: script fd is not closed"; exit 0; } | ||
25 | |||
26 | # One legit way to handle it is to move script fd. For example, if we see that fd 10 moved to fd 11: | ||
27 | test x"$fds1" = x" 10>&- 3>&-" && \ | ||
28 | test x"$fds" = x" 11>&- 3>&-" \ | ||
29 | && { echo "Ok: script fd is not closed"; exit 0; } | ||
24 | 30 | ||
25 | echo "Bug: script fd is closed" | 31 | echo "Bug: script fd is closed" |
26 | echo "fds1:$fds1" | 32 | echo "fds1:$fds1" |
27 | echo "fds2:$fds" | 33 | echo "fds2:$fds" |
28 | exit 1 | 34 | exit 1 |
29 | |||
diff --git a/shell/hush_test/hush-redir/redir_to_bad_fd255.right b/shell/hush_test/hush-redir/redir_to_bad_fd255.right new file mode 100644 index 000000000..936911ce5 --- /dev/null +++ b/shell/hush_test/hush-redir/redir_to_bad_fd255.right | |||
@@ -0,0 +1 @@ | |||
hush: can't duplicate file descriptor: Bad file descriptor | |||
diff --git a/shell/hush_test/hush-redir/redir_to_bad_fd255.tests b/shell/hush_test/hush-redir/redir_to_bad_fd255.tests new file mode 100755 index 000000000..2266af6da --- /dev/null +++ b/shell/hush_test/hush-redir/redir_to_bad_fd255.tests | |||
@@ -0,0 +1,3 @@ | |||
1 | # ash uses fd 10 (usually) for reading the script | ||
2 | echo LOST >&255 | ||
3 | echo OK | ||
diff --git a/shell/hush_test/hush-redir/redir_to_bad_fd3.right b/shell/hush_test/hush-redir/redir_to_bad_fd3.right new file mode 100644 index 000000000..936911ce5 --- /dev/null +++ b/shell/hush_test/hush-redir/redir_to_bad_fd3.right | |||
@@ -0,0 +1 @@ | |||
hush: can't duplicate file descriptor: Bad file descriptor | |||
diff --git a/shell/hush_test/hush-redir/redir_to_bad_fd3.tests b/shell/hush_test/hush-redir/redir_to_bad_fd3.tests new file mode 100755 index 000000000..98c54cfc6 --- /dev/null +++ b/shell/hush_test/hush-redir/redir_to_bad_fd3.tests | |||
@@ -0,0 +1,3 @@ | |||
1 | # ash uses fd 10 (usually) for reading the script | ||
2 | echo LOST >&3 | ||
3 | echo OK | ||