summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko2017-07-24 02:49:56 +0200
committerDenys Vlasenko2017-07-24 02:49:56 +0200
commite34dbc4fdcae6e21bb186c225f76d399d2656d75 (patch)
treeddca2d6cb7209bd34e6775c26e211e0c6f49d0e7
parent0675b03de44b75f5f5fc7a54c164628e9ee01e9c (diff)
downloadbusybox-e34dbc4fdcae6e21bb186c225f76d399d2656d75.zip
busybox-e34dbc4fdcae6e21bb186c225f76d399d2656d75.tar.gz
ash: add all hush parsing tests to ast tests
All pass. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--shell/ash_test/ash-parsing/argv0.right1
-rwxr-xr-xshell/ash_test/ash-parsing/argv0.tests4
-rw-r--r--shell/ash_test/ash-parsing/brace1.right7
-rwxr-xr-xshell/ash_test/ash-parsing/brace1.tests7
-rw-r--r--shell/ash_test/ash-parsing/brace2.right3
-rwxr-xr-xshell/ash_test/ash-parsing/brace2.tests5
-rw-r--r--shell/ash_test/ash-parsing/comment1.right2
-rwxr-xr-xshell/ash_test/ash-parsing/comment1.tests2
-rw-r--r--shell/ash_test/ash-parsing/eol1.right1
-rwxr-xr-xshell/ash_test/ash-parsing/eol1.tests18
-rw-r--r--shell/ash_test/ash-parsing/escape1.right4
-rwxr-xr-xshell/ash_test/ash-parsing/escape1.tests6
-rw-r--r--shell/ash_test/ash-parsing/escape2.right4
-rwxr-xr-xshell/ash_test/ash-parsing/escape2.tests4
-rw-r--r--shell/ash_test/ash-parsing/escape3.right23
-rwxr-xr-xshell/ash_test/ash-parsing/escape3.tests10
-rw-r--r--shell/ash_test/ash-parsing/escape4.right2
-rwxr-xr-xshell/ash_test/ash-parsing/escape4.tests6
-rw-r--r--shell/ash_test/ash-parsing/escape5.right9
-rwxr-xr-xshell/ash_test/ash-parsing/escape5.tests7
-rw-r--r--shell/ash_test/ash-parsing/group1.right1
-rwxr-xr-xshell/ash_test/ash-parsing/group1.tests1
-rw-r--r--shell/ash_test/ash-parsing/group2.right2
-rwxr-xr-xshell/ash_test/ash-parsing/group2.tests3
-rw-r--r--shell/ash_test/ash-parsing/groups_and_keywords1.right11
-rwxr-xr-xshell/ash_test/ash-parsing/groups_and_keywords1.tests10
-rw-r--r--shell/ash_test/ash-parsing/negate.right36
-rwxr-xr-xshell/ash_test/ash-parsing/negate.tests19
-rw-r--r--shell/ash_test/ash-parsing/noeol.right1
-rwxr-xr-xshell/ash_test/ash-parsing/noeol.tests2
-rw-r--r--shell/ash_test/ash-parsing/noeol2.right1
-rwxr-xr-xshell/ash_test/ash-parsing/noeol2.tests7
-rw-r--r--shell/ash_test/ash-parsing/noeol3.right1
-rwxr-xr-xshell/ash_test/ash-parsing/noeol3.tests2
-rw-r--r--shell/ash_test/ash-parsing/process_subst.right3
-rwxr-xr-xshell/ash_test/ash-parsing/process_subst.tests3
-rw-r--r--shell/ash_test/ash-parsing/quote1.right1
-rwxr-xr-xshell/ash_test/ash-parsing/quote1.tests2
-rw-r--r--shell/ash_test/ash-parsing/quote2.right1
-rwxr-xr-xshell/ash_test/ash-parsing/quote2.tests2
-rw-r--r--shell/ash_test/ash-parsing/quote3.right12
-rwxr-xr-xshell/ash_test/ash-parsing/quote3.tests21
-rw-r--r--shell/ash_test/ash-parsing/quote4.right1
-rwxr-xr-xshell/ash_test/ash-parsing/quote4.tests2
-rw-r--r--shell/ash_test/ash-parsing/starquoted.right8
-rwxr-xr-xshell/ash_test/ash-parsing/starquoted.tests8
-rw-r--r--shell/ash_test/ash-parsing/starquoted2.right8
-rwxr-xr-xshell/ash_test/ash-parsing/starquoted2.tests19
-rwxr-xr-xshell/ash_test/run-all22
49 files changed, 331 insertions, 4 deletions
diff --git a/shell/ash_test/ash-parsing/argv0.right b/shell/ash_test/ash-parsing/argv0.right
new file mode 100644
index 0000000..d86bac9
--- /dev/null
+++ b/shell/ash_test/ash-parsing/argv0.right
@@ -0,0 +1 @@
+OK
diff --git a/shell/ash_test/ash-parsing/argv0.tests b/shell/ash_test/ash-parsing/argv0.tests
new file mode 100755
index 0000000..f5c40f6
--- /dev/null
+++ b/shell/ash_test/ash-parsing/argv0.tests
@@ -0,0 +1,4 @@
+if test $# = 0; then
+ exec "$THIS_SH" "$0" arg
+fi
+echo OK
diff --git a/shell/ash_test/ash-parsing/brace1.right b/shell/ash_test/ash-parsing/brace1.right
new file mode 100644
index 0000000..10aa7a4
--- /dev/null
+++ b/shell/ash_test/ash-parsing/brace1.right
@@ -0,0 +1,7 @@
+{abc}
+{
+}
+./brace1.tests: line 4: {cmd: not found
+./brace1.tests: line 5: {: not found
+./brace1.tests: line 6: {: not found
+Done: 127
diff --git a/shell/ash_test/ash-parsing/brace1.tests b/shell/ash_test/ash-parsing/brace1.tests
new file mode 100755
index 0000000..2b45927
--- /dev/null
+++ b/shell/ash_test/ash-parsing/brace1.tests
@@ -0,0 +1,7 @@
+echo {abc}
+echo {
+echo }
+{cmd
+""{
+{""
+echo Done: $?
diff --git a/shell/ash_test/ash-parsing/brace2.right b/shell/ash_test/ash-parsing/brace2.right
new file mode 100644
index 0000000..37a9666
--- /dev/null
+++ b/shell/ash_test/ash-parsing/brace2.right
@@ -0,0 +1,3 @@
+{q,w}
+{q,w}
+Done
diff --git a/shell/ash_test/ash-parsing/brace2.tests b/shell/ash_test/ash-parsing/brace2.tests
new file mode 100755
index 0000000..ef75f0b
--- /dev/null
+++ b/shell/ash_test/ash-parsing/brace2.tests
@@ -0,0 +1,5 @@
+v='{q,w}'
+# Should not brace-expand v value
+echo $v
+echo "$v"
+echo Done
diff --git a/shell/ash_test/ash-parsing/comment1.right b/shell/ash_test/ash-parsing/comment1.right
new file mode 100644
index 0000000..a102b1d
--- /dev/null
+++ b/shell/ash_test/ash-parsing/comment1.right
@@ -0,0 +1,2 @@
+Nothing:
+String: #should-be-echoed
diff --git a/shell/ash_test/ash-parsing/comment1.tests b/shell/ash_test/ash-parsing/comment1.tests
new file mode 100755
index 0000000..d268860
--- /dev/null
+++ b/shell/ash_test/ash-parsing/comment1.tests
@@ -0,0 +1,2 @@
+echo Nothing: #should-not-be-echoed
+echo String: ""#should-be-echoed
diff --git a/shell/ash_test/ash-parsing/eol1.right b/shell/ash_test/ash-parsing/eol1.right
new file mode 100644
index 0000000..31c896f
--- /dev/null
+++ b/shell/ash_test/ash-parsing/eol1.right
@@ -0,0 +1 @@
+Done:0
diff --git a/shell/ash_test/ash-parsing/eol1.tests b/shell/ash_test/ash-parsing/eol1.tests
new file mode 100755
index 0000000..f1b55e8
--- /dev/null
+++ b/shell/ash_test/ash-parsing/eol1.tests
@@ -0,0 +1,18 @@
+# bug was that we treated <newline> as ';' in this line:
+true || echo foo |
+echo BAD1 | cat
+
+# variation on the same theme
+true || echo foo |
+# comment
+echo BAD2 | cat
+
+# variation on the same theme
+true || echo foo |
+
+echo BAD3 | cat
+
+# this should error out, but currently works in hush:
+#true || echo foo |;
+
+echo Done:$?
diff --git a/shell/ash_test/ash-parsing/escape1.right b/shell/ash_test/ash-parsing/escape1.right
new file mode 100644
index 0000000..1899b87
--- /dev/null
+++ b/shell/ash_test/ash-parsing/escape1.right
@@ -0,0 +1,4 @@
+\
+a\b
+\\
+c\\d
diff --git a/shell/ash_test/ash-parsing/escape1.tests b/shell/ash_test/ash-parsing/escape1.tests
new file mode 100755
index 0000000..25ac96b
--- /dev/null
+++ b/shell/ash_test/ash-parsing/escape1.tests
@@ -0,0 +1,6 @@
+test "$CONFIG_FEATURE_FANCY_ECHO" = "y" || exit 77
+
+echo "\\"
+echo a"\\"b
+echo '\\'
+echo c'\\'d
diff --git a/shell/ash_test/ash-parsing/escape2.right b/shell/ash_test/ash-parsing/escape2.right
new file mode 100644
index 0000000..f55fd4a
--- /dev/null
+++ b/shell/ash_test/ash-parsing/escape2.right
@@ -0,0 +1,4 @@
+*?[a]*
+a*?[a]*b
+*?[a]*
+c*?[a]*d
diff --git a/shell/ash_test/ash-parsing/escape2.tests b/shell/ash_test/ash-parsing/escape2.tests
new file mode 100755
index 0000000..ee71801
--- /dev/null
+++ b/shell/ash_test/ash-parsing/escape2.tests
@@ -0,0 +1,4 @@
+echo "*?[a]*"
+echo a"*?[a]*"b
+echo '*?[a]*'
+echo c'*?[a]*'d
diff --git a/shell/ash_test/ash-parsing/escape3.right b/shell/ash_test/ash-parsing/escape3.right
new file mode 100644
index 0000000..da02a97
--- /dev/null
+++ b/shell/ash_test/ash-parsing/escape3.right
@@ -0,0 +1,23 @@
+v: a \ b \\ c \\\ d \\\\ e
+v: a \ b \\ c \\\ d \\\\ e
+Unquoted:
+.a.
+.\.
+.b.
+.\\.
+.c.
+.\\\.
+.d.
+.\\\\.
+.e.
+Quoted:
+.a.
+.\.
+.b.
+.\\.
+.c.
+.\\\.
+.d.
+.\\\\.
+.e.
+done
diff --git a/shell/ash_test/ash-parsing/escape3.tests b/shell/ash_test/ash-parsing/escape3.tests
new file mode 100755
index 0000000..18705bd
--- /dev/null
+++ b/shell/ash_test/ash-parsing/escape3.tests
@@ -0,0 +1,10 @@
+test "$CONFIG_FEATURE_FANCY_ECHO" = "y" || exit 77
+
+v='a \ b \\ c \\\ d \\\\ e'
+echo v: $v
+echo v: "$v"
+echo Unquoted:
+for a in $v; do echo .$a.; done
+echo Quoted:
+for a in $v; do echo ".$a."; done
+echo done
diff --git a/shell/ash_test/ash-parsing/escape4.right b/shell/ash_test/ash-parsing/escape4.right
new file mode 100644
index 0000000..5de3e0c
--- /dev/null
+++ b/shell/ash_test/ash-parsing/escape4.right
@@ -0,0 +1,2 @@
+Ok
+End
diff --git a/shell/ash_test/ash-parsing/escape4.tests b/shell/ash_test/ash-parsing/escape4.tests
new file mode 100755
index 0000000..df8bf0a
--- /dev/null
+++ b/shell/ash_test/ash-parsing/escape4.tests
@@ -0,0 +1,6 @@
+i\
+f tr\
+ue; th\
+en echo "O\
+k"; fi; echo "\
+End" \ No newline at end of file
diff --git a/shell/ash_test/ash-parsing/escape5.right b/shell/ash_test/ash-parsing/escape5.right
new file mode 100644
index 0000000..3cdd393
--- /dev/null
+++ b/shell/ash_test/ash-parsing/escape5.right
@@ -0,0 +1,9 @@
+a\nb\nc\n
+a
+b
+c
+a\nb\nc\n
+a
+b
+c
+Done
diff --git a/shell/ash_test/ash-parsing/escape5.tests b/shell/ash_test/ash-parsing/escape5.tests
new file mode 100755
index 0000000..337a98e
--- /dev/null
+++ b/shell/ash_test/ash-parsing/escape5.tests
@@ -0,0 +1,7 @@
+v="a\nb\nc\n"
+echo "$v"
+printf "$v"
+v='a\nb\nc\n'
+echo "$v"
+printf "$v"
+echo Done
diff --git a/shell/ash_test/ash-parsing/group1.right b/shell/ash_test/ash-parsing/group1.right
new file mode 100644
index 0000000..6a7c4be
--- /dev/null
+++ b/shell/ash_test/ash-parsing/group1.right
@@ -0,0 +1 @@
+word} }
diff --git a/shell/ash_test/ash-parsing/group1.tests b/shell/ash_test/ash-parsing/group1.tests
new file mode 100755
index 0000000..f063fbc
--- /dev/null
+++ b/shell/ash_test/ash-parsing/group1.tests
@@ -0,0 +1 @@
+{ echo word} }; }
diff --git a/shell/ash_test/ash-parsing/group2.right b/shell/ash_test/ash-parsing/group2.right
new file mode 100644
index 0000000..df4d930
--- /dev/null
+++ b/shell/ash_test/ash-parsing/group2.right
@@ -0,0 +1,2 @@
+got TERM
+Done: 0
diff --git a/shell/ash_test/ash-parsing/group2.tests b/shell/ash_test/ash-parsing/group2.tests
new file mode 100755
index 0000000..d991785
--- /dev/null
+++ b/shell/ash_test/ash-parsing/group2.tests
@@ -0,0 +1,3 @@
+# Bug was in handling of "}&" without space
+{ trap "echo got TERM" TERM; sleep 2; }& sleep 1; kill $!; wait
+echo Done: $?
diff --git a/shell/ash_test/ash-parsing/groups_and_keywords1.right b/shell/ash_test/ash-parsing/groups_and_keywords1.right
new file mode 100644
index 0000000..4c46650
--- /dev/null
+++ b/shell/ash_test/ash-parsing/groups_and_keywords1.right
@@ -0,0 +1,11 @@
+Semicolons after } can be omitted 1:
+foo
+bar
+Semicolons after } can be omitted 2:
+foo
+bar
+Semicolons after fi can be omitted:
+foo
+bar
+baz
+Done:0
diff --git a/shell/ash_test/ash-parsing/groups_and_keywords1.tests b/shell/ash_test/ash-parsing/groups_and_keywords1.tests
new file mode 100755
index 0000000..01944d7
--- /dev/null
+++ b/shell/ash_test/ash-parsing/groups_and_keywords1.tests
@@ -0,0 +1,10 @@
+echo "Semicolons after } can be omitted 1:"
+if { echo foo; } then { echo bar; } fi
+
+echo "Semicolons after } can be omitted 2:"
+while { echo foo; } do { echo bar; break; } done
+
+echo "Semicolons after fi can be omitted:"
+while if echo foo; then echo bar; fi do echo baz; break; done
+
+echo Done:$?
diff --git a/shell/ash_test/ash-parsing/negate.right b/shell/ash_test/ash-parsing/negate.right
new file mode 100644
index 0000000..61d2ecd
--- /dev/null
+++ b/shell/ash_test/ash-parsing/negate.right
@@ -0,0 +1,36 @@
+! printing !
+0
+1
+1
+0
+0
+0
+!
+a
+b
+c
+! 1
+a 1
+b 1
+c 1
+! 1
+a 1
+b 1
+c 1
+0
+0
+0
+0
+1
+1
+1
+1
+0
+0
+0
+0
+1
+1
+1
+1
+Done
diff --git a/shell/ash_test/ash-parsing/negate.tests b/shell/ash_test/ash-parsing/negate.tests
new file mode 100755
index 0000000..51151cb
--- /dev/null
+++ b/shell/ash_test/ash-parsing/negate.tests
@@ -0,0 +1,19 @@
+echo ! printing !
+! false
+echo $?
+! true
+echo $?
+if ! false; then false; echo $?; fi
+echo $?
+if ! false; then ! false; echo $?; fi
+echo $?
+PRINTF=`which printf`
+for a in ! a b c; do echo $a; done
+for a in ! a b c; do ! printf "$a "; echo $?; done
+test x"$PRINTF" = x"" && exit 1
+for a in ! a b c; do ! "$PRINTF" "$a "; echo $?; done
+for a in ! a b c; do ! printf "$a " | false; echo $?; done
+for a in ! a b c; do ! printf "$a " | true; echo $?; done
+for a in ! a b c; do ! { printf "$a " | false; }; echo $?; done
+for a in ! a b c; do ! { printf "$a " | true; }; echo $?; done
+echo Done
diff --git a/shell/ash_test/ash-parsing/noeol.right b/shell/ash_test/ash-parsing/noeol.right
new file mode 100644
index 0000000..e427984
--- /dev/null
+++ b/shell/ash_test/ash-parsing/noeol.right
@@ -0,0 +1 @@
+HELLO
diff --git a/shell/ash_test/ash-parsing/noeol.tests b/shell/ash_test/ash-parsing/noeol.tests
new file mode 100755
index 0000000..a93113a
--- /dev/null
+++ b/shell/ash_test/ash-parsing/noeol.tests
@@ -0,0 +1,2 @@
+# next line has no EOL!
+echo HELLO \ No newline at end of file
diff --git a/shell/ash_test/ash-parsing/noeol2.right b/shell/ash_test/ash-parsing/noeol2.right
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/shell/ash_test/ash-parsing/noeol2.right
@@ -0,0 +1 @@
+1
diff --git a/shell/ash_test/ash-parsing/noeol2.tests b/shell/ash_test/ash-parsing/noeol2.tests
new file mode 100755
index 0000000..1220f05
--- /dev/null
+++ b/shell/ash_test/ash-parsing/noeol2.tests
@@ -0,0 +1,7 @@
+# last line has no EOL!
+if true
+then
+ echo 1
+else
+ echo 2
+fi \ No newline at end of file
diff --git a/shell/ash_test/ash-parsing/noeol3.right b/shell/ash_test/ash-parsing/noeol3.right
new file mode 100644
index 0000000..c2a0e38
--- /dev/null
+++ b/shell/ash_test/ash-parsing/noeol3.right
@@ -0,0 +1 @@
+./noeol3.tests: line 2: syntax error: unterminated quoted string
diff --git a/shell/ash_test/ash-parsing/noeol3.tests b/shell/ash_test/ash-parsing/noeol3.tests
new file mode 100755
index 0000000..ec958ed
--- /dev/null
+++ b/shell/ash_test/ash-parsing/noeol3.tests
@@ -0,0 +1,2 @@
+# last line has no EOL!
+echo "unterminated \ No newline at end of file
diff --git a/shell/ash_test/ash-parsing/process_subst.right b/shell/ash_test/ash-parsing/process_subst.right
new file mode 100644
index 0000000..397bc80
--- /dev/null
+++ b/shell/ash_test/ash-parsing/process_subst.right
@@ -0,0 +1,3 @@
+TESTzzBEST
+TEST$(echo zz)BEST
+TEST'BEST
diff --git a/shell/ash_test/ash-parsing/process_subst.tests b/shell/ash_test/ash-parsing/process_subst.tests
new file mode 100755
index 0000000..21996bc
--- /dev/null
+++ b/shell/ash_test/ash-parsing/process_subst.tests
@@ -0,0 +1,3 @@
+echo "TEST`echo zz;echo;echo`BEST"
+echo "TEST`echo '$(echo zz)'`BEST"
+echo "TEST`echo "'"`BEST"
diff --git a/shell/ash_test/ash-parsing/quote1.right b/shell/ash_test/ash-parsing/quote1.right
new file mode 100644
index 0000000..cb38205
--- /dev/null
+++ b/shell/ash_test/ash-parsing/quote1.right
@@ -0,0 +1 @@
+'1'
diff --git a/shell/ash_test/ash-parsing/quote1.tests b/shell/ash_test/ash-parsing/quote1.tests
new file mode 100755
index 0000000..f558954
--- /dev/null
+++ b/shell/ash_test/ash-parsing/quote1.tests
@@ -0,0 +1,2 @@
+a=1
+echo "'$a'"
diff --git a/shell/ash_test/ash-parsing/quote2.right b/shell/ash_test/ash-parsing/quote2.right
new file mode 100644
index 0000000..3bc9edc
--- /dev/null
+++ b/shell/ash_test/ash-parsing/quote2.right
@@ -0,0 +1 @@
+>1
diff --git a/shell/ash_test/ash-parsing/quote2.tests b/shell/ash_test/ash-parsing/quote2.tests
new file mode 100755
index 0000000..bd966f3
--- /dev/null
+++ b/shell/ash_test/ash-parsing/quote2.tests
@@ -0,0 +1,2 @@
+a=1
+echo ">$a"
diff --git a/shell/ash_test/ash-parsing/quote3.right b/shell/ash_test/ash-parsing/quote3.right
new file mode 100644
index 0000000..bbe46df
--- /dev/null
+++ b/shell/ash_test/ash-parsing/quote3.right
@@ -0,0 +1,12 @@
+Testing: in ""
+..
+Testing: in ''
+..
+Testing: in $empty
+Testing: in $empty""
+..
+Testing: in $empty''
+..
+Testing: in "$empty"
+..
+Finished
diff --git a/shell/ash_test/ash-parsing/quote3.tests b/shell/ash_test/ash-parsing/quote3.tests
new file mode 100755
index 0000000..b5fd597
--- /dev/null
+++ b/shell/ash_test/ash-parsing/quote3.tests
@@ -0,0 +1,21 @@
+empty=''
+
+echo 'Testing: in ""'
+for a in ""; do echo ".$a."; done
+
+echo 'Testing: in '"''"
+for a in ''; do echo ".$a."; done
+
+echo 'Testing: in $empty'
+for a in $empty; do echo ".$a."; done
+
+echo 'Testing: in $empty""'
+for a in $empty""; do echo ".$a."; done
+
+echo 'Testing: in $empty'"''"
+for a in $empty''; do echo ".$a."; done
+
+echo 'Testing: in "$empty"'
+for a in "$empty"; do echo ".$a."; done
+
+echo Finished
diff --git a/shell/ash_test/ash-parsing/quote4.right b/shell/ash_test/ash-parsing/quote4.right
new file mode 100644
index 0000000..b2901ea
--- /dev/null
+++ b/shell/ash_test/ash-parsing/quote4.right
@@ -0,0 +1 @@
+a b
diff --git a/shell/ash_test/ash-parsing/quote4.tests b/shell/ash_test/ash-parsing/quote4.tests
new file mode 100755
index 0000000..f1dabfa
--- /dev/null
+++ b/shell/ash_test/ash-parsing/quote4.tests
@@ -0,0 +1,2 @@
+a_b='a b'
+echo "$a_b"
diff --git a/shell/ash_test/ash-parsing/starquoted.right b/shell/ash_test/ash-parsing/starquoted.right
new file mode 100644
index 0000000..b56323f
--- /dev/null
+++ b/shell/ash_test/ash-parsing/starquoted.right
@@ -0,0 +1,8 @@
+.1 abc d e f.
+.1.
+.abc.
+.d e f.
+.-1 abc d e f-.
+.-1.
+.abc.
+.d e f-.
diff --git a/shell/ash_test/ash-parsing/starquoted.tests b/shell/ash_test/ash-parsing/starquoted.tests
new file mode 100755
index 0000000..2fe49b1
--- /dev/null
+++ b/shell/ash_test/ash-parsing/starquoted.tests
@@ -0,0 +1,8 @@
+if test $# = 0; then
+ exec "$THIS_SH" "$0" 1 abc 'd e f'
+fi
+
+for a in "$*"; do echo ".$a."; done
+for a in "$@"; do echo ".$a."; done
+for a in "-$*-"; do echo ".$a."; done
+for a in "-$@-"; do echo ".$a."; done
diff --git a/shell/ash_test/ash-parsing/starquoted2.right b/shell/ash_test/ash-parsing/starquoted2.right
new file mode 100644
index 0000000..1bff408
--- /dev/null
+++ b/shell/ash_test/ash-parsing/starquoted2.right
@@ -0,0 +1,8 @@
+Should be printed
+Would not be printed by bash
+Would not be printed by bash
+Would not be printed by bash
+Should be printed
+Empty:
+Empty:
+Empty:
diff --git a/shell/ash_test/ash-parsing/starquoted2.tests b/shell/ash_test/ash-parsing/starquoted2.tests
new file mode 100755
index 0000000..7c5ff45
--- /dev/null
+++ b/shell/ash_test/ash-parsing/starquoted2.tests
@@ -0,0 +1,19 @@
+if test $# != 0; then
+ exec "$THIS_SH" "$0"
+fi
+
+# No params!
+for a in "$*"; do echo Should be printed; done
+for a in "$@"; do echo Should not be printed; done
+# Yes, believe it or not, bash is mesmerized by "$@" and stops
+# treating "" as "this word cannot be expanded to nothing,
+# but must be at least null string". Now it can be expanded to nothing.
+for a in "$@"""; do echo Would not be printed by bash; done
+for a in """$@"; do echo Would not be printed by bash; done
+for a in """$@"''"$@"''; do echo Would not be printed by bash; done
+for a in ""; do echo Should be printed; done
+
+# Bug 207: "$@" expands to nothing, and we erroneously glob "%s\n" twice:
+printf 'Empty:%s\n' "$@"
+printf "Empty:%s\n" "$@"
+printf "Empty:%s\\n" "$@"
diff --git a/shell/ash_test/run-all b/shell/ash_test/run-all
index 983e6d1..caf0335 100755
--- a/shell/ash_test/run-all
+++ b/shell/ash_test/run-all
@@ -2,10 +2,24 @@
TOPDIR=`pwd`
-test -x ash || {
- echo "No ./ash - creating a link to ../../busybox"
- ln -s ../../busybox ash
-}
+if test ! -x ash; then
+ if test ! -x ../../busybox; then
+ echo "Can't run tests. Put ash binary into this directory (`pwd`)"
+ exit 1
+ fi
+ echo "No ./ash - creating a link to ../../busybox"
+ ln -s ../../busybox ash
+fi
+if test ! -f .config; then
+ if test ! -f ../../.config; then
+ echo "Missing .config file"
+ exit 1
+ fi
+ cp ../../.config . || exit 1
+fi
+
+eval $(sed -e '/^#/d' -e '/^$/d' -e 's:^:export :' .config)
+
test -x printenv || gcc -O2 -o printenv printenv.c || exit $?
test -x recho || gcc -O2 -o recho recho.c || exit $?
test -x zecho || gcc -O2 -o zecho zecho.c || exit $?