diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-07-11 21:43:11 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-07-11 21:43:11 +0000 |
commit | 29ec0b94a4da0eb92e9994fed181e895e3fb2910 (patch) | |
tree | 772d4ff5da48d2d01a5d639880b42bf5161f0e09 /testsuite | |
parent | 2b407b12be6bc25b81961557dd96bf81f2cf88e8 (diff) | |
download | busybox-w32-29ec0b94a4da0eb92e9994fed181e895e3fb2910.tar.gz busybox-w32-29ec0b94a4da0eb92e9994fed181e895e3fb2910.tar.bz2 busybox-w32-29ec0b94a4da0eb92e9994fed181e895e3fb2910.zip |
cpio: testsuite for http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=466771
which was fixed in proevious commit
Diffstat (limited to 'testsuite')
-rwxr-xr-x | testsuite/cpio.tests | 66 |
1 files changed, 41 insertions, 25 deletions
diff --git a/testsuite/cpio.tests b/testsuite/cpio.tests index 55594b3a6..eb3e57647 100755 --- a/testsuite/cpio.tests +++ b/testsuite/cpio.tests | |||
@@ -4,13 +4,7 @@ | |||
4 | 4 | ||
5 | . testing.sh | 5 | . testing.sh |
6 | 6 | ||
7 | # check if hexdump supports the '-R' option | 7 | # ls -ln shows date. Need to remove that, it's variable. |
8 | hexdump -R </dev/null >/dev/null 2>&1 || { | ||
9 | echo "'hexdump -R' is not available" >&2 | ||
10 | exit 1 | ||
11 | } | ||
12 | |||
13 | # ls -ln is showing date. Need to remove that, it's variable | ||
14 | # sed: coalesce spaces | 8 | # sed: coalesce spaces |
15 | # cut: remove date | 9 | # cut: remove date |
16 | FILTER_LS="sed 's/ */ /g' | cut -d' ' -f 1-5,9-" | 10 | FILTER_LS="sed 's/ */ /g' | cut -d' ' -f 1-5,9-" |
@@ -18,28 +12,27 @@ FILTER_LS="sed 's/ */ /g' | cut -d' ' -f 1-5,9-" | |||
18 | 12 | ||
19 | # newc cpio archive of directory cpio.testdir with empty x and y hardlinks | 13 | # newc cpio archive of directory cpio.testdir with empty x and y hardlinks |
20 | hexdump="\ | 14 | hexdump="\ |
21 | 00000000 42 5a 68 39 31 41 59 26 53 59 64 1e 91 8c 00 00 | 15 | \x42\x5a\x68\x39\x31\x41\x59\x26\x53\x59\x64\x1e\x91\x8c\x00\x00\ |
22 | 00000010 48 7f 80 4c 48 08 00 28 01 ff e0 3f 24 14 00 0e | 16 | \x48\x7f\x80\x4c\x48\x08\x00\x28\x01\xff\xe0\x3f\x24\x14\x00\x0e\ |
23 | 00000020 20 dc 60 20 00 92 11 ea a0 1a 00 00 00 03 20 8a | 17 | \x20\xdc\x60\x20\x00\x92\x11\xea\xa0\x1a\x00\x00\x00\x03\x20\x8a\ |
24 | 00000030 93 d4 9a 68 1a 0d 1e 91 a1 a0 06 98 e3 5c 2f d9 | 18 | \x93\xd4\x9a\x68\x1a\x0d\x1e\x91\xa1\xa0\x06\x98\xe3\x5c\x2f\xd9\ |
25 | 00000040 26 a1 25 24 20 ed 47 c7 21 40 2b 6e f2 e6 fe 98 | 19 | \x26\xa1\x25\x24\x20\xed\x47\xc7\x21\x40\x2b\x6e\xf2\xe6\xfe\x98\ |
26 | 00000050 13 68 a8 bd 82 b2 4f 26 02 24 16 5b 22 16 72 74 | 20 | \x13\x68\xa8\xbd\x82\xb2\x4f\x26\x02\x24\x16\x5b\x22\x16\x72\x74\ |
27 | 00000060 15 cd c1 a6 9e a6 5e 6c 16 37 35 01 99 c4 81 21 | 21 | \x15\xcd\xc1\xa6\x9e\xa6\x5e\x6c\x16\x37\x35\x01\x99\xc4\x81\x21\ |
28 | 00000070 29 28 4b 69 51 a9 3c 1a 9b 0a e1 e4 b4 af 85 73 | 22 | \x29\x28\x4b\x69\x51\xa9\x3c\x1a\x9b\x0a\xe1\xe4\xb4\xaf\x85\x73\ |
29 | 00000080 ba 23 10 59 e8 b3 e1 a1 63 05 8c 4f c5 dc 91 4e | 23 | \xba\x23\x10\x59\xe8\xb3\xe1\xa1\x63\x05\x8c\x4f\xc5\xdc\x91\x4e\ |
30 | 00000090 14 24 19 07 a4 63 00 | 24 | \x14\x24\x19\x07\xa4\x63\x00" |
31 | " | ||
32 | 25 | ||
33 | user=$(id -u) | 26 | user=$(id -u) |
34 | group=$(id -g) | 27 | group=$(id -g) |
35 | 28 | ||
36 | rm -rf cpio.testdir | 29 | rm -rf cpio.testdir cpio.testdir2 2>/dev/null |
37 | 30 | ||
38 | # testing "test name" "options" "expected result" "file input" "stdin" | 31 | # testing "test name" "command" "expected result" "file input" "stdin" |
39 | 32 | ||
40 | testing "cpio extracts zero-sized hardlinks" \ | 33 | testing "cpio extracts zero-sized hardlinks" \ |
41 | "echo '$hexdump' | hexdump -R | bzcat | cpio -i; echo \$?; | 34 | "$ECHO -ne '$hexdump' | bzcat | cpio -i; echo \$?; |
42 | ls -ln cpio.testdir | $FILTER_LS" \ | 35 | ls -ln cpio.testdir | $FILTER_LS" \ |
43 | "\ | 36 | "\ |
44 | 1 blocks | 37 | 1 blocks |
45 | 0 | 38 | 0 |
@@ -51,7 +44,7 @@ testing "cpio extracts zero-sized hardlinks" \ | |||
51 | # Currently fails. Numerous: "1 blocks" versus "1 block", | 44 | # Currently fails. Numerous: "1 blocks" versus "1 block", |
52 | # "1 block" must go to stderr, does not list cpio.testdir/x and cpio.testdir/y | 45 | # "1 block" must go to stderr, does not list cpio.testdir/x and cpio.testdir/y |
53 | testing "cpio lists hardlinks" \ | 46 | testing "cpio lists hardlinks" \ |
54 | "echo '$hexdump' | hexdump -R | bzcat | cpio -t 2>&1; echo \$?" \ | 47 | "$ECHO -ne '$hexdump' | bzcat | cpio -t 2>&1; echo \$?" \ |
55 | "\ | 48 | "\ |
56 | 1 block | 49 | 1 block |
57 | cpio.testdir | 50 | cpio.testdir |
@@ -61,7 +54,30 @@ cpio.testdir/y | |||
61 | " \ | 54 | " \ |
62 | "" "" | 55 | "" "" |
63 | 56 | ||
64 | # clean up | 57 | # More complex case |
65 | rm -rf cpio.testdir | 58 | rm -rf cpio.testdir cpio.testdir2 2>/dev/null |
59 | mkdir cpio.testdir | ||
60 | touch cpio.testdir/solo | ||
61 | touch cpio.testdir/empty | ||
62 | echo x >cpio.testdir/nonempty | ||
63 | ln cpio.testdir/empty cpio.testdir/empty1 | ||
64 | ln cpio.testdir/nonempty cpio.testdir/nonempty1 | ||
65 | mkdir cpio.testdir2 | ||
66 | |||
67 | testing "cpio extracts zero-sized hardlinks 2" \ | ||
68 | "find cpio.testdir | cpio -H newc --create | (cd cpio.testdir2 && cpio -i); echo \$?; | ||
69 | ls -ln cpio.testdir2/cpio.testdir | $FILTER_LS" \ | ||
70 | "\ | ||
71 | 0 | ||
72 | -rw-r--r-- 2 $user $group 0 empty | ||
73 | -rw-r--r-- 2 $user $group 0 empty1 | ||
74 | -rw-r--r-- 2 $user $group 2 nonempty | ||
75 | -rw-r--r-- 2 $user $group 2 nonempty1 | ||
76 | -rw-r--r-- 1 $user $group 0 solo | ||
77 | " \ | ||
78 | "" "" | ||
79 | |||
80 | # Clean up | ||
81 | rm -rf cpio.testdir cpio.testdir2 2>/dev/null | ||
66 | 82 | ||
67 | exit $FAILCOUNT | 83 | exit $FAILCOUNT |