source: drbl_ui/backup/test_busybox/busybox-1.7.2/testsuite/bzcat.tests @ 27

Last change on this file since 27 was 20, checked in by chris, 17 years ago
File size: 1002 bytes
RevLine 
[20]1#!/bin/sh
2
3ext=bz2
4
5bb="busybox "
6
7unset LC_ALL
8unset LC_MESSAGES
9unset LANG
10unset LANGUAGE
11
12hello_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
19hello_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
26prep() {
27    rm -f t*
28    hello_$ext >t1.$ext
29    hello_$ext >t2.$ext
30}
31
32check() {
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
41mkdir testdir 2>/dev/null
42(
43cd testdir || { echo "cannot cd testdir!"; exit 1; }
44
45expected="HELLO\nok\n"
46prep; check "bzcat: dont delete src" "${bb}bzcat t2.bz2; test -f t2.bz2 && echo ok"
47
48)
49rm -rf testdir
Note: See TracBrowser for help on using the repository browser.