diff options
author | Ron Yorston <rmy@pobox.com> | 2025-08-10 07:46:58 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2025-08-10 07:46:58 +0100 |
commit | c70a65f36c017f6feb7e86415bec1a644e71dbab (patch) | |
tree | e1c3afca24fd35bd2ff142cc0ea83151fdfa5996 /testsuite | |
parent | dcb4966c5492aeb67494d9ffdc58ff3054add443 (diff) | |
parent | 84766710f420dd444e2a03d33a1915ce55661e67 (diff) | |
download | busybox-w32-merge.tar.gz busybox-w32-merge.tar.bz2 busybox-w32-merge.zip |
Merge branch 'busybox' into mergemerge
Diffstat (limited to '')
-rwxr-xr-x | testsuite/hexdump.tests | 91 | ||||
-rwxr-xr-x | testsuite/od.tests | 13 |
2 files changed, 81 insertions, 23 deletions
diff --git a/testsuite/hexdump.tests b/testsuite/hexdump.tests index 517ec508b..b2f6a2201 100755 --- a/testsuite/hexdump.tests +++ b/testsuite/hexdump.tests | |||
@@ -5,6 +5,17 @@ | |||
5 | 5 | ||
6 | . ./testing.sh | 6 | . ./testing.sh |
7 | 7 | ||
8 | input=\ | ||
9 | "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"\ | ||
10 | "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f"\ | ||
11 | "\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f"\ | ||
12 | "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f"\ | ||
13 | "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff" | ||
14 | |||
15 | little_endian=false | ||
16 | { printf '\0\1' | hexdump -d | grep -q 256; } && little_endian=true | ||
17 | readonly little_endian | ||
18 | |||
8 | # testing "description" "command" "result" "infile" "stdin" | 19 | # testing "description" "command" "result" "infile" "stdin" |
9 | testing 'hexdump -C with four NULs' \ | 20 | testing 'hexdump -C with four NULs' \ |
10 | 'hexdump -C' \ | 21 | 'hexdump -C' \ |
@@ -43,12 +54,7 @@ testing "hexdump -e %3_u" \ | |||
43 | 80 81 82 83 84 85 86 87 88 89 8a 8b 8c 8d 8e 8f | 54 | 80 81 82 83 84 85 86 87 88 89 8a 8b 8c 8d 8e 8f |
44 | f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 fa fb fc fd fe ff | 55 | f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 fa fb fc fd fe ff |
45 | " \ | 56 | " \ |
46 | "" \ | 57 | "" "$input" |
47 | "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"\ | ||
48 | "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f"\ | ||
49 | "\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f"\ | ||
50 | "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f"\ | ||
51 | "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff"\ | ||
52 | 58 | ||
53 | testing "hexdump -e /1 %d" \ | 59 | testing "hexdump -e /1 %d" \ |
54 | "hexdump -e '16/1 \" %4d\" \"\n\"'" \ | 60 | "hexdump -e '16/1 \" %4d\" \"\n\"'" \ |
@@ -59,33 +65,74 @@ testing "hexdump -e /1 %d" \ | |||
59 | -128 -127 -126 -125 -124 -123 -122 -121 -120 -119 -118 -117 -116 -115 -114 -113 | 65 | -128 -127 -126 -125 -124 -123 -122 -121 -120 -119 -118 -117 -116 -115 -114 -113 |
60 | -16 -15 -14 -13 -12 -11 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 | 66 | -16 -15 -14 -13 -12 -11 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 |
61 | " \ | 67 | " \ |
62 | "" \ | 68 | "" "$input" |
63 | "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"\ | ||
64 | "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f"\ | ||
65 | "\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f"\ | ||
66 | "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f"\ | ||
67 | "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff"\ | ||
68 | 69 | ||
69 | testing "hexdump -e /2 %d" \ | 70 | $little_endian || SKIP=1 |
70 | "hexdump -e '8/2 \" %6d\" \"\n\"'" \ | 71 | testing "hexdump -e /2 %d (little endian)" \ |
71 | "\ | 72 | "hexdump -e '8/2 \" %6d\" \"\n\"'" \ |
73 | "\ | ||
72 | 256 770 1284 1798 2312 2826 3340 3854 | 74 | 256 770 1284 1798 2312 2826 3340 3854 |
73 | 4368 4882 5396 5910 6424 6938 7452 7966 | 75 | 4368 4882 5396 5910 6424 6938 7452 7966 |
74 | 29040 29554 30068 30582 31096 31610 32124 32638 | 76 | 29040 29554 30068 30582 31096 31610 32124 32638 |
75 | -32384 -31870 -31356 -30842 -30328 -29814 -29300 -28786 | 77 | -32384 -31870 -31356 -30842 -30328 -29814 -29300 -28786 |
76 | -3600 -3086 -2572 -2058 -1544 -1030 -516 -2 | 78 | -3600 -3086 -2572 -2058 -1544 -1030 -516 -2 |
77 | " \ | 79 | " \ |
78 | "" \ | 80 | "" "$input" |
79 | "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"\ | 81 | SKIP= |
80 | "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f"\ | 82 | |
81 | "\x70\x71\x72\x73\x74\x75\x76\x77\x78\x79\x7a\x7b\x7c\x7d\x7e\x7f"\ | 83 | $little_endian && SKIP=1 |
82 | "\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f"\ | 84 | testing "hexdump -e /2 %d (big endian)" \ |
83 | "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff"\ | 85 | "hexdump -e '8/2 \" %6d\" \"\n\"'" \ |
86 | "\ | ||
87 | 1 515 1029 1543 2057 2571 3085 3599 | ||
88 | 4113 4627 5141 5655 6169 6683 7197 7711 | ||
89 | 28785 29299 29813 30327 30841 31355 31869 32383 | ||
90 | -32639 -32125 -31611 -31097 -30583 -30069 -29555 -29041 | ||
91 | -3855 -3341 -2827 -2313 -1799 -1285 -771 -257 | ||
92 | " \ | ||
93 | "" "$input" | ||
94 | SKIP= | ||
84 | 95 | ||
85 | testing "hexdump -n4 -e '\"%u\"'" \ | 96 | $little_endian || SKIP=1 |
97 | testing "hexdump -e /2 %x (little endian)" \ | ||
98 | "hexdump -e '8/2 \" %6x\" \"\n\"'" \ | ||
99 | "\ | ||
100 | 100 302 504 706 908 b0a d0c f0e | ||
101 | 1110 1312 1514 1716 1918 1b1a 1d1c 1f1e | ||
102 | 7170 7372 7574 7776 7978 7b7a 7d7c 7f7e | ||
103 | 8180 8382 8584 8786 8988 8b8a 8d8c 8f8e | ||
104 | f1f0 f3f2 f5f4 f7f6 f9f8 fbfa fdfc fffe | ||
105 | " \ | ||
106 | "" "$input" | ||
107 | SKIP= | ||
108 | |||
109 | $little_endian && SKIP=1 | ||
110 | testing "hexdump -e /2 %x (big endian)" \ | ||
111 | "hexdump -e '8/2 \" %6x\" \"\n\"'" \ | ||
112 | "\ | ||
113 | 1 203 405 607 809 a0b c0d e0f | ||
114 | 1011 1213 1415 1617 1819 1a1b 1c1d 1e1f | ||
115 | 7071 7273 7475 7677 7879 7a7b 7c7d 7e7f | ||
116 | 8081 8283 8485 8687 8889 8a8b 8c8d 8e8f | ||
117 | f0f1 f2f3 f4f5 f6f7 f8f9 fafb fcfd feff | ||
118 | " \ | ||
119 | "" "$input" | ||
120 | SKIP= | ||
121 | |||
122 | $little_endian || SKIP=1 | ||
123 | testing "hexdump -n4 -e '\"%u\"' (little endian)" \ | ||
86 | "hexdump -n4 -e '\"%u\"'" \ | 124 | "hexdump -n4 -e '\"%u\"'" \ |
87 | "12345678" \ | 125 | "12345678" \ |
88 | "" \ | 126 | "" \ |
89 | "\x4e\x61\xbc\x00AAAA" | 127 | "\x4e\x61\xbc\x00AAAA" |
128 | SKIP= | ||
129 | |||
130 | $little_endian && SKIP=1 | ||
131 | testing "hexdump -n4 -e '\"%u\"' (big endian)" \ | ||
132 | "hexdump -n4 -e '\"%u\"'" \ | ||
133 | "1315027968" \ | ||
134 | "" \ | ||
135 | "\x4e\x61\xbc\x00AAAA" | ||
136 | SKIP= | ||
90 | 137 | ||
91 | exit $FAILCOUNT | 138 | exit $FAILCOUNT |
diff --git a/testsuite/od.tests b/testsuite/od.tests index 4f245a7e8..c863bf2e8 100755 --- a/testsuite/od.tests +++ b/testsuite/od.tests | |||
@@ -61,7 +61,8 @@ testing "od -a (DESKTOP)" \ | |||
61 | "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff" | 61 | "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff" |
62 | SKIP= | 62 | SKIP= |
63 | 63 | ||
64 | testing "od -B" \ | 64 | $little_endian || SKIP=1 |
65 | testing "od -B (little-endian)" \ | ||
65 | "od -B" \ | 66 | "od -B" \ |
66 | "\ | 67 | "\ |
67 | 0000000 001001 005003 041101 177103 | 68 | 0000000 001001 005003 041101 177103 |
@@ -70,6 +71,16 @@ testing "od -B" \ | |||
70 | "" "$input" | 71 | "" "$input" |
71 | SKIP= | 72 | SKIP= |
72 | 73 | ||
74 | $little_endian && SKIP=1 | ||
75 | testing "od -B (big-endian)" \ | ||
76 | "od -B" \ | ||
77 | "\ | ||
78 | 0000000 000402 001412 040502 041776 | ||
79 | 0000010 | ||
80 | " \ | ||
81 | "" "$input" | ||
82 | SKIP= | ||
83 | |||
73 | $little_endian || SKIP=1 | 84 | $little_endian || SKIP=1 |
74 | testing "od -o (little-endian)" \ | 85 | testing "od -o (little-endian)" \ |
75 | "od -o" \ | 86 | "od -o" \ |