diff options
Diffstat (limited to 'testsuite')
-rwxr-xr-x | testsuite/awk.tests | 19 | ||||
-rw-r--r-- | testsuite/du/du-k-works | 1 | ||||
-rwxr-xr-x | testsuite/mkfs.minix.tests | 10 | ||||
-rwxr-xr-x | testsuite/mount.tests | 27 | ||||
-rwxr-xr-x | testsuite/sed.tests | 18 |
5 files changed, 71 insertions, 4 deletions
diff --git a/testsuite/awk.tests b/testsuite/awk.tests index 5a323047d..f9c3b6b4d 100755 --- a/testsuite/awk.tests +++ b/testsuite/awk.tests | |||
@@ -16,6 +16,13 @@ testing "awk -F case 5" "awk -F '[#]' '{ print NF }'" "4\n" "" "#abc##zz\n" | |||
16 | testing "awk -F case 6" "awk -F '[#]' '{ print NF }'" "4\n" "" "z#abc##zz\n" | 16 | testing "awk -F case 6" "awk -F '[#]' '{ print NF }'" "4\n" "" "z#abc##zz\n" |
17 | testing "awk -F case 7" "awk -F '[#]' '{ print NF }'" "5\n" "" "z##abc##zz\n" | 17 | testing "awk -F case 7" "awk -F '[#]' '{ print NF }'" "5\n" "" "z##abc##zz\n" |
18 | 18 | ||
19 | # conditions and operators | ||
20 | testing "awk if operator == " "awk 'BEGIN{if(23==23) print \"foo\"}'" "foo\n" "" "" | ||
21 | testing "awk if operator != " "awk 'BEGIN{if(23!=23) print \"bar\"}'" "" "" "" | ||
22 | testing "awk if operator >= " "awk 'BEGIN{if(23>=23) print \"foo\"}'" "foo\n" "" "" | ||
23 | testing "awk if operator < " "awk 'BEGIN{if(2 < 13) print \"foo\"}'" "foo\n" "" "" | ||
24 | testing "awk if string == " "awk 'BEGIN{if(\"a\"==\"ab\") print \"bar\"}'" "" "" "" | ||
25 | |||
19 | # 4294967295 = 0xffffffff | 26 | # 4294967295 = 0xffffffff |
20 | testing "awk bitwise op" "awk '{ print or(4294967295,1) }'" "4.29497e+09\n" "" "\n" | 27 | testing "awk bitwise op" "awk '{ print or(4294967295,1) }'" "4.29497e+09\n" "" "\n" |
21 | optional DESKTOP | 28 | optional DESKTOP |
@@ -36,6 +43,11 @@ testing "awk long field sep" "awk -F-- '{ print NF, length(\$NF), \$NF }'" \ | |||
36 | "" \ | 43 | "" \ |
37 | "a--\na--b--\na--b--c--\na--b--c--d--" | 44 | "a--\na--b--\na--b--c--\na--b--c--d--" |
38 | 45 | ||
46 | testing "awk -F handles escapes" "awk -F'\\x21' '{print \$1}'" \ | ||
47 | "a\n" \ | ||
48 | "" \ | ||
49 | "a!b\n" | ||
50 | |||
39 | # '@(samp|code|file)\{' is an invalid extended regex (unmatched '{'), | 51 | # '@(samp|code|file)\{' is an invalid extended regex (unmatched '{'), |
40 | # but gawk 3.1.5 does not bail out on it. | 52 | # but gawk 3.1.5 does not bail out on it. |
41 | testing "awk gsub falls back to non-extended-regex" \ | 53 | testing "awk gsub falls back to non-extended-regex" \ |
@@ -205,4 +217,11 @@ end d | |||
205 | testing "awk handles empty ()" \ | 217 | testing "awk handles empty ()" \ |
206 | "awk 'BEGIN {print()}' 2>&1" "awk: cmd. line:1: Empty sequence\n" "" "" | 218 | "awk 'BEGIN {print()}' 2>&1" "awk: cmd. line:1: Empty sequence\n" "" "" |
207 | 219 | ||
220 | testing "awk FS assignment" "awk '{FS=\":\"; print \$1}'" \ | ||
221 | "a:b\ne\n" \ | ||
222 | "" \ | ||
223 | "a:b c:d\ne:f g:h" | ||
224 | |||
225 | # testing "description" "command" "result" "infile" "stdin" | ||
226 | |||
208 | exit $FAILCOUNT | 227 | exit $FAILCOUNT |
diff --git a/testsuite/du/du-k-works b/testsuite/du/du-k-works index 229a948ee..36dcaa85d 100644 --- a/testsuite/du/du-k-works +++ b/testsuite/du/du-k-works | |||
@@ -3,4 +3,5 @@ cd du.testdir | |||
3 | dd if=/dev/zero of=file1 bs=1k count=64 2>/dev/null | 3 | dd if=/dev/zero of=file1 bs=1k count=64 2>/dev/null |
4 | dd if=/dev/zero of=file2 bs=1k count=16 2>/dev/null | 4 | dd if=/dev/zero of=file2 bs=1k count=16 2>/dev/null |
5 | test x"`busybox du -k .`" = x"80 ." \ | 5 | test x"`busybox du -k .`" = x"80 ." \ |
6 | -o x"`busybox du -k .`" = x"84 ." \ | ||
6 | -o x"`busybox du -k .`" = x"88 ." | 7 | -o x"`busybox du -k .`" = x"88 ." |
diff --git a/testsuite/mkfs.minix.tests b/testsuite/mkfs.minix.tests index 8a33c1681..7eecaf230 100755 --- a/testsuite/mkfs.minix.tests +++ b/testsuite/mkfs.minix.tests | |||
@@ -8,6 +8,14 @@ | |||
8 | 8 | ||
9 | # testing "test name" "options" "expected result" "file input" "stdin" | 9 | # testing "test name" "options" "expected result" "file input" "stdin" |
10 | 10 | ||
11 | # '\n' produces 10 on little endian, but not on big endian | ||
12 | cr=`echo | od -i | sed 's/.* //g;2d'` | ||
13 | if [ x"$cr" = x"10" ]; then | ||
14 | hash=4f35f7afeba07d56055bed1f29ae20b7 | ||
15 | else | ||
16 | hash=5adbc1b3ccd20ca5d0ab5bc1e13ac3fc | ||
17 | fi | ||
18 | |||
11 | testing "mkfs.minix" \ | 19 | testing "mkfs.minix" \ |
12 | "dd if=/dev/zero of=input bs=1k count=1024 2>/dev/null; mkfs.minix input; md5sum <input" \ | 20 | "dd if=/dev/zero of=input bs=1k count=1024 2>/dev/null; mkfs.minix input; md5sum <input" \ |
13 | "352 inodes\n"\ | 21 | "352 inodes\n"\ |
@@ -15,7 +23,7 @@ testing "mkfs.minix" \ | |||
15 | "Firstdatazone=15 (15)\n"\ | 23 | "Firstdatazone=15 (15)\n"\ |
16 | "Zonesize=1024\n"\ | 24 | "Zonesize=1024\n"\ |
17 | "Maxsize=268966912\n"\ | 25 | "Maxsize=268966912\n"\ |
18 | "4f35f7afeba07d56055bed1f29ae20b7 -\n" \ | 26 | "$hash -\n" \ |
19 | "" \ | 27 | "" \ |
20 | "" | 28 | "" |
21 | 29 | ||
diff --git a/testsuite/mount.tests b/testsuite/mount.tests index c5891be83..a0bc50888 100755 --- a/testsuite/mount.tests +++ b/testsuite/mount.tests | |||
@@ -36,7 +36,8 @@ testing "mount -o remount,mand" \ | |||
36 | "mount -o loop mount.image1m $testdir "\ | 36 | "mount -o loop mount.image1m $testdir "\ |
37 | "&& grep -Fc $testdir </proc/mounts "\ | 37 | "&& grep -Fc $testdir </proc/mounts "\ |
38 | "&& mount -o remount,mand $testdir "\ | 38 | "&& mount -o remount,mand $testdir "\ |
39 | "&& grep -F $testdir </proc/mounts | grep -c '[, ]mand[, ]'" \ | 39 | "&& grep -F $testdir </proc/mounts | grep -c '[, ]mand[, ]'"\ |
40 | "|| grep -F $testdir </proc/mounts" \ | ||
40 | "1\n""1\n" \ | 41 | "1\n""1\n" \ |
41 | "" "" | 42 | "" "" |
42 | 43 | ||
@@ -83,4 +84,28 @@ b | |||
83 | "" "" | 84 | "" "" |
84 | SKIP= | 85 | SKIP= |
85 | 86 | ||
87 | |||
88 | testing "mount RO loop" "\ | ||
89 | exec 2>&1 | ||
90 | umount -d mount.dir 2>/dev/null | ||
91 | rmdir mount.dir 2>/dev/null | ||
92 | mkdir -p mount.dir | ||
93 | ( | ||
94 | cd mount.dir || { echo 'cd error'; exit 1; } | ||
95 | mkdir z1 z2 || { echo 'mkdir error'; exit 1; } | ||
96 | mount -t tmpfs tmpfs z1 || { echo 'mount tmpfs error'; exit 1; } | ||
97 | dd if=/dev/zero of=z1/e2img count=10 bs=1M 2>/dev/null || { echo 'dd error'; exit 1; } | ||
98 | mke2fs -F z1/e2img 2>/dev/null >&2 || { echo 'mke2fs error'; exit 1; } | ||
99 | mount -r -o loop -t ext2 z1/e2img z2 || { echo 'mount -r -o loop error'; exit 1; } | ||
100 | mount -o remount,ro z1 || { echo 'mount -o remount,ro error'; exit 1; } | ||
101 | ) | ||
102 | umount -d mount.dir/z2 | ||
103 | ##losetup -d /dev/loop* | ||
104 | umount -d mount.dir/z1 | ||
105 | rm -rf mount.dir | ||
106 | echo DONE | ||
107 | " \ | ||
108 | "DONE\n" "" "" | ||
109 | |||
110 | |||
86 | exit $FAILCOUNT | 111 | exit $FAILCOUNT |
diff --git a/testsuite/sed.tests b/testsuite/sed.tests index 9fa8e190c..468565f47 100755 --- a/testsuite/sed.tests +++ b/testsuite/sed.tests | |||
@@ -52,10 +52,8 @@ testing "sed with empty match" "sed 's/z*//g'" "string\n" "" "string\n" | |||
52 | testing "sed s//p" "sed -e s/foo/bar/p -e s/bar/baz/p" "bar\nbaz\nbaz\n" \ | 52 | testing "sed s//p" "sed -e s/foo/bar/p -e s/bar/baz/p" "bar\nbaz\nbaz\n" \ |
53 | "" "foo\n" | 53 | "" "foo\n" |
54 | testing "sed -n s//p" "sed -ne s/abc/def/p" "def\n" "" "abc\n" | 54 | testing "sed -n s//p" "sed -ne s/abc/def/p" "def\n" "" "abc\n" |
55 | test x"$SKIP_KNOWN_BUGS" = x"" && { | ||
56 | testing "sed s//g (exhaustive)" "sed -e 's/[[:space:]]*/,/g'" ",1,2,3,4,5,\n" \ | 55 | testing "sed s//g (exhaustive)" "sed -e 's/[[:space:]]*/,/g'" ",1,2,3,4,5,\n" \ |
57 | "" "12345\n" | 56 | "" "12345\n" |
58 | } | ||
59 | testing "sed s arbitrary delimiter" "sed -e 's woo boing '" "boing\n" "" "woo\n" | 57 | testing "sed s arbitrary delimiter" "sed -e 's woo boing '" "boing\n" "" "woo\n" |
60 | testing "sed s chains" "sed -e s/foo/bar/ -e s/bar/baz/" "baz\n" "" "foo\n" | 58 | testing "sed s chains" "sed -e s/foo/bar/ -e s/bar/baz/" "baz\n" "" "foo\n" |
61 | testing "sed s chains2" "sed -e s/foo/bar/ -e s/baz/nee/" "bar\n" "" "foo\n" | 59 | testing "sed s chains2" "sed -e s/foo/bar/ -e s/baz/nee/" "bar\n" "" "foo\n" |
@@ -296,6 +294,22 @@ testing "sed -i finishes ranges correctly" \ | |||
296 | "sed '1,2d' -i input; echo \$?; cat input" \ | 294 | "sed '1,2d' -i input; echo \$?; cat input" \ |
297 | "0\n3\n4\n" "1\n2\n3\n4\n" "" | 295 | "0\n3\n4\n" "1\n2\n3\n4\n" "" |
298 | 296 | ||
297 | testing "sed zero chars match/replace advances correctly 1" \ | ||
298 | "sed 's/l*/@/g'" \ | ||
299 | "@h@e@o@\n" "" "helllo\n" | ||
300 | |||
301 | testing "sed zero chars match/replace advances correctly 2" \ | ||
302 | "sed 's [^ .]* x g'" \ | ||
303 | "x x.x\n" "" " a.b\n" | ||
304 | |||
305 | testing "sed zero chars match/replace logic must not falsely trigger here 1" \ | ||
306 | "sed 's/a/A/g'" \ | ||
307 | "_AAA1AA\n" "" "_aaa1aa\n" | ||
308 | |||
309 | testing "sed zero chars match/replace logic must not falsely trigger here 2" \ | ||
310 | "sed 's/ *$/_/g'" \ | ||
311 | "qwerty_\n" "" "qwerty\n" | ||
312 | |||
299 | # testing "description" "commands" "result" "infile" "stdin" | 313 | # testing "description" "commands" "result" "infile" "stdin" |
300 | 314 | ||
301 | exit $FAILCOUNT | 315 | exit $FAILCOUNT |