diff options
Diffstat (limited to 'testsuite/ash.tests')
-rwxr-xr-x | testsuite/ash.tests | 30 |
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 | ||
10 | test -f "$bindir/.config" && . "$bindir/.config" | ||
11 | |||
12 | test x"CONFIG_SCRIPT" = x"y" || exit 0 | ||
13 | test x"CONFIG_HEXDUMP" = x"y" || exit 0 | ||
14 | test 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 | ||
18 | if test x"$CONFIG_UNICODE_PRESERVE_BROKEN" = x"y"; then | ||
19 | testing "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 | "\ | ||
22 | 00000000 ff 2d 0a |.-.| | ||
23 | 00000003 | ||
24 | " \ | ||
25 | "" \ | ||
26 | "echo \xff- | hexdump -C >ash.output; exit; exit; exit; exit\n" | ||
27 | |||
28 | testing "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 | "\ | ||
31 | 00000000 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................| | ||
32 | 00000010 ff ff ff ff ff ff ff ff ff ff ff ff ff ff 2d 0a |..............-.| | ||
33 | 00000020 | ||
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" | ||
37 | else | ||
12 | testing "One byte which is not valid unicode char followed by valid input" \ | 38 | testing "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" |
56 | fi | ||
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. |
45 | testing "Invalid unicode chars followed by a pause do not eat next chars" \ | 73 | testing "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 | "\ |
49 | 00000000 41 0a |A.| | 77 | 00000000 41 0a |A.| |