summaryrefslogtreecommitdiff
path: root/release/src/router/busybox/shell/ash_test/ash-redir
diff options
context:
space:
mode:
Diffstat (limited to 'release/src/router/busybox/shell/ash_test/ash-redir')
-rw-r--r--release/src/router/busybox/shell/ash_test/ash-redir/redir.right1
-rwxr-xr-xrelease/src/router/busybox/shell/ash_test/ash-redir/redir.tests6
-rw-r--r--release/src/router/busybox/shell/ash_test/ash-redir/redir2.right1
-rwxr-xr-xrelease/src/router/busybox/shell/ash_test/ash-redir/redir2.tests5
-rw-r--r--release/src/router/busybox/shell/ash_test/ash-redir/redir3.right3
-rwxr-xr-xrelease/src/router/busybox/shell/ash_test/ash-redir/redir3.tests5
-rw-r--r--release/src/router/busybox/shell/ash_test/ash-redir/redir4.right1
-rwxr-xr-xrelease/src/router/busybox/shell/ash_test/ash-redir/redir4.tests72
-rw-r--r--release/src/router/busybox/shell/ash_test/ash-redir/redir5.right2
-rwxr-xr-xrelease/src/router/busybox/shell/ash_test/ash-redir/redir5.tests3
-rw-r--r--release/src/router/busybox/shell/ash_test/ash-redir/redir6.right2
-rwxr-xr-xrelease/src/router/busybox/shell/ash_test/ash-redir/redir6.tests3
12 files changed, 104 insertions, 0 deletions
diff --git a/release/src/router/busybox/shell/ash_test/ash-redir/redir.right b/release/src/router/busybox/shell/ash_test/ash-redir/redir.right
new file mode 100644
index 00000000..2a02d41c
--- /dev/null
+++ b/release/src/router/busybox/shell/ash_test/ash-redir/redir.right
@@ -0,0 +1 @@
+TEST
diff --git a/release/src/router/busybox/shell/ash_test/ash-redir/redir.tests b/release/src/router/busybox/shell/ash_test/ash-redir/redir.tests
new file mode 100755
index 00000000..7a1a6680
--- /dev/null
+++ b/release/src/router/busybox/shell/ash_test/ash-redir/redir.tests
@@ -0,0 +1,6 @@
+# test: closed fds should stay closed
+exec 1>&-
+echo TEST >TEST
+echo JUNK # lost: stdout is closed
+cat TEST >&2
+rm TEST
diff --git a/release/src/router/busybox/shell/ash_test/ash-redir/redir2.right b/release/src/router/busybox/shell/ash_test/ash-redir/redir2.right
new file mode 100644
index 00000000..d86bac9d
--- /dev/null
+++ b/release/src/router/busybox/shell/ash_test/ash-redir/redir2.right
@@ -0,0 +1 @@
+OK
diff --git a/release/src/router/busybox/shell/ash_test/ash-redir/redir2.tests b/release/src/router/busybox/shell/ash_test/ash-redir/redir2.tests
new file mode 100755
index 00000000..61ccea30
--- /dev/null
+++ b/release/src/router/busybox/shell/ash_test/ash-redir/redir2.tests
@@ -0,0 +1,5 @@
+# ash once couldn't redirect above fd#9
+exec 1>/dev/null
+(echo LOST1 >&22) 22>&1
+(echo LOST2 >&22) 22>&1
+(echo OK >&22) 22>&2
diff --git a/release/src/router/busybox/shell/ash_test/ash-redir/redir3.right b/release/src/router/busybox/shell/ash_test/ash-redir/redir3.right
new file mode 100644
index 00000000..fd641a8e
--- /dev/null
+++ b/release/src/router/busybox/shell/ash_test/ash-redir/redir3.right
@@ -0,0 +1,3 @@
+TEST
+./redir3.tests: line 4: 9: Bad file descriptor
+Output to fd#9: 1
diff --git a/release/src/router/busybox/shell/ash_test/ash-redir/redir3.tests b/release/src/router/busybox/shell/ash_test/ash-redir/redir3.tests
new file mode 100755
index 00000000..f50a7674
--- /dev/null
+++ b/release/src/router/busybox/shell/ash_test/ash-redir/redir3.tests
@@ -0,0 +1,5 @@
+# redirects to closed descriptors should not leave these descriptors"
+# open afterwards
+echo TEST 9>/dev/null
+echo MUST ERROR OUT >&9
+echo "Output to fd#9: $?"
diff --git a/release/src/router/busybox/shell/ash_test/ash-redir/redir4.right b/release/src/router/busybox/shell/ash_test/ash-redir/redir4.right
new file mode 100644
index 00000000..d86bac9d
--- /dev/null
+++ b/release/src/router/busybox/shell/ash_test/ash-redir/redir4.right
@@ -0,0 +1 @@
+OK
diff --git a/release/src/router/busybox/shell/ash_test/ash-redir/redir4.tests b/release/src/router/busybox/shell/ash_test/ash-redir/redir4.tests
new file mode 100755
index 00000000..4bdf5ae2
--- /dev/null
+++ b/release/src/router/busybox/shell/ash_test/ash-redir/redir4.tests
@@ -0,0 +1,72 @@
+# ash uses fd 10 (usually) for reading the script
+exec 13>&-
+exec 12>&-
+exec 11>&-
+exec 10>&-
+# some amount of input is prefetched.
+# make sure final echo is far enough to not be prefetched.
+###############################################################
+###############################################################
+###############################################################
+###############################################################
+###############################################################
+###############################################################
+###############################################################
+###############################################################
+###############################################################
+###############################################################
+###############################################################
+###############################################################
+###############################################################
+###############################################################
+###############################################################
+###############################################################
+###############################################################
+###############################################################
+###############################################################
+###############################################################
+###############################################################
+###############################################################
+###############################################################
+###############################################################
+###############################################################
+###############################################################
+###############################################################
+###############################################################
+###############################################################
+###############################################################
+###############################################################
+###############################################################
+###############################################################
+###############################################################
+###############################################################
+###############################################################
+###############################################################
+###############################################################
+###############################################################
+###############################################################
+###############################################################
+###############################################################
+###############################################################
+###############################################################
+###############################################################
+###############################################################
+###############################################################
+###############################################################
+###############################################################
+###############################################################
+###############################################################
+###############################################################
+###############################################################
+###############################################################
+###############################################################
+###############################################################
+###############################################################
+###############################################################
+###############################################################
+###############################################################
+###############################################################
+###############################################################
+###############################################################
+###############################################################
+echo "OK"
diff --git a/release/src/router/busybox/shell/ash_test/ash-redir/redir5.right b/release/src/router/busybox/shell/ash_test/ash-redir/redir5.right
new file mode 100644
index 00000000..9d087776
--- /dev/null
+++ b/release/src/router/busybox/shell/ash_test/ash-redir/redir5.right
@@ -0,0 +1,2 @@
+./redir5.tests: line 2: 10: Bad file descriptor
+OK
diff --git a/release/src/router/busybox/shell/ash_test/ash-redir/redir5.tests b/release/src/router/busybox/shell/ash_test/ash-redir/redir5.tests
new file mode 100755
index 00000000..91b0c1ff
--- /dev/null
+++ b/release/src/router/busybox/shell/ash_test/ash-redir/redir5.tests
@@ -0,0 +1,3 @@
+# ash uses fd 10 (usually) for reading the script
+echo LOST >&10
+echo OK
diff --git a/release/src/router/busybox/shell/ash_test/ash-redir/redir6.right b/release/src/router/busybox/shell/ash_test/ash-redir/redir6.right
new file mode 100644
index 00000000..ed754df7
--- /dev/null
+++ b/release/src/router/busybox/shell/ash_test/ash-redir/redir6.right
@@ -0,0 +1,2 @@
+Hello
+OK
diff --git a/release/src/router/busybox/shell/ash_test/ash-redir/redir6.tests b/release/src/router/busybox/shell/ash_test/ash-redir/redir6.tests
new file mode 100755
index 00000000..33b6d4cd
--- /dev/null
+++ b/release/src/router/busybox/shell/ash_test/ash-redir/redir6.tests
@@ -0,0 +1,3 @@
+# we had a bug where this would hang
+(head -n 1 <redir6.right)
+echo OK