diff options
Diffstat (limited to 'testsuite/bzcat.tests')
-rwxr-xr-x | testsuite/bzcat.tests | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/testsuite/bzcat.tests b/testsuite/bzcat.tests new file mode 100755 index 000000000..16fa3c248 --- /dev/null +++ b/testsuite/bzcat.tests | |||
@@ -0,0 +1,49 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | ext=bz2 | ||
4 | |||
5 | bb="busybox " | ||
6 | |||
7 | unset LC_ALL | ||
8 | unset LC_MESSAGES | ||
9 | unset LANG | ||
10 | unset LANGUAGE | ||
11 | |||
12 | hello_gz() { | ||
13 | # Gzipped "HELLO\n" | ||
14 | #_________________________ vvv vvv vvv vvv - mtime | ||
15 | echo -ne "\x1f\x8b\x08\x00\x85\x1d\xef\x45\x02\x03\xf3\x70\xf5\xf1\xf1\xe7" | ||
16 | echo -ne "\x02\x00\x6e\xd7\xac\xfd\x06\x00\x00\x00" | ||
17 | } | ||
18 | |||
19 | hello_bz2() { | ||
20 | # Bzipped "HELLO\n" | ||
21 | echo -ne "\x42\x5a\x68\x39\x31\x41\x59\x26\x53\x59\x5b\xb8\xe8\xa3\x00\x00" | ||
22 | echo -ne "\x01\x44\x00\x00\x10\x02\x44\xa0\x00\x30\xcd\x00\xc3\x46\x29\x97" | ||
23 | echo -ne "\x17\x72\x45\x38\x50\x90\x5b\xb8\xe8\xa3" | ||
24 | } | ||
25 | |||
26 | prep() { | ||
27 | rm -f t* | ||
28 | hello_$ext >t1.$ext | ||
29 | hello_$ext >t2.$ext | ||
30 | } | ||
31 | |||
32 | check() { | ||
33 | eval $2 >t_actual 2>&1 | ||
34 | if echo -ne "$expected" | cmp - t_actual; then | ||
35 | echo "$1: PASS" | ||
36 | else | ||
37 | echo "$1: FAIL" | ||
38 | fi | ||
39 | } | ||
40 | |||
41 | mkdir testdir 2>/dev/null | ||
42 | ( | ||
43 | cd testdir || { echo "cannot cd testdir!"; exit 1; } | ||
44 | |||
45 | expected="HELLO\nok\n" | ||
46 | prep; check "bzcat: dont delete src" "${bb}bzcat t2.bz2; test -f t2.bz2 && echo ok" | ||
47 | |||
48 | ) | ||
49 | rm -rf testdir | ||