diff options
Diffstat (limited to 'release/src/router/busybox/shell/hush_test/hush-parsing')
34 files changed, 234 insertions, 0 deletions
diff --git a/release/src/router/busybox/shell/hush_test/hush-parsing/argv0.right b/release/src/router/busybox/shell/hush_test/hush-parsing/argv0.right new file mode 100644 index 00000000..d86bac9d --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-parsing/argv0.right @@ -0,0 +1 @@ +OK diff --git a/release/src/router/busybox/shell/hush_test/hush-parsing/argv0.tests b/release/src/router/busybox/shell/hush_test/hush-parsing/argv0.tests new file mode 100755 index 00000000..f5c40f6f --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-parsing/argv0.tests @@ -0,0 +1,4 @@ +if test $# = 0; then + exec "$THIS_SH" "$0" arg +fi +echo OK diff --git a/release/src/router/busybox/shell/hush_test/hush-parsing/escape1.right b/release/src/router/busybox/shell/hush_test/hush-parsing/escape1.right new file mode 100644 index 00000000..1899b87e --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-parsing/escape1.right @@ -0,0 +1,4 @@ +\ +a\b +\\ +c\\d diff --git a/release/src/router/busybox/shell/hush_test/hush-parsing/escape1.tests b/release/src/router/busybox/shell/hush_test/hush-parsing/escape1.tests new file mode 100755 index 00000000..25ac96b2 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-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/release/src/router/busybox/shell/hush_test/hush-parsing/escape2.right b/release/src/router/busybox/shell/hush_test/hush-parsing/escape2.right new file mode 100644 index 00000000..f55fd4a4 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-parsing/escape2.right @@ -0,0 +1,4 @@ +*?[a]* +a*?[a]*b +*?[a]* +c*?[a]*d diff --git a/release/src/router/busybox/shell/hush_test/hush-parsing/escape2.tests b/release/src/router/busybox/shell/hush_test/hush-parsing/escape2.tests new file mode 100755 index 00000000..ee718018 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-parsing/escape2.tests @@ -0,0 +1,4 @@ +echo "*?[a]*" +echo a"*?[a]*"b +echo '*?[a]*' +echo c'*?[a]*'d diff --git a/release/src/router/busybox/shell/hush_test/hush-parsing/escape3.right b/release/src/router/busybox/shell/hush_test/hush-parsing/escape3.right new file mode 100644 index 00000000..da02a976 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-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/release/src/router/busybox/shell/hush_test/hush-parsing/escape3.tests b/release/src/router/busybox/shell/hush_test/hush-parsing/escape3.tests new file mode 100755 index 00000000..18705bd0 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-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/release/src/router/busybox/shell/hush_test/hush-parsing/escape5.right b/release/src/router/busybox/shell/hush_test/hush-parsing/escape5.right new file mode 100644 index 00000000..3cdd393c --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-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/release/src/router/busybox/shell/hush_test/hush-parsing/escape5.tests b/release/src/router/busybox/shell/hush_test/hush-parsing/escape5.tests new file mode 100755 index 00000000..337a98ec --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-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/release/src/router/busybox/shell/hush_test/hush-parsing/negate.right b/release/src/router/busybox/shell/hush_test/hush-parsing/negate.right new file mode 100644 index 00000000..01166012 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-parsing/negate.right @@ -0,0 +1,35 @@ +! 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 diff --git a/release/src/router/busybox/shell/hush_test/hush-parsing/negate.tests b/release/src/router/busybox/shell/hush_test/hush-parsing/negate.tests new file mode 100755 index 00000000..c25127d7 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-parsing/negate.tests @@ -0,0 +1,16 @@ +echo ! printing ! +! false +echo $? +! true +echo $? +if ! false; then false; echo $?; fi +echo $? +if ! false; then ! false; echo $?; fi +echo $? +for a in ! a b c; do echo $a; done +for a in ! a b c; do ! printf "$a "; echo $?; done +for a in ! a b c; do ! /usr/bin/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 diff --git a/release/src/router/busybox/shell/hush_test/hush-parsing/noeol.right b/release/src/router/busybox/shell/hush_test/hush-parsing/noeol.right new file mode 100644 index 00000000..e427984d --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-parsing/noeol.right @@ -0,0 +1 @@ +HELLO diff --git a/release/src/router/busybox/shell/hush_test/hush-parsing/noeol.tests b/release/src/router/busybox/shell/hush_test/hush-parsing/noeol.tests new file mode 100755 index 00000000..a93113a0 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-parsing/noeol.tests @@ -0,0 +1,2 @@ +# next line has no EOL! +echo HELLO
\ No newline at end of file diff --git a/release/src/router/busybox/shell/hush_test/hush-parsing/noeol2.right b/release/src/router/busybox/shell/hush_test/hush-parsing/noeol2.right new file mode 100644 index 00000000..d00491fd --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-parsing/noeol2.right @@ -0,0 +1 @@ +1 diff --git a/release/src/router/busybox/shell/hush_test/hush-parsing/noeol2.tests b/release/src/router/busybox/shell/hush_test/hush-parsing/noeol2.tests new file mode 100755 index 00000000..1220f056 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-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/release/src/router/busybox/shell/hush_test/hush-parsing/noeol3.right b/release/src/router/busybox/shell/hush_test/hush-parsing/noeol3.right new file mode 100644 index 00000000..56f8515b --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-parsing/noeol3.right @@ -0,0 +1 @@ +hush: syntax error: unterminated " diff --git a/release/src/router/busybox/shell/hush_test/hush-parsing/noeol3.tests b/release/src/router/busybox/shell/hush_test/hush-parsing/noeol3.tests new file mode 100755 index 00000000..ec958ed7 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-parsing/noeol3.tests @@ -0,0 +1,2 @@ +# last line has no EOL! +echo "unterminated
\ No newline at end of file diff --git a/release/src/router/busybox/shell/hush_test/hush-parsing/process_subst.right b/release/src/router/busybox/shell/hush_test/hush-parsing/process_subst.right new file mode 100644 index 00000000..397bc806 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-parsing/process_subst.right @@ -0,0 +1,3 @@ +TESTzzBEST +TEST$(echo zz)BEST +TEST'BEST diff --git a/release/src/router/busybox/shell/hush_test/hush-parsing/process_subst.tests b/release/src/router/busybox/shell/hush_test/hush-parsing/process_subst.tests new file mode 100755 index 00000000..21996bc0 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-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/release/src/router/busybox/shell/hush_test/hush-parsing/quote1.right b/release/src/router/busybox/shell/hush_test/hush-parsing/quote1.right new file mode 100644 index 00000000..cb382054 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-parsing/quote1.right @@ -0,0 +1 @@ +'1' diff --git a/release/src/router/busybox/shell/hush_test/hush-parsing/quote1.tests b/release/src/router/busybox/shell/hush_test/hush-parsing/quote1.tests new file mode 100755 index 00000000..f5589546 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-parsing/quote1.tests @@ -0,0 +1,2 @@ +a=1 +echo "'$a'" diff --git a/release/src/router/busybox/shell/hush_test/hush-parsing/quote2.right b/release/src/router/busybox/shell/hush_test/hush-parsing/quote2.right new file mode 100644 index 00000000..3bc9edcd --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-parsing/quote2.right @@ -0,0 +1 @@ +>1 diff --git a/release/src/router/busybox/shell/hush_test/hush-parsing/quote2.tests b/release/src/router/busybox/shell/hush_test/hush-parsing/quote2.tests new file mode 100755 index 00000000..bd966f30 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-parsing/quote2.tests @@ -0,0 +1,2 @@ +a=1 +echo ">$a" diff --git a/release/src/router/busybox/shell/hush_test/hush-parsing/quote3.right b/release/src/router/busybox/shell/hush_test/hush-parsing/quote3.right new file mode 100644 index 00000000..bbe46df6 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-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/release/src/router/busybox/shell/hush_test/hush-parsing/quote3.tests b/release/src/router/busybox/shell/hush_test/hush-parsing/quote3.tests new file mode 100755 index 00000000..b5fd5978 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-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/release/src/router/busybox/shell/hush_test/hush-parsing/quote4.right b/release/src/router/busybox/shell/hush_test/hush-parsing/quote4.right new file mode 100644 index 00000000..b2901ea9 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-parsing/quote4.right @@ -0,0 +1 @@ +a b diff --git a/release/src/router/busybox/shell/hush_test/hush-parsing/quote4.tests b/release/src/router/busybox/shell/hush_test/hush-parsing/quote4.tests new file mode 100755 index 00000000..f1dabfa5 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-parsing/quote4.tests @@ -0,0 +1,2 @@ +a_b='a b' +echo "$a_b" diff --git a/release/src/router/busybox/shell/hush_test/hush-parsing/redir_space.right b/release/src/router/busybox/shell/hush_test/hush-parsing/redir_space.right new file mode 100644 index 00000000..08429520 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-parsing/redir_space.right @@ -0,0 +1,3 @@ +z1.tmp: 1 +z2.tmp: 1 +"z1.tmp z2.tmp": TEST 0 diff --git a/release/src/router/busybox/shell/hush_test/hush-parsing/redir_space.tests b/release/src/router/busybox/shell/hush_test/hush-parsing/redir_space.tests new file mode 100755 index 00000000..c0b54309 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-parsing/redir_space.tests @@ -0,0 +1,6 @@ +v='z1.tmp z2.tmp' +echo TEST >$v +echo 'z1.tmp:' `cat 'z1.tmp' 2>/dev/null; echo $?` +echo 'z2.tmp:' `cat 'z2.tmp' 2>/dev/null; echo $?` +echo '"z1.tmp z2.tmp":' `cat 'z1.tmp z2.tmp' 2>/dev/null; echo $?` +rm z*.tmp diff --git a/release/src/router/busybox/shell/hush_test/hush-parsing/starquoted.right b/release/src/router/busybox/shell/hush_test/hush-parsing/starquoted.right new file mode 100644 index 00000000..b56323fe --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-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/release/src/router/busybox/shell/hush_test/hush-parsing/starquoted.tests b/release/src/router/busybox/shell/hush_test/hush-parsing/starquoted.tests new file mode 100755 index 00000000..2fe49b1c --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-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/release/src/router/busybox/shell/hush_test/hush-parsing/starquoted2.right b/release/src/router/busybox/shell/hush_test/hush-parsing/starquoted2.right new file mode 100644 index 00000000..e1562ed6 --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-parsing/starquoted2.right @@ -0,0 +1,5 @@ +Should be printed +Should be printed +Empty: +Empty: +Empty: diff --git a/release/src/router/busybox/shell/hush_test/hush-parsing/starquoted2.tests b/release/src/router/busybox/shell/hush_test/hush-parsing/starquoted2.tests new file mode 100755 index 00000000..f305c4cd --- /dev/null +++ b/release/src/router/busybox/shell/hush_test/hush-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 Should not be printed; done +for a in """$@"; do echo Should not be printed; done +for a in """$@"''"$@"''; do echo Should not be printed; 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" "$@" |