diff options
author | Dan Fandrich <dan@coneharvesters.com> | 2010-08-10 23:33:57 -0700 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-08-11 14:09:28 +0200 |
commit | 775965de859c6df5d5652f3f58edfd68803f0813 (patch) | |
tree | 445445fa22d29a79b68dcfd109854a12ffe44ec4 /testsuite | |
parent | f03fc7d77a5df53aae5eb2d02a49860dc2878da7 (diff) | |
download | busybox-w32-775965de859c6df5d5652f3f58edfd68803f0813.tar.gz busybox-w32-775965de859c6df5d5652f3f58edfd68803f0813.tar.bz2 busybox-w32-775965de859c6df5d5652f3f58edfd68803f0813.zip |
Improved portability of tests
Removed assumptions about umask and locale. Fixed hostname
tests to work even when the host has no DNS domain set.
Signed-off-by: Dan Fandrich <dan@coneharvesters.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'testsuite')
-rwxr-xr-x | testsuite/cpio.tests | 2 | ||||
-rw-r--r-- | testsuite/date/date-works-1 | 3 | ||||
-rw-r--r-- | testsuite/du/du-k-works | 4 | ||||
-rw-r--r-- | testsuite/du/du-l-works | 3 | ||||
-rw-r--r-- | testsuite/hostname/hostname-d-works | 4 | ||||
-rwxr-xr-x | testsuite/makedevs.tests | 4 | ||||
-rwxr-xr-x | testsuite/tar.tests | 6 | ||||
-rwxr-xr-x | testsuite/uuencode.tests | 3 |
8 files changed, 24 insertions, 5 deletions
diff --git a/testsuite/cpio.tests b/testsuite/cpio.tests index 7aee774a1..44c17e693 100755 --- a/testsuite/cpio.tests +++ b/testsuite/cpio.tests | |||
@@ -4,6 +4,8 @@ | |||
4 | 4 | ||
5 | . ./testing.sh | 5 | . ./testing.sh |
6 | 6 | ||
7 | umask 022 | ||
8 | |||
7 | # ls -ln shows date. Need to remove that, it's variable. | 9 | # ls -ln shows date. Need to remove that, it's variable. |
8 | # sed: coalesce spaces | 10 | # sed: coalesce spaces |
9 | # cut: remove date | 11 | # cut: remove date |
diff --git a/testsuite/date/date-works-1 b/testsuite/date/date-works-1 index e745d3841..cb5cea2c5 100644 --- a/testsuite/date/date-works-1 +++ b/testsuite/date/date-works-1 | |||
@@ -1,4 +1,7 @@ | |||
1 | unset LANG | 1 | unset LANG |
2 | unset LANGUAGE | ||
3 | unset LC_TIME | ||
4 | unset LC_ALL | ||
2 | 5 | ||
3 | dt=`busybox date -d 1:2 +%T` | 6 | dt=`busybox date -d 1:2 +%T` |
4 | test x"$dt" = x"01:02:00" | 7 | test x"$dt" = x"01:02:00" |
diff --git a/testsuite/du/du-k-works b/testsuite/du/du-k-works index a52264945..229a948ee 100644 --- a/testsuite/du/du-k-works +++ b/testsuite/du/du-k-works | |||
@@ -1,4 +1,6 @@ | |||
1 | mkdir du.testdir | ||
2 | cd du.testdir | ||
1 | 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 |
2 | 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 |
3 | test x"`busybox du -k .`" = x"80 ." \ | 5 | test x"`busybox du -k .`" = x"80 ." \ |
4 | -o x"`busybox du -k .`" = x"88 ." \ | 6 | -o x"`busybox du -k .`" = x"88 ." |
diff --git a/testsuite/du/du-l-works b/testsuite/du/du-l-works index 6b150e0dd..426ee891b 100644 --- a/testsuite/du/du-l-works +++ b/testsuite/du/du-l-works | |||
@@ -1,8 +1,11 @@ | |||
1 | # FEATURE: CONFIG_FEATURE_DU_DEFAULT_BLOCKSIZE_1K | 1 | # FEATURE: CONFIG_FEATURE_DU_DEFAULT_BLOCKSIZE_1K |
2 | 2 | ||
3 | mkdir du.testdir | ||
4 | cd du.testdir | ||
3 | dd if=/dev/zero of=file1 bs=1k count=64 2>/dev/null | 5 | dd if=/dev/zero of=file1 bs=1k count=64 2>/dev/null |
4 | ln file1 file1.1 | 6 | ln file1 file1.1 |
5 | dd if=/dev/zero of=file2 bs=1k count=16 2>/dev/null | 7 | dd if=/dev/zero of=file2 bs=1k count=16 2>/dev/null |
6 | test x"`busybox du -l .`" = x"144 ." \ | 8 | test x"`busybox du -l .`" = x"144 ." \ |
7 | -o x"`busybox du -l .`" = x"148 ." \ | 9 | -o x"`busybox du -l .`" = x"148 ." \ |
8 | -o x"`busybox du -l .`" = x"152 ." \ | 10 | -o x"`busybox du -l .`" = x"152 ." \ |
11 | -o x"`busybox du -l .`" = x"156 ." | ||
diff --git a/testsuite/hostname/hostname-d-works b/testsuite/hostname/hostname-d-works index e062242bb..54c0aac0c 100644 --- a/testsuite/hostname/hostname-d-works +++ b/testsuite/hostname/hostname-d-works | |||
@@ -1,3 +1,3 @@ | |||
1 | f=$(busybox hostname -f) | 1 | f=$(busybox hostname -f). |
2 | d=$(busybox hostname -d) | 2 | d=$(busybox hostname -d) |
3 | test x"${f#*.}" = x"$d" | 3 | test x"${f#*.}" = x"$d${d:+.}" |
diff --git a/testsuite/makedevs.tests b/testsuite/makedevs.tests index f69b4a6b1..f19af8a52 100755 --- a/testsuite/makedevs.tests +++ b/testsuite/makedevs.tests | |||
@@ -4,6 +4,10 @@ | |||
4 | 4 | ||
5 | . ./testing.sh | 5 | . ./testing.sh |
6 | 6 | ||
7 | unset LANG | ||
8 | unset LC_COLLATE | ||
9 | unset LC_ALL | ||
10 | |||
7 | # ls -ln is showing date. Need to remove that, it's variable | 11 | # ls -ln is showing date. Need to remove that, it's variable |
8 | # sed: (1) "maj, min" -> "maj,min" (2) coalesce spaces | 12 | # sed: (1) "maj, min" -> "maj,min" (2) coalesce spaces |
9 | # cut: remove date | 13 | # cut: remove date |
diff --git a/testsuite/tar.tests b/testsuite/tar.tests index f40079037..6604b4d22 100755 --- a/testsuite/tar.tests +++ b/testsuite/tar.tests | |||
@@ -4,6 +4,12 @@ | |||
4 | 4 | ||
5 | . ./testing.sh | 5 | . ./testing.sh |
6 | 6 | ||
7 | unset LANG | ||
8 | unset LANGUAGE | ||
9 | unset LC_COLLATE | ||
10 | unset LC_ALL | ||
11 | umask 022 | ||
12 | |||
7 | rm -rf tar.tempdir 2>/dev/null | 13 | rm -rf tar.tempdir 2>/dev/null |
8 | mkdir tar.tempdir && cd tar.tempdir || exit 1 | 14 | mkdir tar.tempdir && cd tar.tempdir || exit 1 |
9 | 15 | ||
diff --git a/testsuite/uuencode.tests b/testsuite/uuencode.tests index 6556e60d1..adb2d3390 100755 --- a/testsuite/uuencode.tests +++ b/testsuite/uuencode.tests | |||
@@ -13,11 +13,10 @@ | |||
13 | # test can create a file "actual" instead of writing to stdout | 13 | # test can create a file "actual" instead of writing to stdout |
14 | 14 | ||
15 | # Test setup of standard input | 15 | # Test setup of standard input |
16 | saved_umask=$(umask) | ||
17 | umask 0 | 16 | umask 0 |
18 | testing "uuencode sets standard input mode correctly" \ | 17 | testing "uuencode sets standard input mode correctly" \ |
19 | "uuencode foo </dev/null | head -n 1 | grep -q 666 && echo yes" "yes\n" "" "" | 18 | "uuencode foo </dev/null | head -n 1 | grep -q 666 && echo yes" "yes\n" "" "" |
20 | umask $saved_umask | 19 | umask 022 |
21 | 20 | ||
22 | testing "uuencode correct encoding" "uuencode bb_uuenc_test.out" \ | 21 | testing "uuencode correct encoding" "uuencode bb_uuenc_test.out" \ |
23 | "begin 644 bb_uuenc_test.out\nM5&AE(&9A<W0@9W)E>2!F;W@@:G5M<&5D(&]V97(@=&AE(&QA>GD@8G)O=VX@\n%9&]G+@H\`\n\`\nend\n" \ | 22 | "begin 644 bb_uuenc_test.out\nM5&AE(&9A<W0@9W)E>2!F;W@@:G5M<&5D(&]V97(@=&AE(&QA>GD@8G)O=VX@\n%9&]G+@H\`\n\`\nend\n" \ |