ash: add most of hush process subst tests
authorDenys Vlasenko <vda.linux@googlemail.com>
Mon, 24 Jul 2017 10:49:49 +0000 (12:49 +0200)
committerDenys Vlasenko <vda.linux@googlemail.com>
Mon, 24 Jul 2017 10:49:49 +0000 (12:49 +0200)
ash passes these.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 files changed:
shell/ash_test/ash-psubst/emptytick.right [new file with mode: 0644]
shell/ash_test/ash-psubst/emptytick.tests [new file with mode: 0755]
shell/ash_test/ash-psubst/tick.right [new file with mode: 0644]
shell/ash_test/ash-psubst/tick.tests [new file with mode: 0755]
shell/ash_test/ash-psubst/tick2.right [new file with mode: 0644]
shell/ash_test/ash-psubst/tick2.tests [new file with mode: 0755]
shell/ash_test/ash-psubst/tick3.right [new file with mode: 0644]
shell/ash_test/ash-psubst/tick3.tests [new file with mode: 0755]
shell/ash_test/ash-psubst/tick4.right [new file with mode: 0644]
shell/ash_test/ash-psubst/tick4.tests [new file with mode: 0755]
shell/ash_test/ash-psubst/tick_huge.right [new file with mode: 0644]
shell/ash_test/ash-psubst/tick_huge.tests [new file with mode: 0755]

diff --git a/shell/ash_test/ash-psubst/emptytick.right b/shell/ash_test/ash-psubst/emptytick.right
new file mode 100644 (file)
index 0000000..7629deb
--- /dev/null
@@ -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 (executable)
index 0000000..eaffafb
--- /dev/null
@@ -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 (file)
index 0000000..6ed281c
--- /dev/null
@@ -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 (executable)
index 0000000..1f749a9
--- /dev/null
@@ -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 (file)
index 0000000..216c883
--- /dev/null
@@ -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 (executable)
index 0000000..db4e944
--- /dev/null
@@ -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 (file)
index 0000000..00f267a
--- /dev/null
@@ -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 (executable)
index 0000000..3aeb241
--- /dev/null
@@ -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 (file)
index 0000000..d8030ea
--- /dev/null
@@ -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 (executable)
index 0000000..f2305fb
--- /dev/null
@@ -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 (file)
index 0000000..11740f6
--- /dev/null
@@ -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 (executable)
index 0000000..acce92f
--- /dev/null
@@ -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