Improved portability of tests
authorDan Fandrich <dan@coneharvesters.com>
Wed, 11 Aug 2010 06:33:57 +0000 (23:33 -0700)
committerDenys Vlasenko <vda.linux@googlemail.com>
Wed, 11 Aug 2010 12:09:28 +0000 (14:09 +0200)
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>
testsuite/cpio.tests
testsuite/date/date-works-1
testsuite/du/du-k-works
testsuite/du/du-l-works
testsuite/hostname/hostname-d-works
testsuite/makedevs.tests
testsuite/tar.tests
testsuite/uuencode.tests

index 7aee774a1d7517d76c674faca302d42bc5a79ebf..44c17e6930128df9824469edd19b24ab5f16ec24 100755 (executable)
@@ -4,6 +4,8 @@
 
 . ./testing.sh
 
+umask 022
+
 # ls -ln shows date. Need to remove that, it's variable.
 # sed: coalesce spaces
 # cut: remove date
index e745d3841d4a84e8424151a305ccae9fc9b68e55..cb5cea2c533ccb88e04ec372b826981cc3d9ba74 100644 (file)
@@ -1,4 +1,7 @@
 unset LANG
+unset LANGUAGE
+unset LC_TIME
+unset LC_ALL
 
 dt=`busybox date -d 1:2 +%T`
 test x"$dt" = x"01:02:00"
index a52264945040321a889ed73be719373c7679e15b..229a948ee04580af62e32a0e71d593bd5c6fde25 100644 (file)
@@ -1,4 +1,6 @@
+mkdir du.testdir
+cd du.testdir
 dd if=/dev/zero of=file1 bs=1k count=64 2>/dev/null
 dd if=/dev/zero of=file2 bs=1k count=16 2>/dev/null
 test x"`busybox du -k .`" = x"80       ." \
-  -o x"`busybox du -k .`" = x"88       ." \
+  -o x"`busybox du -k .`" = x"88       ."
index 6b150e0dd73eb667935d2f2d7b2d9ead96b6dae4..426ee891b94f62d2f5668b90deb4c3f24462c687 100644 (file)
@@ -1,8 +1,11 @@
 # FEATURE: CONFIG_FEATURE_DU_DEFAULT_BLOCKSIZE_1K
 
+mkdir du.testdir
+cd du.testdir
 dd if=/dev/zero of=file1 bs=1k count=64 2>/dev/null
 ln file1 file1.1
 dd if=/dev/zero of=file2 bs=1k count=16 2>/dev/null
 test x"`busybox du -l .`" = x"144      ." \
   -o x"`busybox du -l .`" = x"148      ." \
   -o x"`busybox du -l .`" = x"152      ." \
+  -o x"`busybox du -l .`" = x"156      ."
index e062242bbfb148479aef3a6ce0568f9fc14b8971..54c0aac0c14db304715d953f93c934d6ec64cdb6 100644 (file)
@@ -1,3 +1,3 @@
-f=$(busybox hostname -f)
+f=$(busybox hostname -f).
 d=$(busybox hostname -d)
-test x"${f#*.}" = x"$d"
+test x"${f#*.}" = x"$d${d:+.}"
index f69b4a6b136d1e15700b1b98d1b243c0f1cce215..f19af8a52bb7def1e12cae2fc8567b13b619aead 100755 (executable)
@@ -4,6 +4,10 @@
 
 . ./testing.sh
 
+unset LANG
+unset LC_COLLATE
+unset LC_ALL
+
 # ls -ln is showing date. Need to remove that, it's variable
 # sed: (1) "maj, min" -> "maj,min" (2) coalesce spaces
 # cut: remove date
index f4007903776d67132387ceda583b5860c983f1c8..6604b4d22a7cbee90e2971ea5a631b275a5d61e5 100755 (executable)
@@ -4,6 +4,12 @@
 
 . ./testing.sh
 
+unset LANG
+unset LANGUAGE
+unset LC_COLLATE
+unset LC_ALL
+umask 022
+
 rm -rf tar.tempdir 2>/dev/null
 mkdir tar.tempdir && cd tar.tempdir || exit 1
 
index 6556e60d1def3abcb0e16bfb5c28909f181986fd..adb2d33904f977402dfc9d127e13f6c87bd1231e 100755 (executable)
 #   test can create a file "actual" instead of writing to stdout
 
 # Test setup of standard input
-saved_umask=$(umask)
 umask 0
 testing "uuencode sets standard input mode correctly" \
         "uuencode foo </dev/null | head -n 1 | grep -q 666 && echo yes" "yes\n" "" ""
-umask $saved_umask
+umask 022
 
 testing "uuencode correct encoding" "uuencode bb_uuenc_test.out" \
 "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" \