aboutsummaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2009-07-18 16:22:26 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2009-07-18 16:22:26 +0200
commit6ae6426a7485b5835c23aea198b3065f491d918b (patch)
tree79ebcee570986e27d7137720ca3139af277a162b /testsuite
parentb71ce023e9527b6afaa497ce62ca53a74cf94cef (diff)
downloadbusybox-w32-6ae6426a7485b5835c23aea198b3065f491d918b.tar.gz
busybox-w32-6ae6426a7485b5835c23aea198b3065f491d918b.tar.bz2
busybox-w32-6ae6426a7485b5835c23aea198b3065f491d918b.zip
fix mountpoint test to not prevemt mkfs_xxx from making image in any file
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/README2
-rwxr-xr-xtestsuite/cpio.tests2
-rwxr-xr-xtestsuite/mount.tests5
-rwxr-xr-xtestsuite/od.tests2
-rwxr-xr-xtestsuite/runtest14
-rwxr-xr-xtestsuite/sed.tests18
-rwxr-xr-xtestsuite/sort.tests7
-rwxr-xr-xtestsuite/testing.sh16
8 files changed, 43 insertions, 23 deletions
diff --git a/testsuite/README b/testsuite/README
index 3c52254dd..03ac377ba 100644
--- a/testsuite/README
+++ b/testsuite/README
@@ -27,6 +27,8 @@ For busybox built against uclibc, /etc/TZ does not exist or does not match
27host system timezone setting. For glibc based host systems, timezona settings 27host system timezone setting. For glibc based host systems, timezona settings
28are in /etc/localtime. 28are in /etc/localtime.
29 29
30LANG and LC_xxx environment variables set to non-C locale.
31
30 32
31For the entire testsuite, the copyright is as follows: 33For the entire testsuite, the copyright is as follows:
32 34
diff --git a/testsuite/cpio.tests b/testsuite/cpio.tests
index 576180ff1..fa0b65a08 100755
--- a/testsuite/cpio.tests
+++ b/testsuite/cpio.tests
@@ -41,6 +41,7 @@ ls -ln cpio.testdir | $FILTER_LS" \
41" \ 41" \
42 "" "" 42 "" ""
43 43
44test x"$SKIP_KNOWN_BUGS" = x"" && {
44# Currently fails. Numerous buglets: "1 blocks" versus "1 block", 45# Currently fails. Numerous buglets: "1 blocks" versus "1 block",
45# "1 block" must go to stderr, does not list cpio.testdir/x and cpio.testdir/y 46# "1 block" must go to stderr, does not list cpio.testdir/x and cpio.testdir/y
46testing "cpio lists hardlinks" \ 47testing "cpio lists hardlinks" \
@@ -53,6 +54,7 @@ cpio.testdir/y
530 540
54" \ 55" \
55 "" "" 56 "" ""
57}
56 58
57# More complex case 59# More complex case
58rm -rf cpio.testdir cpio.testdir2 2>/dev/null 60rm -rf cpio.testdir cpio.testdir2 2>/dev/null
diff --git a/testsuite/mount.tests b/testsuite/mount.tests
index 5374ecbd6..c8381a0de 100755
--- a/testsuite/mount.tests
+++ b/testsuite/mount.tests
@@ -1,5 +1,4 @@
1#!/bin/sh 1#!/bin/sh
2
3# Copyright 2007 by Denys Vlasenko <vda.linux@googlemail.com> 2# Copyright 2007 by Denys Vlasenko <vda.linux@googlemail.com>
4# Licensed under GPL v2, see file LICENSE for details. 3# Licensed under GPL v2, see file LICENSE for details.
5 4
@@ -10,8 +9,8 @@ test "`id -u`" = 0 || {
10 exit 0 9 exit 0
11} 10}
12 11
13dd if=/dev/zero of=mount.image1m count=1 bs=1M 2>/dev/null || exit 1 12dd if=/dev/zero of=mount.image1m count=1 bs=1M 2>/dev/null || { echo "dd error"; exit 1; }
14mkfs.minix -v mount.image1m >/dev/null 2>&1 || exit 1 13mkfs.minix -v mount.image1m >/dev/null 2>&1 || { echo "mkfs.minix error"; exit 1; }
15testdir=$PWD/testdir 14testdir=$PWD/testdir
16mkdir $testdir 2>/dev/null 15mkdir $testdir 2>/dev/null
17umount -d $testdir 2>/dev/null 16umount -d $testdir 2>/dev/null
diff --git a/testsuite/od.tests b/testsuite/od.tests
index 69c29952a..f136bb5fa 100755
--- a/testsuite/od.tests
+++ b/testsuite/od.tests
@@ -10,7 +10,7 @@ testing "od -b" \
10 "od -b" \ 10 "od -b" \
11"\ 11"\
120000000 110 105 114 114 117 120000000 110 105 114 114 117
130000006 130000005
14" \ 14" \
15 "" "HELLO" 15 "" "HELLO"
16 16
diff --git a/testsuite/runtest b/testsuite/runtest
index 5560f7bc2..2428f6c36 100755
--- a/testsuite/runtest
+++ b/testsuite/runtest
@@ -1,20 +1,8 @@
1#!/bin/sh 1#!/bin/sh
2
3# Usage: 2# Usage:
4# runtest [applet1] [applet2...] 3# runtest [applet1] [applet2...]
5 4
6# Helper for helpers. Oh my... 5. testing.sh
7test x"$ECHO" != x"" || {
8 ECHO="echo"
9 test x"`echo -ne`" = x"" || {
10 # Compile and use a replacement 'echo' which understands -e -n
11 ECHO="$PWD/echo-ne"
12 test -x "$ECHO" || {
13 gcc -Os -o "$ECHO" ../scripts/echo.c || exit 1
14 }
15 }
16 export ECHO
17}
18 6
19# Run one old-style test. 7# Run one old-style test.
20# Tests are stored in applet/testcase shell scripts. 8# Tests are stored in applet/testcase shell scripts.
diff --git a/testsuite/sed.tests b/testsuite/sed.tests
index 677303be1..a9d9ada31 100755
--- a/testsuite/sed.tests
+++ b/testsuite/sed.tests
@@ -51,8 +51,10 @@ testing "sed -n" "sed -n -e s/foo/bar/ -e s/bar/baz/" "" "" "foo\n"
51testing "sed s//p" "sed -e s/foo/bar/p -e s/bar/baz/p" "bar\nbaz\nbaz\n" \ 51testing "sed s//p" "sed -e s/foo/bar/p -e s/bar/baz/p" "bar\nbaz\nbaz\n" \
52 "" "foo\n" 52 "" "foo\n"
53testing "sed -n s//p" "sed -ne s/abc/def/p" "def\n" "" "abc\n" 53testing "sed -n s//p" "sed -ne s/abc/def/p" "def\n" "" "abc\n"
54test x"$SKIP_KNOWN_BUGS" = x"" && {
54testing "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" \
55 "" "12345\n" 56 "" "12345\n"
57}
56testing "sed s arbitrary delimiter" "sed -e 's woo boing '" "boing\n" "" "woo\n" 58testing "sed s arbitrary delimiter" "sed -e 's woo boing '" "boing\n" "" "woo\n"
57testing "sed s chains" "sed -e s/foo/bar/ -e s/bar/baz/" "baz\n" "" "foo\n" 59testing "sed s chains" "sed -e s/foo/bar/ -e s/bar/baz/" "baz\n" "" "foo\n"
58testing "sed s chains2" "sed -e s/foo/bar/ -e s/baz/nee/" "bar\n" "" "foo\n" 60testing "sed s chains2" "sed -e s/foo/bar/ -e s/baz/nee/" "bar\n" "" "foo\n"
@@ -72,6 +74,7 @@ testing "sed t (test/branch clears test bit)" "sed -e 's/a/b/;:loop;t loop'" \
72testing "sed T (!test/branch)" "sed -e 's/a/1/;T notone;p;: notone;p'" \ 74testing "sed T (!test/branch)" "sed -e 's/a/1/;T notone;p;: notone;p'" \
73 "1\n1\n1\nb\nb\nc\nc\n" "" "a\nb\nc\n" 75 "1\n1\n1\nb\nb\nc\nc\n" "" "a\nb\nc\n"
74 76
77test x"$SKIP_KNOWN_BUGS" = x"" && {
75# Normal sed end-of-script doesn't print "c" because n flushed the pattern 78# Normal sed end-of-script doesn't print "c" because n flushed the pattern
76# space. If n hits EOF, pattern space is empty when script ends. 79# space. If n hits EOF, pattern space is empty when script ends.
77# Query: how does this interact with no newline at EOF? 80# Query: how does this interact with no newline at EOF?
@@ -80,6 +83,7 @@ testing "sed n (flushes pattern space, terminates early)" "sed -e 'n;p'" \
80# N does _not_ flush pattern space, therefore c is still in there @ script end. 83# N does _not_ flush pattern space, therefore c is still in there @ script end.
81testing "sed N (doesn't flush pattern space when terminating)" "sed -e 'N;p'" \ 84testing "sed N (doesn't flush pattern space when terminating)" "sed -e 'N;p'" \
82 "a\nb\na\nb\nc\n" "" "a\nb\nc\n" 85 "a\nb\na\nb\nc\n" "" "a\nb\nc\n"
86}
83testing "sed address match newline" 'sed "/b/N;/b\\nc/i woo"' \ 87testing "sed address match newline" 'sed "/b/N;/b\\nc/i woo"' \
84 "a\nwoo\nb\nc\nd\n" "" "a\nb\nc\nd\n" 88 "a\nwoo\nb\nc\nd\n" "" "a\nb\nc\nd\n"
85 89
@@ -99,13 +103,17 @@ testing "sed d ends script iteration (2)" \
99 "sed -e '/ook/d;a\' -e 'bang'" "woot\nbang\n" "" "ook\nwoot\n" 103 "sed -e '/ook/d;a\' -e 'bang'" "woot\nbang\n" "" "ook\nwoot\n"
100 104
101# Multiple files, with varying newlines and NUL bytes 105# Multiple files, with varying newlines and NUL bytes
106test x"$SKIP_KNOWN_BUGS" = x"" && {
102testing "sed embedded NUL" "sed -e 's/woo/bang/'" "\0bang\0woo\0" "" \ 107testing "sed embedded NUL" "sed -e 's/woo/bang/'" "\0bang\0woo\0" "" \
103 "\0woo\0woo\0" 108 "\0woo\0woo\0"
109}
104testing "sed embedded NUL g" "sed -e 's/woo/bang/g'" "bang\0bang\0" "" \ 110testing "sed embedded NUL g" "sed -e 's/woo/bang/g'" "bang\0bang\0" "" \
105 "woo\0woo\0" 111 "woo\0woo\0"
112test x"$SKIP_KNOWN_BUGS" = x"" && {
106echo -e "/woo/a he\0llo" > sed.commands 113echo -e "/woo/a he\0llo" > sed.commands
107testing "sed NUL in command" "sed -f sed.commands" "woo\nhe\0llo\n" "" "woo" 114testing "sed NUL in command" "sed -f sed.commands" "woo\nhe\0llo\n" "" "woo"
108rm sed.commands 115rm sed.commands
116}
109 117
110# sed has funky behavior with newlines at the end of file. Test lots of 118# sed has funky behavior with newlines at the end of file. Test lots of
111# corner cases with the optional newline appending behavior. 119# corner cases with the optional newline appending behavior.
@@ -120,8 +128,10 @@ testing "sed empty file plus cat" "sed -e 's/nohit//' input -" "one\ntwo" \
120 "" "one\ntwo" 128 "" "one\ntwo"
121testing "sed cat plus empty file" "sed -e 's/nohit//' input -" "one\ntwo" \ 129testing "sed cat plus empty file" "sed -e 's/nohit//' input -" "one\ntwo" \
122 "one\ntwo" "" 130 "one\ntwo" ""
131test x"$SKIP_KNOWN_BUGS" = x"" && {
123testing "sed append autoinserts newline" "sed -e '/woot/a woo' -" \ 132testing "sed append autoinserts newline" "sed -e '/woot/a woo' -" \
124 "woot\nwoo\n" "" "woot" 133 "woot\nwoo\n" "" "woot"
134}
125testing "sed insert doesn't autoinsert newline" "sed -e '/woot/i woo' -" \ 135testing "sed insert doesn't autoinsert newline" "sed -e '/woot/i woo' -" \
126 "woo\nwoot" "" "woot" 136 "woo\nwoot" "" "woot"
127testing "sed print autoinsert newlines" "sed -e 'p' -" "one\none" "" "one" 137testing "sed print autoinsert newlines" "sed -e 'p' -" "one\none" "" "one"
@@ -137,9 +147,11 @@ testing "sed selective matches insert newline" \
137testing "sed selective matches noinsert newline" \ 147testing "sed selective matches noinsert newline" \
138 "sed -ne 's/woo/bang/p' input -" "a bang\nb bang" "a woo\nb woo" \ 148 "sed -ne 's/woo/bang/p' input -" "a bang\nb bang" "a woo\nb woo" \
139 "c no\nd no" 149 "c no\nd no"
150test x"$SKIP_KNOWN_BUGS" = x"" && {
140testing "sed clusternewline" \ 151testing "sed clusternewline" \
141 "sed -e '/one/a 111' -e '/two/i 222' -e p input -" \ 152 "sed -e '/one/a 111' -e '/two/i 222' -e p input -" \
142 "one\none\n111\n222\ntwo\ntwo" "one" "two" 153 "one\none\n111\n222\ntwo\ntwo" "one" "two"
154}
143testing "sed subst+write" \ 155testing "sed subst+write" \
144 "sed -e 's/i/z/' -e 'woutputw' input -; echo -n X; cat outputw" \ 156 "sed -e 's/i/z/' -e 'woutputw' input -; echo -n X; cat outputw" \
145 "thzngy\nagaznXthzngy\nagazn" "thingy" "again" 157 "thzngy\nagaznXthzngy\nagazn" "thingy" "again"
@@ -175,8 +187,12 @@ testing "sed lie-to-autoconf" "sed --version | grep -o 'GNU sed version '" \
175 "GNU sed version \n" "" "" 187 "GNU sed version \n" "" ""
176 188
177# Jump to nonexistent label 189# Jump to nonexistent label
178testing "sed nonexistent label" "sed -e 'b walrus' 2> /dev/null || echo yes" \ 190test x"$SKIP_KNOWN_BUGS" = x"" && {
191# Incompatibility: illegal jump is not detected if input is ""
192# (that is, no lines at all). GNU sed 4.1.5 complains even in this case
193testing "sed nonexistent label" "sed -e 'b walrus' 2>/dev/null || echo yes" \
179 "yes\n" "" "" 194 "yes\n" "" ""
195}
180 196
181testing "sed backref from empty s uses range regex" \ 197testing "sed backref from empty s uses range regex" \
182 "sed -e '/woot/s//eep \0 eep/'" "eep woot eep" "" "woot" 198 "sed -e '/woot/s//eep \0 eep/'" "eep woot eep" "" "woot"
diff --git a/testsuite/sort.tests b/testsuite/sort.tests
index f700dc0c1..627ca51f8 100755
--- a/testsuite/sort.tests
+++ b/testsuite/sort.tests
@@ -45,8 +45,8 @@ egg 1 2 papyrus
45999 3 0 algebra 45999 3 0 algebra
46" "$data" "" 46" "$data" ""
47 47
48# Busybox is definitely doing this one wrong just now. FIXME 48test x"$SKIP_KNOWN_BUGS" = x"" && {
49 49# Busybox is definitely doing these wrong. FIXME
50testing "sort key range with numeric option and global reverse" \ 50testing "sort key range with numeric option and global reverse" \
51"sort -k2,3n -r input" \ 51"sort -k2,3n -r input" \
52"egg 1 2 papyrus 52"egg 1 2 papyrus
@@ -56,8 +56,6 @@ testing "sort key range with numeric option and global reverse" \
567 3 42 soup 567 3 42 soup
57" "$data" "" 57" "$data" ""
58 58
59#
60
61testing "sort key range with multiple options" "sort -k2,3rn input" \ 59testing "sort key range with multiple options" "sort -k2,3rn input" \
62"7 3 42 soup 60"7 3 42 soup
63999 3 0 algebra 61999 3 0 algebra
@@ -65,6 +63,7 @@ testing "sort key range with multiple options" "sort -k2,3rn input" \
6542 1 3 woot 6342 1 3 woot
66egg 1 2 papyrus 64egg 1 2 papyrus
67" "$data" "" 65" "$data" ""
66}
68 67
69testing "sort key range with two -k options" "sort -k 2,2n -k 1,1r input" "\ 68testing "sort key range with two -k options" "sort -k 2,2n -k 1,1r input" "\
70d 2 69d 2
diff --git a/testsuite/testing.sh b/testsuite/testing.sh
index a57c4d68d..22c640faf 100755
--- a/testsuite/testing.sh
+++ b/testsuite/testing.sh
@@ -36,6 +36,20 @@
36export FAILCOUNT=0 36export FAILCOUNT=0
37export SKIP= 37export SKIP=
38 38
39# Helper for helpers. Oh my...
40
41test x"$ECHO" != x"" || {
42 ECHO="echo"
43 test x"`echo -ne`" = x"" || {
44 # Compile and use a replacement 'echo' which understands -e -n
45 ECHO="$PWD/echo-ne"
46 test -x "$ECHO" || {
47 gcc -Os -o "$ECHO" ../scripts/echo.c || exit 1
48 }
49 }
50 export ECHO
51}
52
39# Helper functions 53# Helper functions
40 54
41optional() 55optional()
@@ -73,7 +87,7 @@ testing()
73 87
74 $ECHO -ne "$3" > expected 88 $ECHO -ne "$3" > expected
75 $ECHO -ne "$4" > input 89 $ECHO -ne "$4" > input
76 [ -z "$VERBOSE" ] || echo "echo '$5' | $2" 90 [ -z "$VERBOSE" ] || echo "echo -ne '$5' | $2"
77 $ECHO -ne "$5" | eval "$2" > actual 91 $ECHO -ne "$5" | eval "$2" > actual
78 RETVAL=$? 92 RETVAL=$?
79 93