summaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorDenys Vlasenko2017-07-24 12:49:49 +0200
committerDenys Vlasenko2017-07-24 12:49:49 +0200
commit4a1d8f6d6e4e1cafc4c2b611126401bf85812a64 (patch)
tree8b8c9b4e007ac25337d33883876a51dc0a09aeea /shell
parent621fc50e83f7446a060f0b9689dc8dc59ee0743a (diff)
downloadbusybox-4a1d8f6d6e4e1cafc4c2b611126401bf85812a64.zip
busybox-4a1d8f6d6e4e1cafc4c2b611126401bf85812a64.tar.gz
ash: add most of hush process subst tests
ash passes these. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell')
-rw-r--r--shell/ash_test/ash-psubst/emptytick.right17
-rwxr-xr-xshell/ash_test/ash-psubst/emptytick.tests16
-rw-r--r--shell/ash_test/ash-psubst/tick.right2
-rwxr-xr-xshell/ash_test/ash-psubst/tick.tests4
-rw-r--r--shell/ash_test/ash-psubst/tick2.right1
-rwxr-xr-xshell/ash_test/ash-psubst/tick2.tests5
-rw-r--r--shell/ash_test/ash-psubst/tick3.right6
-rwxr-xr-xshell/ash_test/ash-psubst/tick3.tests14
-rw-r--r--shell/ash_test/ash-psubst/tick4.right7
-rwxr-xr-xshell/ash_test/ash-psubst/tick4.tests7
-rw-r--r--shell/ash_test/ash-psubst/tick_huge.right3
-rwxr-xr-xshell/ash_test/ash-psubst/tick_huge.tests7
12 files changed, 89 insertions, 0 deletions
diff --git a/shell/ash_test/ash-psubst/emptytick.right b/shell/ash_test/ash-psubst/emptytick.right
new file mode 100644
index 0000000..7629deb
--- /dev/null
+++ b/shell/ash_test/ash-psubst/emptytick.right
@@ -0,0 +1,17 @@
+0
+0
+./emptytick.tests: line 3: : Permission denied
+127
+./emptytick.tests: line 4: : Permission denied
+127
+0
+0
+0
+0
+./emptytick.tests: line 10: : Permission denied
+127
+./emptytick.tests: line 11: : Permission denied
+127
+0
+0
+./emptytick.tests: exec: line 15: : Permission denied
diff --git a/shell/ash_test/ash-psubst/emptytick.tests b/shell/ash_test/ash-psubst/emptytick.tests
new file mode 100755
index 0000000..eaffafb
--- /dev/null
+++ b/shell/ash_test/ash-psubst/emptytick.tests
@@ -0,0 +1,16 @@
+true; ``; echo $?
+false; ``; echo $?
+true; `""`; echo $?
+false; `""`; echo $?
+true; ` `; echo $?
+false; ` `; echo $?
+
+true; $(); echo $?
+false; $(); echo $?
+true; $(""); echo $?
+false; $(""); echo $?
+true; $( ); echo $?
+false; $( ); echo $?
+
+exec ''; echo $?
+echo Not reached
diff --git a/shell/ash_test/ash-psubst/tick.right b/shell/ash_test/ash-psubst/tick.right
new file mode 100644
index 0000000..6ed281c
--- /dev/null
+++ b/shell/ash_test/ash-psubst/tick.right
@@ -0,0 +1,2 @@
+1
+1
diff --git a/shell/ash_test/ash-psubst/tick.tests b/shell/ash_test/ash-psubst/tick.tests
new file mode 100755
index 0000000..1f749a9
--- /dev/null
+++ b/shell/ash_test/ash-psubst/tick.tests
@@ -0,0 +1,4 @@
+true
+false; echo `echo $?`
+true
+{ false; echo `echo $?`; }
diff --git a/shell/ash_test/ash-psubst/tick2.right b/shell/ash_test/ash-psubst/tick2.right
new file mode 100644
index 0000000..216c883
--- /dev/null
+++ b/shell/ash_test/ash-psubst/tick2.right
@@ -0,0 +1 @@
+BAZ
diff --git a/shell/ash_test/ash-psubst/tick2.tests b/shell/ash_test/ash-psubst/tick2.tests
new file mode 100755
index 0000000..db4e944
--- /dev/null
+++ b/shell/ash_test/ash-psubst/tick2.tests
@@ -0,0 +1,5 @@
+if false; then
+ echo "FOO"
+ tmp=`echo BAR >&2`
+fi
+echo BAZ
diff --git a/shell/ash_test/ash-psubst/tick3.right b/shell/ash_test/ash-psubst/tick3.right
new file mode 100644
index 0000000..00f267a
--- /dev/null
+++ b/shell/ash_test/ash-psubst/tick3.right
@@ -0,0 +1,6 @@
+\TESTZZBEST
+$TEST
+Q
+a\bc
+11-$a-\t-\-\"-`-\--\z-\*-\?-22 33-$a-\t-\-"-`-\--\z-\*-\?-44
+done:0
diff --git a/shell/ash_test/ash-psubst/tick3.tests b/shell/ash_test/ash-psubst/tick3.tests
new file mode 100755
index 0000000..3aeb241
--- /dev/null
+++ b/shell/ash_test/ash-psubst/tick3.tests
@@ -0,0 +1,14 @@
+test "$CONFIG_FEATURE_FANCY_ECHO" = "y" || exit 77
+
+TEST=Q
+# \` is special
+echo `echo '\'TEST\`echo ZZ\`BEST`
+# \$ and \\ are special
+echo `echo \\$TEST`
+echo `echo \$TEST`
+echo a`echo \\\\b`c
+
+# \" is not special if in unquoted `cmd` (passed verbatim WITH \),
+# but is special in quoted one
+echo `echo 11'-$a-\t-\\-\"-\`-\--\z-\*-\?-'22` "`echo 33'-$a-\t-\\-\"-\`-\--\z-\*-\?-'44`"
+echo done:$?
diff --git a/shell/ash_test/ash-psubst/tick4.right b/shell/ash_test/ash-psubst/tick4.right
new file mode 100644
index 0000000..d8030ea
--- /dev/null
+++ b/shell/ash_test/ash-psubst/tick4.right
@@ -0,0 +1,7 @@
+(TEST) BEST
+TEST) BEST
+((TEST) BEST
+)
+abc
+a)c
+OK: 0
diff --git a/shell/ash_test/ash-psubst/tick4.tests b/shell/ash_test/ash-psubst/tick4.tests
new file mode 100755
index 0000000..f2305fb
--- /dev/null
+++ b/shell/ash_test/ash-psubst/tick4.tests
@@ -0,0 +1,7 @@
+echo $(echo '(TEST)' BEST)
+echo $(echo 'TEST)' BEST)
+echo $(echo \(\(TEST\) BEST)
+echo $(echo \))
+echo $(echo a"`echo "b"`"c )
+echo $(echo a"`echo ")"`"c )
+echo OK: $?
diff --git a/shell/ash_test/ash-psubst/tick_huge.right b/shell/ash_test/ash-psubst/tick_huge.right
new file mode 100644
index 0000000..11740f6
--- /dev/null
+++ b/shell/ash_test/ash-psubst/tick_huge.right
@@ -0,0 +1,3 @@
+546ed3f5c81c780d3ab86ada14824237 -
+546ed3f5c81c780d3ab86ada14824237 -
+End
diff --git a/shell/ash_test/ash-psubst/tick_huge.tests b/shell/ash_test/ash-psubst/tick_huge.tests
new file mode 100755
index 0000000..acce92f
--- /dev/null
+++ b/shell/ash_test/ash-psubst/tick_huge.tests
@@ -0,0 +1,7 @@
+# This creates 120k file
+yes "123456789 123456789 123456789 123456789" | head -3000 >>"$0.tmp"
+
+echo "`cat $0.tmp`" | md5sum
+rm "$0.tmp"
+yes "123456789 123456789 123456789 123456789" | head -3000 | md5sum
+echo End