From 008d0be72b2f160382c6e880765e96b64a050c65 Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Sat, 3 Jan 2015 12:04:58 +0100 Subject: imported original firmware WRT54GL_v4.30.11_11_US --- release/src/router/busybox/tests/sh.testcases | 89 +++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 release/src/router/busybox/tests/sh.testcases (limited to 'release/src/router/busybox/tests/sh.testcases') diff --git a/release/src/router/busybox/tests/sh.testcases b/release/src/router/busybox/tests/sh.testcases new file mode 100644 index 00000000..e2a75873 --- /dev/null +++ b/release/src/router/busybox/tests/sh.testcases @@ -0,0 +1,89 @@ +# try running this with bash, ksh, ash, and hush. + +# simple quoting rules. +echo a b +echo "a b" +echo a "" b +echo a '' b +echo hello? +echo "hello?" +echo t* hello +echo t\* hello + +# quick and painless exit for lash +if false; then true; exit; fi + +# fairly simple command substitution +echo `echo -e foo\\\necho bar` + +echo THIS IS A TEST >foo +cat $(echo FOO | tr 'A-Z' 'a-z') +cat foo | tr 'A-Z' 'a-z' +cat $(echo FOO | tr 'A-Z' 'a-z') | tr 'A-Z' 'a-z' + +cat foo | if true; then tr 'A-Z' 'a-z'; else echo bar1; fi +cat foo | if false; then tr 'A-Z' 'a-z'; else echo bar2; fi +if true; then tr 'A-Z' 'a-z'; else echo bar3; fi foo 2>&1 +cat foo +cat doesnt_exist >foo 2>&1 +tr 'a-z' 'A-Z' $TMP +ls fish + +# ash, lash, and hush do not create fish; bash and ksh do. +# Thanks to Tapani Tarvainen for this stress test. +unset TMP +rm -f fish +TMP=fish >$TMP +ls fish + +# The following example shows that hush's parser is +# not _really_ Bourne compatible +echo "echo Hello World" >"a=b" +unset a +chmod a+x "a=b" +PATH=$PATH:. +"a=b" +echo $a + +# assuming the shell wasn't too buggy, clean up the mess +rm -f a=b fish foo -- cgit v1.2.3-54-g00ecf