aboutsummaryrefslogtreecommitdiff
path: root/shell/ash_test
diff options
context:
space:
mode:
Diffstat (limited to 'shell/ash_test')
-rw-r--r--shell/ash_test/ash-heredoc/heredoc_empty.right3
-rwxr-xr-xshell/ash_test/ash-heredoc/heredoc_empty.tests8
-rw-r--r--shell/ash_test/ash-heredoc/heredoc_empty2.right4
-rwxr-xr-xshell/ash_test/ash-heredoc/heredoc_empty2.tests14
-rw-r--r--shell/ash_test/ash-misc/func_prio_over_builtins.right5
-rwxr-xr-xshell/ash_test/ash-misc/func_prio_over_builtins.tests5
-rw-r--r--shell/ash_test/ash-misc/func_return1.right (renamed from shell/ash_test/ash-misc/func6.right)0
-rwxr-xr-xshell/ash_test/ash-misc/func_return1.tests (renamed from shell/ash_test/ash-misc/func6.tests)0
-rw-r--r--shell/ash_test/ash-misc/func_return2.right2
-rwxr-xr-xshell/ash_test/ash-misc/func_return2.tests6
-rwxr-xr-xshell/ash_test/ash-redir/redir_script.tests9
-rw-r--r--shell/ash_test/ash-redir/redir_to_bad_fd255.right2
-rwxr-xr-xshell/ash_test/ash-redir/redir_to_bad_fd255.tests3
-rw-r--r--shell/ash_test/ash-redir/redir_to_bad_fd3.right2
-rwxr-xr-xshell/ash_test/ash-redir/redir_to_bad_fd3.tests3
15 files changed, 64 insertions, 2 deletions
diff --git a/shell/ash_test/ash-heredoc/heredoc_empty.right b/shell/ash_test/ash-heredoc/heredoc_empty.right
new file mode 100644
index 000000000..0eabe3671
--- /dev/null
+++ b/shell/ash_test/ash-heredoc/heredoc_empty.right
@@ -0,0 +1,3 @@
1OK
2OK
3OK
diff --git a/shell/ash_test/ash-heredoc/heredoc_empty.tests b/shell/ash_test/ash-heredoc/heredoc_empty.tests
new file mode 100755
index 000000000..3629bc6d1
--- /dev/null
+++ b/shell/ash_test/ash-heredoc/heredoc_empty.tests
@@ -0,0 +1,8 @@
1unset a
2cat <<- $a
3 OK
4$a
5cat <<- ""
6 OK
7
8echo OK
diff --git a/shell/ash_test/ash-heredoc/heredoc_empty2.right b/shell/ash_test/ash-heredoc/heredoc_empty2.right
new file mode 100644
index 000000000..e32c6ea58
--- /dev/null
+++ b/shell/ash_test/ash-heredoc/heredoc_empty2.right
@@ -0,0 +1,4 @@
1OK1
2Ok:0
3OK2
4Ok:0
diff --git a/shell/ash_test/ash-heredoc/heredoc_empty2.tests b/shell/ash_test/ash-heredoc/heredoc_empty2.tests
new file mode 100755
index 000000000..20fc35fe9
--- /dev/null
+++ b/shell/ash_test/ash-heredoc/heredoc_empty2.tests
@@ -0,0 +1,14 @@
1unset a
2
3# Heredoc with empty delimiter
4cat <<- ""
5 OK1
6
7echo Ok:$?
8
9# Heredoc with empty delimiter
10cat <<- ""
11 OK2
12
13
14echo Ok:$?
diff --git a/shell/ash_test/ash-misc/func_prio_over_builtins.right b/shell/ash_test/ash-misc/func_prio_over_builtins.right
new file mode 100644
index 000000000..54e56dff4
--- /dev/null
+++ b/shell/ash_test/ash-misc/func_prio_over_builtins.right
@@ -0,0 +1,5 @@
1YES
2YES
3YES
4YES
5Ok:YES
diff --git a/shell/ash_test/ash-misc/func_prio_over_builtins.tests b/shell/ash_test/ash-misc/func_prio_over_builtins.tests
new file mode 100755
index 000000000..4f71bfda0
--- /dev/null
+++ b/shell/ash_test/ash-misc/func_prio_over_builtins.tests
@@ -0,0 +1,5 @@
1true() { echo YES >&2; }
2true
3true | true
4(true)
5echo Ok:`true 2>&1`
diff --git a/shell/ash_test/ash-misc/func6.right b/shell/ash_test/ash-misc/func_return1.right
index 0ebd8e5a3..0ebd8e5a3 100644
--- a/shell/ash_test/ash-misc/func6.right
+++ b/shell/ash_test/ash-misc/func_return1.right
diff --git a/shell/ash_test/ash-misc/func6.tests b/shell/ash_test/ash-misc/func_return1.tests
index 029c3e85e..029c3e85e 100755
--- a/shell/ash_test/ash-misc/func6.tests
+++ b/shell/ash_test/ash-misc/func_return1.tests
diff --git a/shell/ash_test/ash-misc/func_return2.right b/shell/ash_test/ash-misc/func_return2.right
new file mode 100644
index 000000000..0ebd8e5a3
--- /dev/null
+++ b/shell/ash_test/ash-misc/func_return2.right
@@ -0,0 +1,2 @@
1Two:2
2Two:2
diff --git a/shell/ash_test/ash-misc/func_return2.tests b/shell/ash_test/ash-misc/func_return2.tests
new file mode 100755
index 000000000..a049dd180
--- /dev/null
+++ b/shell/ash_test/ash-misc/func_return2.tests
@@ -0,0 +1,6 @@
1f1() { return 2; }
2f1
3echo Two:$?
4false
5true | f1
6echo Two:$?
diff --git a/shell/ash_test/ash-redir/redir_script.tests b/shell/ash_test/ash-redir/redir_script.tests
index ccc497d7b..740daa461 100755
--- a/shell/ash_test/ash-redir/redir_script.tests
+++ b/shell/ash_test/ash-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?
22find_fds 22find_fds
23test x"$fds1" = x"$fds" && { echo "Ok: script fd is not closed"; exit 0; } 23test 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:
27test x"$fds1" = x" 10>&- 3>&-" && \
28test x"$fds" = x" 11>&- 3>&-" \
29&& { echo "Ok: script fd is not closed"; exit 0; }
24 30
25echo "Bug: script fd is closed" 31echo "Bug: script fd is closed"
26echo "fds1:$fds1" 32echo "fds1:$fds1"
27echo "fds2:$fds" 33echo "fds2:$fds"
28exit 1 34exit 1
29
diff --git a/shell/ash_test/ash-redir/redir_to_bad_fd255.right b/shell/ash_test/ash-redir/redir_to_bad_fd255.right
new file mode 100644
index 000000000..9c5e35b36
--- /dev/null
+++ b/shell/ash_test/ash-redir/redir_to_bad_fd255.right
@@ -0,0 +1,2 @@
1./redir_to_bad_fd255.tests: line 2: 255: Bad file descriptor
2OK
diff --git a/shell/ash_test/ash-redir/redir_to_bad_fd255.tests b/shell/ash_test/ash-redir/redir_to_bad_fd255.tests
new file mode 100755
index 000000000..2266af6da
--- /dev/null
+++ b/shell/ash_test/ash-redir/redir_to_bad_fd255.tests
@@ -0,0 +1,3 @@
1# ash uses fd 10 (usually) for reading the script
2echo LOST >&255
3echo OK
diff --git a/shell/ash_test/ash-redir/redir_to_bad_fd3.right b/shell/ash_test/ash-redir/redir_to_bad_fd3.right
new file mode 100644
index 000000000..895a4a0a6
--- /dev/null
+++ b/shell/ash_test/ash-redir/redir_to_bad_fd3.right
@@ -0,0 +1,2 @@
1./redir_to_bad_fd3.tests: line 2: 3: Bad file descriptor
2OK
diff --git a/shell/ash_test/ash-redir/redir_to_bad_fd3.tests b/shell/ash_test/ash-redir/redir_to_bad_fd3.tests
new file mode 100755
index 000000000..98c54cfc6
--- /dev/null
+++ b/shell/ash_test/ash-redir/redir_to_bad_fd3.tests
@@ -0,0 +1,3 @@
1# ash uses fd 10 (usually) for reading the script
2echo LOST >&3
3echo OK