diff options
author | Niklas DAHLQUIST <niklas.dahlquist@st.com> | 2019-05-03 09:32:53 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2019-05-03 09:32:53 +0100 |
commit | ee3d2805065f09b3d5d28e3518f1351b5d1c0bf7 (patch) | |
tree | 1d509780d5b037de390d9c3d0d195316ca7f5b5c | |
parent | ec43ab469dec9b18a3393be9f51790a09f5d7948 (diff) | |
download | busybox-w32-ee3d2805065f09b3d5d28e3518f1351b5d1c0bf7.tar.gz busybox-w32-ee3d2805065f09b3d5d28e3518f1351b5d1c0bf7.tar.bz2 busybox-w32-ee3d2805065f09b3d5d28e3518f1351b5d1c0bf7.zip |
testsuite: added test cases for the shebang
Signed-off-by: Niklas DAHLQUIST <niklas.dahlquist@st.com>
Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@st.com>
Signed-off-by: Ron Yorston <rmy@pobox.com>
-rwxr-xr-x | testsuite/sh.tests | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/testsuite/sh.tests b/testsuite/sh.tests new file mode 100755 index 000000000..2a510fb25 --- /dev/null +++ b/testsuite/sh.tests | |||
@@ -0,0 +1,90 @@ | |||
1 | #!/bin/sh | ||
2 | # | ||
3 | # Test sh scripts | ||
4 | # | ||
5 | # Copyright 2019 by STMicroelectronics | ||
6 | # Licensed under GPLv2, see file LICENSE in this source tree. | ||
7 | |||
8 | . ./testing.sh | ||
9 | |||
10 | test -f "$bindir/.config" && . "$bindir/.config" | ||
11 | |||
12 | # testing "test name" "options" "expected result" "file input" "stdin" | ||
13 | |||
14 | # Test case | ||
15 | testing "shebang" \ | ||
16 | "uudecode; sh -c './shebang.sh'; echo \$?" \ | ||
17 | "Hello world | ||
18 | 0 | ||
19 | " \ | ||
20 | "" "\ | ||
21 | begin-base64 755 shebang.sh | ||
22 | IyEvYmluL3NoCmVjaG8gIkhlbGxvIHdvcmxkIgo= | ||
23 | ==== | ||
24 | " | ||
25 | rm -f shebang.sh | ||
26 | |||
27 | # Test case | ||
28 | testing "shebang with whitespace" \ | ||
29 | "uudecode; sh -c './shebang_trailing_space.sh'; echo \$?" \ | ||
30 | "Hello world | ||
31 | 0 | ||
32 | " \ | ||
33 | "" "\ | ||
34 | begin-base64 755 shebang_trailing_space.sh | ||
35 | IyEvYmluL3NoIAplY2hvICJIZWxsbyB3b3JsZCIK | ||
36 | ==== | ||
37 | " | ||
38 | rm -f shebang_trailing_space.sh | ||
39 | |||
40 | # Test case | ||
41 | testing "shebang with argument" \ | ||
42 | "uudecode; sh -c './shebang_argument.sh'; echo \$?" \ | ||
43 | "Hello world | ||
44 | 0 | ||
45 | " \ | ||
46 | "" "\ | ||
47 | begin-base64 755 shebang_argument.sh | ||
48 | IyEvYmluL3NoIC0KZWNobyAiSGVsbG8gd29ybGQiCg== | ||
49 | ==== | ||
50 | " | ||
51 | rm -f shebang_argument.sh | ||
52 | |||
53 | # Test case | ||
54 | testing "shebang with leading whitespace and argument" \ | ||
55 | "uudecode; sh -c './shebang_leading_space_argument.sh'; echo \$?" \ | ||
56 | "Hello world | ||
57 | 0 | ||
58 | " \ | ||
59 | "" "\ | ||
60 | begin-base64 755 shebang_leading_space_argument.sh | ||
61 | IyEvYmluL3NoICAtCmVjaG8gIkhlbGxvIHdvcmxkIgo= | ||
62 | ==== | ||
63 | " | ||
64 | rm -f shebang_leading_space_argument.sh | ||
65 | |||
66 | # Test case | ||
67 | testing "shebang with argument and trailing whitespace" \ | ||
68 | "uudecode; sh -c './shebang_argument_trailing_space.sh'; echo \$?" \ | ||
69 | "Hello world | ||
70 | 0 | ||
71 | " \ | ||
72 | "" "\ | ||
73 | begin-base64 755 shebang_argument_trailing_space.sh | ||
74 | IyEvYmluL3NoIC0gCmVjaG8gIkhlbGxvIHdvcmxkIgo= | ||
75 | ==== | ||
76 | " | ||
77 | rm -f shebang_argument_trailing_space.sh | ||
78 | |||
79 | # Test case | ||
80 | testing "shebang with leading whitespace, argument and trailing whitespace" \ | ||
81 | "uudecode; sh -c './shebang_leading_argument_trailing_space.sh'; echo \$?" \ | ||
82 | "Hello world | ||
83 | 0 | ||
84 | " \ | ||
85 | "" "\ | ||
86 | begin-base64 755 shebang_leading_argument_trailing_space.sh | ||
87 | IyEvYmluL3NoICAtIAplY2hvICJIZWxsbyB3b3JsZCIK | ||
88 | ==== | ||
89 | " | ||
90 | rm -f shebang_leading_argument_trailing_space.sh | ||