diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2017-07-24 02:49:56 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2017-07-24 02:49:56 +0200 |
commit | e34dbc4fdcae6e21bb186c225f76d399d2656d75 (patch) | |
tree | ddca2d6cb7209bd34e6775c26e211e0c6f49d0e7 | |
parent | 0675b03de44b75f5f5fc7a54c164628e9ee01e9c (diff) | |
download | busybox-w32-e34dbc4fdcae6e21bb186c225f76d399d2656d75.tar.gz busybox-w32-e34dbc4fdcae6e21bb186c225f76d399d2656d75.tar.bz2 busybox-w32-e34dbc4fdcae6e21bb186c225f76d399d2656d75.zip |
ash: add all hush parsing tests to ast tests
All pass.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
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 000000000..d86bac9de --- /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 000000000..f5c40f6fe --- /dev/null +++ b/shell/ash_test/ash-parsing/argv0.tests | |||
@@ -0,0 +1,4 @@ | |||
1 | if test $# = 0; then | ||
2 | exec "$THIS_SH" "$0" arg | ||
3 | fi | ||
4 | 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 000000000..10aa7a419 --- /dev/null +++ b/shell/ash_test/ash-parsing/brace1.right | |||
@@ -0,0 +1,7 @@ | |||
1 | {abc} | ||
2 | { | ||
3 | } | ||
4 | ./brace1.tests: line 4: {cmd: not found | ||
5 | ./brace1.tests: line 5: {: not found | ||
6 | ./brace1.tests: line 6: {: not found | ||
7 | 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 000000000..2b45927c0 --- /dev/null +++ b/shell/ash_test/ash-parsing/brace1.tests | |||
@@ -0,0 +1,7 @@ | |||
1 | echo {abc} | ||
2 | echo { | ||
3 | echo } | ||
4 | {cmd | ||
5 | ""{ | ||
6 | {"" | ||
7 | 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 000000000..37a966654 --- /dev/null +++ b/shell/ash_test/ash-parsing/brace2.right | |||
@@ -0,0 +1,3 @@ | |||
1 | {q,w} | ||
2 | {q,w} | ||
3 | Done | ||
diff --git a/shell/ash_test/ash-parsing/brace2.tests b/shell/ash_test/ash-parsing/brace2.tests new file mode 100755 index 000000000..ef75f0b70 --- /dev/null +++ b/shell/ash_test/ash-parsing/brace2.tests | |||
@@ -0,0 +1,5 @@ | |||
1 | v='{q,w}' | ||
2 | # Should not brace-expand v value | ||
3 | echo $v | ||
4 | echo "$v" | ||
5 | 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 000000000..a102b1d4e --- /dev/null +++ b/shell/ash_test/ash-parsing/comment1.right | |||
@@ -0,0 +1,2 @@ | |||
1 | Nothing: | ||
2 | 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 000000000..d268860ff --- /dev/null +++ b/shell/ash_test/ash-parsing/comment1.tests | |||
@@ -0,0 +1,2 @@ | |||
1 | echo Nothing: #should-not-be-echoed | ||
2 | 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 000000000..31c896f62 --- /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 000000000..f1b55e8b8 --- /dev/null +++ b/shell/ash_test/ash-parsing/eol1.tests | |||
@@ -0,0 +1,18 @@ | |||
1 | # bug was that we treated <newline> as ';' in this line: | ||
2 | true || echo foo | | ||
3 | echo BAD1 | cat | ||
4 | |||
5 | # variation on the same theme | ||
6 | true || echo foo | | ||
7 | # comment | ||
8 | echo BAD2 | cat | ||
9 | |||
10 | # variation on the same theme | ||
11 | true || echo foo | | ||
12 | |||
13 | echo BAD3 | cat | ||
14 | |||
15 | # this should error out, but currently works in hush: | ||
16 | #true || echo foo |; | ||
17 | |||
18 | 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 000000000..1899b87ef --- /dev/null +++ b/shell/ash_test/ash-parsing/escape1.right | |||
@@ -0,0 +1,4 @@ | |||
1 | \ | ||
2 | a\b | ||
3 | \\ | ||
4 | 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 000000000..25ac96b25 --- /dev/null +++ b/shell/ash_test/ash-parsing/escape1.tests | |||
@@ -0,0 +1,6 @@ | |||
1 | test "$CONFIG_FEATURE_FANCY_ECHO" = "y" || exit 77 | ||
2 | |||
3 | echo "\\" | ||
4 | echo a"\\"b | ||
5 | echo '\\' | ||
6 | 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 000000000..f55fd4a42 --- /dev/null +++ b/shell/ash_test/ash-parsing/escape2.right | |||
@@ -0,0 +1,4 @@ | |||
1 | *?[a]* | ||
2 | a*?[a]*b | ||
3 | *?[a]* | ||
4 | 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 000000000..ee718018d --- /dev/null +++ b/shell/ash_test/ash-parsing/escape2.tests | |||
@@ -0,0 +1,4 @@ | |||
1 | echo "*?[a]*" | ||
2 | echo a"*?[a]*"b | ||
3 | echo '*?[a]*' | ||
4 | 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 000000000..da02a976a --- /dev/null +++ b/shell/ash_test/ash-parsing/escape3.right | |||
@@ -0,0 +1,23 @@ | |||
1 | v: a \ b \\ c \\\ d \\\\ e | ||
2 | v: a \ b \\ c \\\ d \\\\ e | ||
3 | Unquoted: | ||
4 | .a. | ||
5 | .\. | ||
6 | .b. | ||
7 | .\\. | ||
8 | .c. | ||
9 | .\\\. | ||
10 | .d. | ||
11 | .\\\\. | ||
12 | .e. | ||
13 | Quoted: | ||
14 | .a. | ||
15 | .\. | ||
16 | .b. | ||
17 | .\\. | ||
18 | .c. | ||
19 | .\\\. | ||
20 | .d. | ||
21 | .\\\\. | ||
22 | .e. | ||
23 | done | ||
diff --git a/shell/ash_test/ash-parsing/escape3.tests b/shell/ash_test/ash-parsing/escape3.tests new file mode 100755 index 000000000..18705bd0c --- /dev/null +++ b/shell/ash_test/ash-parsing/escape3.tests | |||
@@ -0,0 +1,10 @@ | |||
1 | test "$CONFIG_FEATURE_FANCY_ECHO" = "y" || exit 77 | ||
2 | |||
3 | v='a \ b \\ c \\\ d \\\\ e' | ||
4 | echo v: $v | ||
5 | echo v: "$v" | ||
6 | echo Unquoted: | ||
7 | for a in $v; do echo .$a.; done | ||
8 | echo Quoted: | ||
9 | for a in $v; do echo ".$a."; done | ||
10 | 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 000000000..5de3e0c90 --- /dev/null +++ b/shell/ash_test/ash-parsing/escape4.right | |||
@@ -0,0 +1,2 @@ | |||
1 | Ok | ||
2 | End | ||
diff --git a/shell/ash_test/ash-parsing/escape4.tests b/shell/ash_test/ash-parsing/escape4.tests new file mode 100755 index 000000000..df8bf0af7 --- /dev/null +++ b/shell/ash_test/ash-parsing/escape4.tests | |||
@@ -0,0 +1,6 @@ | |||
1 | i\ | ||
2 | f tr\ | ||
3 | ue; th\ | ||
4 | en echo "O\ | ||
5 | k"; fi; echo "\ | ||
6 | 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 000000000..3cdd393c7 --- /dev/null +++ b/shell/ash_test/ash-parsing/escape5.right | |||
@@ -0,0 +1,9 @@ | |||
1 | a\nb\nc\n | ||
2 | a | ||
3 | b | ||
4 | c | ||
5 | a\nb\nc\n | ||
6 | a | ||
7 | b | ||
8 | c | ||
9 | Done | ||
diff --git a/shell/ash_test/ash-parsing/escape5.tests b/shell/ash_test/ash-parsing/escape5.tests new file mode 100755 index 000000000..337a98ec7 --- /dev/null +++ b/shell/ash_test/ash-parsing/escape5.tests | |||
@@ -0,0 +1,7 @@ | |||
1 | v="a\nb\nc\n" | ||
2 | echo "$v" | ||
3 | printf "$v" | ||
4 | v='a\nb\nc\n' | ||
5 | echo "$v" | ||
6 | printf "$v" | ||
7 | 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 000000000..6a7c4be0a --- /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 000000000..f063fbcb3 --- /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 000000000..df4d9306a --- /dev/null +++ b/shell/ash_test/ash-parsing/group2.right | |||
@@ -0,0 +1,2 @@ | |||
1 | got TERM | ||
2 | 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 000000000..d99178585 --- /dev/null +++ b/shell/ash_test/ash-parsing/group2.tests | |||
@@ -0,0 +1,3 @@ | |||
1 | # Bug was in handling of "}&" without space | ||
2 | { trap "echo got TERM" TERM; sleep 2; }& sleep 1; kill $!; wait | ||
3 | 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 000000000..4c46650dc --- /dev/null +++ b/shell/ash_test/ash-parsing/groups_and_keywords1.right | |||
@@ -0,0 +1,11 @@ | |||
1 | Semicolons after } can be omitted 1: | ||
2 | foo | ||
3 | bar | ||
4 | Semicolons after } can be omitted 2: | ||
5 | foo | ||
6 | bar | ||
7 | Semicolons after fi can be omitted: | ||
8 | foo | ||
9 | bar | ||
10 | baz | ||
11 | 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 000000000..01944d714 --- /dev/null +++ b/shell/ash_test/ash-parsing/groups_and_keywords1.tests | |||
@@ -0,0 +1,10 @@ | |||
1 | echo "Semicolons after } can be omitted 1:" | ||
2 | if { echo foo; } then { echo bar; } fi | ||
3 | |||
4 | echo "Semicolons after } can be omitted 2:" | ||
5 | while { echo foo; } do { echo bar; break; } done | ||
6 | |||
7 | echo "Semicolons after fi can be omitted:" | ||
8 | while if echo foo; then echo bar; fi do echo baz; break; done | ||
9 | |||
10 | 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 000000000..61d2ecd3a --- /dev/null +++ b/shell/ash_test/ash-parsing/negate.right | |||
@@ -0,0 +1,36 @@ | |||
1 | ! printing ! | ||
2 | 0 | ||
3 | 1 | ||
4 | 1 | ||
5 | 0 | ||
6 | 0 | ||
7 | 0 | ||
8 | ! | ||
9 | a | ||
10 | b | ||
11 | c | ||
12 | ! 1 | ||
13 | a 1 | ||
14 | b 1 | ||
15 | c 1 | ||
16 | ! 1 | ||
17 | a 1 | ||
18 | b 1 | ||
19 | c 1 | ||
20 | 0 | ||
21 | 0 | ||
22 | 0 | ||
23 | 0 | ||
24 | 1 | ||
25 | 1 | ||
26 | 1 | ||
27 | 1 | ||
28 | 0 | ||
29 | 0 | ||
30 | 0 | ||
31 | 0 | ||
32 | 1 | ||
33 | 1 | ||
34 | 1 | ||
35 | 1 | ||
36 | Done | ||
diff --git a/shell/ash_test/ash-parsing/negate.tests b/shell/ash_test/ash-parsing/negate.tests new file mode 100755 index 000000000..51151cbd4 --- /dev/null +++ b/shell/ash_test/ash-parsing/negate.tests | |||
@@ -0,0 +1,19 @@ | |||
1 | echo ! printing ! | ||
2 | ! false | ||
3 | echo $? | ||
4 | ! true | ||
5 | echo $? | ||
6 | if ! false; then false; echo $?; fi | ||
7 | echo $? | ||
8 | if ! false; then ! false; echo $?; fi | ||
9 | echo $? | ||
10 | PRINTF=`which printf` | ||
11 | for a in ! a b c; do echo $a; done | ||
12 | for a in ! a b c; do ! printf "$a "; echo $?; done | ||
13 | test x"$PRINTF" = x"" && exit 1 | ||
14 | for a in ! a b c; do ! "$PRINTF" "$a "; echo $?; done | ||
15 | for a in ! a b c; do ! printf "$a " | false; echo $?; done | ||
16 | for a in ! a b c; do ! printf "$a " | true; echo $?; done | ||
17 | for a in ! a b c; do ! { printf "$a " | false; }; echo $?; done | ||
18 | for a in ! a b c; do ! { printf "$a " | true; }; echo $?; done | ||
19 | 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 000000000..e427984d4 --- /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 000000000..a93113a03 --- /dev/null +++ b/shell/ash_test/ash-parsing/noeol.tests | |||
@@ -0,0 +1,2 @@ | |||
1 | # next line has no EOL! | ||
2 | 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 000000000..d00491fd7 --- /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 000000000..1220f056f --- /dev/null +++ b/shell/ash_test/ash-parsing/noeol2.tests | |||
@@ -0,0 +1,7 @@ | |||
1 | # last line has no EOL! | ||
2 | if true | ||
3 | then | ||
4 | echo 1 | ||
5 | else | ||
6 | echo 2 | ||
7 | 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 000000000..c2a0e38f8 --- /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 000000000..ec958ed7a --- /dev/null +++ b/shell/ash_test/ash-parsing/noeol3.tests | |||
@@ -0,0 +1,2 @@ | |||
1 | # last line has no EOL! | ||
2 | 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 000000000..397bc8067 --- /dev/null +++ b/shell/ash_test/ash-parsing/process_subst.right | |||
@@ -0,0 +1,3 @@ | |||
1 | TESTzzBEST | ||
2 | TEST$(echo zz)BEST | ||
3 | 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 000000000..21996bc0e --- /dev/null +++ b/shell/ash_test/ash-parsing/process_subst.tests | |||
@@ -0,0 +1,3 @@ | |||
1 | echo "TEST`echo zz;echo;echo`BEST" | ||
2 | echo "TEST`echo '$(echo zz)'`BEST" | ||
3 | 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 000000000..cb382054c --- /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 000000000..f55895466 --- /dev/null +++ b/shell/ash_test/ash-parsing/quote1.tests | |||
@@ -0,0 +1,2 @@ | |||
1 | a=1 | ||
2 | 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 000000000..3bc9edcd6 --- /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 000000000..bd966f30b --- /dev/null +++ b/shell/ash_test/ash-parsing/quote2.tests | |||
@@ -0,0 +1,2 @@ | |||
1 | a=1 | ||
2 | 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 000000000..bbe46df67 --- /dev/null +++ b/shell/ash_test/ash-parsing/quote3.right | |||
@@ -0,0 +1,12 @@ | |||
1 | Testing: in "" | ||
2 | .. | ||
3 | Testing: in '' | ||
4 | .. | ||
5 | Testing: in $empty | ||
6 | Testing: in $empty"" | ||
7 | .. | ||
8 | Testing: in $empty'' | ||
9 | .. | ||
10 | Testing: in "$empty" | ||
11 | .. | ||
12 | Finished | ||
diff --git a/shell/ash_test/ash-parsing/quote3.tests b/shell/ash_test/ash-parsing/quote3.tests new file mode 100755 index 000000000..b5fd5978c --- /dev/null +++ b/shell/ash_test/ash-parsing/quote3.tests | |||
@@ -0,0 +1,21 @@ | |||
1 | empty='' | ||
2 | |||
3 | echo 'Testing: in ""' | ||
4 | for a in ""; do echo ".$a."; done | ||
5 | |||
6 | echo 'Testing: in '"''" | ||
7 | for a in ''; do echo ".$a."; done | ||
8 | |||
9 | echo 'Testing: in $empty' | ||
10 | for a in $empty; do echo ".$a."; done | ||
11 | |||
12 | echo 'Testing: in $empty""' | ||
13 | for a in $empty""; do echo ".$a."; done | ||
14 | |||
15 | echo 'Testing: in $empty'"''" | ||
16 | for a in $empty''; do echo ".$a."; done | ||
17 | |||
18 | echo 'Testing: in "$empty"' | ||
19 | for a in "$empty"; do echo ".$a."; done | ||
20 | |||
21 | 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 000000000..b2901ea97 --- /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 000000000..f1dabfa54 --- /dev/null +++ b/shell/ash_test/ash-parsing/quote4.tests | |||
@@ -0,0 +1,2 @@ | |||
1 | a_b='a b' | ||
2 | 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 000000000..b56323fe1 --- /dev/null +++ b/shell/ash_test/ash-parsing/starquoted.right | |||
@@ -0,0 +1,8 @@ | |||
1 | .1 abc d e f. | ||
2 | .1. | ||
3 | .abc. | ||
4 | .d e f. | ||
5 | .-1 abc d e f-. | ||
6 | .-1. | ||
7 | .abc. | ||
8 | .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 000000000..2fe49b1cd --- /dev/null +++ b/shell/ash_test/ash-parsing/starquoted.tests | |||
@@ -0,0 +1,8 @@ | |||
1 | if test $# = 0; then | ||
2 | exec "$THIS_SH" "$0" 1 abc 'd e f' | ||
3 | fi | ||
4 | |||
5 | for a in "$*"; do echo ".$a."; done | ||
6 | for a in "$@"; do echo ".$a."; done | ||
7 | for a in "-$*-"; do echo ".$a."; done | ||
8 | 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 000000000..1bff408ca --- /dev/null +++ b/shell/ash_test/ash-parsing/starquoted2.right | |||
@@ -0,0 +1,8 @@ | |||
1 | Should be printed | ||
2 | Would not be printed by bash | ||
3 | Would not be printed by bash | ||
4 | Would not be printed by bash | ||
5 | Should be printed | ||
6 | Empty: | ||
7 | Empty: | ||
8 | Empty: | ||
diff --git a/shell/ash_test/ash-parsing/starquoted2.tests b/shell/ash_test/ash-parsing/starquoted2.tests new file mode 100755 index 000000000..7c5ff45b8 --- /dev/null +++ b/shell/ash_test/ash-parsing/starquoted2.tests | |||
@@ -0,0 +1,19 @@ | |||
1 | if test $# != 0; then | ||
2 | exec "$THIS_SH" "$0" | ||
3 | fi | ||
4 | |||
5 | # No params! | ||
6 | for a in "$*"; do echo Should be printed; done | ||
7 | for a in "$@"; do echo Should not be printed; done | ||
8 | # Yes, believe it or not, bash is mesmerized by "$@" and stops | ||
9 | # treating "" as "this word cannot be expanded to nothing, | ||
10 | # but must be at least null string". Now it can be expanded to nothing. | ||
11 | for a in "$@"""; do echo Would not be printed by bash; done | ||
12 | for a in """$@"; do echo Would not be printed by bash; done | ||
13 | for a in """$@"''"$@"''; do echo Would not be printed by bash; done | ||
14 | for a in ""; do echo Should be printed; done | ||
15 | |||
16 | # Bug 207: "$@" expands to nothing, and we erroneously glob "%s\n" twice: | ||
17 | printf 'Empty:%s\n' "$@" | ||
18 | printf "Empty:%s\n" "$@" | ||
19 | printf "Empty:%s\\n" "$@" | ||
diff --git a/shell/ash_test/run-all b/shell/ash_test/run-all index 983e6d184..caf033577 100755 --- a/shell/ash_test/run-all +++ b/shell/ash_test/run-all | |||
@@ -2,10 +2,24 @@ | |||
2 | 2 | ||
3 | TOPDIR=`pwd` | 3 | TOPDIR=`pwd` |
4 | 4 | ||
5 | test -x ash || { | 5 | if test ! -x ash; then |
6 | echo "No ./ash - creating a link to ../../busybox" | 6 | if test ! -x ../../busybox; then |
7 | ln -s ../../busybox ash | 7 | echo "Can't run tests. Put ash binary into this directory (`pwd`)" |
8 | } | 8 | exit 1 |
9 | fi | ||
10 | echo "No ./ash - creating a link to ../../busybox" | ||
11 | ln -s ../../busybox ash | ||
12 | fi | ||
13 | if test ! -f .config; then | ||
14 | if test ! -f ../../.config; then | ||
15 | echo "Missing .config file" | ||
16 | exit 1 | ||
17 | fi | ||
18 | cp ../../.config . || exit 1 | ||
19 | fi | ||
20 | |||
21 | eval $(sed -e '/^#/d' -e '/^$/d' -e 's:^:export :' .config) | ||
22 | |||
9 | test -x printenv || gcc -O2 -o printenv printenv.c || exit $? | 23 | test -x printenv || gcc -O2 -o printenv printenv.c || exit $? |
10 | test -x recho || gcc -O2 -o recho recho.c || exit $? | 24 | test -x recho || gcc -O2 -o recho recho.c || exit $? |
11 | test -x zecho || gcc -O2 -o zecho zecho.c || exit $? | 25 | test -x zecho || gcc -O2 -o zecho zecho.c || exit $? |