aboutsummaryrefslogtreecommitdiff
path: root/testsuite/ash.tests
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/ash.tests')
-rwxr-xr-xtestsuite/ash.tests30
1 files changed, 29 insertions, 1 deletions
diff --git a/testsuite/ash.tests b/testsuite/ash.tests
index 6b2caf316..dd626e6d1 100755
--- a/testsuite/ash.tests
+++ b/testsuite/ash.tests
@@ -7,8 +7,34 @@
7 7
8. ./testing.sh 8. ./testing.sh
9 9
10test -f "$bindir/.config" && . "$bindir/.config"
11
12test x"CONFIG_SCRIPT" = x"y" || exit 0
13test x"CONFIG_HEXDUMP" = x"y" || exit 0
14test x"CONFIG_FEATURE_DEVPTS" = x"y" || exit 0
15
10# testing "test name" "options" "expected result" "file input" "stdin" 16# testing "test name" "options" "expected result" "file input" "stdin"
11 17
18if test x"$CONFIG_UNICODE_PRESERVE_BROKEN" = x"y"; then
19testing "One byte which is not valid unicode char followed by valid input" \
20 "script -q -c 'ash' /dev/null >/dev/null; cat ash.output" \
21 "\
2200000000 ff 2d 0a |.-.|
2300000003
24" \
25 "" \
26 "echo \xff- | hexdump -C >ash.output; exit; exit; exit; exit\n"
27
28testing "30 bytes which are not valid unicode chars followed by valid input" \
29 "script -q -c 'ash' /dev/null >/dev/null; cat ash.output" \
30 "\
3100000000 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
3200000010 ff ff ff ff ff ff ff ff ff ff ff ff ff ff 2d 0a |..............-.|
3300000020
34" \
35 "" \
36 "echo \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff- | hexdump -C >ash.output; exit; exit; exit; exit\n"
37else
12testing "One byte which is not valid unicode char followed by valid input" \ 38testing "One byte which is not valid unicode char followed by valid input" \
13 "script -q -c 'ash' /dev/null >/dev/null; cat ash.output" \ 39 "script -q -c 'ash' /dev/null >/dev/null; cat ash.output" \
14 "\ 40 "\
@@ -27,6 +53,8 @@ testing "30 bytes which are not valid unicode chars followed by valid input" \
27" \ 53" \
28 "" \ 54 "" \
29 "echo \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff- | hexdump -C >ash.output; exit; exit; exit; exit\n" 55 "echo \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff- | hexdump -C >ash.output; exit; exit; exit; exit\n"
56fi
57
30 58
31# Not sure this behavior is perfect: we lose all invalid input which precedes 59# Not sure this behavior is perfect: we lose all invalid input which precedes
32# arrow keys and such. In this example, \xff\xff are lost 60# arrow keys and such. In this example, \xff\xff are lost
@@ -43,7 +71,7 @@ testing "2 bytes which are not valid unicode chars followed by left arrow key" \
43# not checked by the test), then read and execute the rest: "echo A | ..." 71# not checked by the test), then read and execute the rest: "echo A | ..."
44# The bug was that ash was eating the beginning of "echo A" despite the pause. 72# The bug was that ash was eating the beginning of "echo A" despite the pause.
45testing "Invalid unicode chars followed by a pause do not eat next chars" \ 73testing "Invalid unicode chars followed by a pause do not eat next chars" \
46 "{ echo -ne 'echo \xff\n'; sleep 1; echo -ne 'echo A | hexdump -C >ash.output; exit; exit; exit; exit\n'; } \ 74 "{ $ECHO -ne 'echo \xff\n'; sleep 1; $ECHO -ne 'echo A | hexdump -C >ash.output; exit; exit; exit; exit\n'; } \
47 | script -q -c 'ash' /dev/null >/dev/null; cat ash.output" \ 75 | script -q -c 'ash' /dev/null >/dev/null; cat ash.output" \
48 "\ 76 "\
4900000000 41 0a |A.| 7700000000 41 0a |A.|