aboutsummaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite')
-rwxr-xr-xtestsuite/awk.tests19
-rw-r--r--testsuite/du/du-k-works1
-rwxr-xr-xtestsuite/mkfs.minix.tests10
-rwxr-xr-xtestsuite/mount.tests27
-rwxr-xr-xtestsuite/sed.tests18
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"
16testing "awk -F case 6" "awk -F '[#]' '{ print NF }'" "4\n" "" "z#abc##zz\n" 16testing "awk -F case 6" "awk -F '[#]' '{ print NF }'" "4\n" "" "z#abc##zz\n"
17testing "awk -F case 7" "awk -F '[#]' '{ print NF }'" "5\n" "" "z##abc##zz\n" 17testing "awk -F case 7" "awk -F '[#]' '{ print NF }'" "5\n" "" "z##abc##zz\n"
18 18
19# conditions and operators
20testing "awk if operator == " "awk 'BEGIN{if(23==23) print \"foo\"}'" "foo\n" "" ""
21testing "awk if operator != " "awk 'BEGIN{if(23!=23) print \"bar\"}'" "" "" ""
22testing "awk if operator >= " "awk 'BEGIN{if(23>=23) print \"foo\"}'" "foo\n" "" ""
23testing "awk if operator < " "awk 'BEGIN{if(2 < 13) print \"foo\"}'" "foo\n" "" ""
24testing "awk if string == " "awk 'BEGIN{if(\"a\"==\"ab\") print \"bar\"}'" "" "" ""
25
19# 4294967295 = 0xffffffff 26# 4294967295 = 0xffffffff
20testing "awk bitwise op" "awk '{ print or(4294967295,1) }'" "4.29497e+09\n" "" "\n" 27testing "awk bitwise op" "awk '{ print or(4294967295,1) }'" "4.29497e+09\n" "" "\n"
21optional DESKTOP 28optional 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
46testing "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.
41testing "awk gsub falls back to non-extended-regex" \ 53testing "awk gsub falls back to non-extended-regex" \
@@ -205,4 +217,11 @@ end d
205testing "awk handles empty ()" \ 217testing "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
220testing "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
208exit $FAILCOUNT 227exit $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
3dd if=/dev/zero of=file1 bs=1k count=64 2>/dev/null 3dd if=/dev/zero of=file1 bs=1k count=64 2>/dev/null
4dd if=/dev/zero of=file2 bs=1k count=16 2>/dev/null 4dd if=/dev/zero of=file2 bs=1k count=16 2>/dev/null
5test x"`busybox du -k .`" = x"80 ." \ 5test 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
12cr=`echo | od -i | sed 's/.* //g;2d'`
13if [ x"$cr" = x"10" ]; then
14 hash=4f35f7afeba07d56055bed1f29ae20b7
15else
16 hash=5adbc1b3ccd20ca5d0ab5bc1e13ac3fc
17fi
18
11testing "mkfs.minix" \ 19testing "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 "" ""
84SKIP= 85SKIP=
85 86
87
88testing "mount RO loop" "\
89exec 2>&1
90umount -d mount.dir 2>/dev/null
91rmdir mount.dir 2>/dev/null
92mkdir -p mount.dir
93(
94cd mount.dir || { echo 'cd error'; exit 1; }
95mkdir z1 z2 || { echo 'mkdir error'; exit 1; }
96mount -t tmpfs tmpfs z1 || { echo 'mount tmpfs error'; exit 1; }
97dd if=/dev/zero of=z1/e2img count=10 bs=1M 2>/dev/null || { echo 'dd error'; exit 1; }
98mke2fs -F z1/e2img 2>/dev/null >&2 || { echo 'mke2fs error'; exit 1; }
99mount -r -o loop -t ext2 z1/e2img z2 || { echo 'mount -r -o loop error'; exit 1; }
100mount -o remount,ro z1 || { echo 'mount -o remount,ro error'; exit 1; }
101)
102umount -d mount.dir/z2
103##losetup -d /dev/loop*
104umount -d mount.dir/z1
105rm -rf mount.dir
106echo DONE
107" \
108"DONE\n" "" ""
109
110
86exit $FAILCOUNT 111exit $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"
52testing "sed s//p" "sed -e s/foo/bar/p -e s/bar/baz/p" "bar\nbaz\nbaz\n" \ 52testing "sed s//p" "sed -e s/foo/bar/p -e s/bar/baz/p" "bar\nbaz\nbaz\n" \
53 "" "foo\n" 53 "" "foo\n"
54testing "sed -n s//p" "sed -ne s/abc/def/p" "def\n" "" "abc\n" 54testing "sed -n s//p" "sed -ne s/abc/def/p" "def\n" "" "abc\n"
55test x"$SKIP_KNOWN_BUGS" = x"" && {
56testing "sed s//g (exhaustive)" "sed -e 's/[[:space:]]*/,/g'" ",1,2,3,4,5,\n" \ 55testing "sed s//g (exhaustive)" "sed -e 's/[[:space:]]*/,/g'" ",1,2,3,4,5,\n" \
57 "" "12345\n" 56 "" "12345\n"
58}
59testing "sed s arbitrary delimiter" "sed -e 's woo boing '" "boing\n" "" "woo\n" 57testing "sed s arbitrary delimiter" "sed -e 's woo boing '" "boing\n" "" "woo\n"
60testing "sed s chains" "sed -e s/foo/bar/ -e s/bar/baz/" "baz\n" "" "foo\n" 58testing "sed s chains" "sed -e s/foo/bar/ -e s/bar/baz/" "baz\n" "" "foo\n"
61testing "sed s chains2" "sed -e s/foo/bar/ -e s/baz/nee/" "bar\n" "" "foo\n" 59testing "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
297testing "sed zero chars match/replace advances correctly 1" \
298 "sed 's/l*/@/g'" \
299 "@h@e@o@\n" "" "helllo\n"
300
301testing "sed zero chars match/replace advances correctly 2" \
302 "sed 's [^ .]* x g'" \
303 "x x.x\n" "" " a.b\n"
304
305testing "sed zero chars match/replace logic must not falsely trigger here 1" \
306 "sed 's/a/A/g'" \
307 "_AAA1AA\n" "" "_aaa1aa\n"
308
309testing "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
301exit $FAILCOUNT 315exit $FAILCOUNT