Fix some test cases
[oweals/busybox.git] / testsuite / tar.tests
index a96382932952ed2d8d9286a8546f00dfaa63f007..8b2523ff14691f786af44e8125377056cdfcf19c 100755 (executable)
@@ -1,14 +1,21 @@
 #!/bin/sh
 # Copyright 2009 by Denys Vlasenko
-# Licensed under GPL v2, see file LICENSE for details.
+# Licensed under GPLv2, see file LICENSE in this source tree.
 
 . ./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
 
 # testing "test name" "script" "expected result" "file input" "stdin"
 
+optional FEATURE_TAR_CREATE FEATURE_LS_SORTFILES
 testing "tar hardlinks and repeated files" '\
 rm -rf input_* test.tar 2>/dev/null
 >input_hard1
@@ -39,18 +46,22 @@ drwxr-xr-x input_dir
 -rw-r--r-- input_hard2
 " \
 "" ""
+SKIP=
 
+optional FEATURE_TAR_CREATE FEATURE_LS_SORTFILES
 testing "tar hardlinks mode" '\
 rm -rf input_* test.tar 2>/dev/null
 >input_hard1
 chmod 741 input_hard1
 ln input_hard1 input_hard2
 mkdir input_dir
-chmod 550 input_dir
 ln input_hard1 input_dir
 ln input_hard2 input_dir
+chmod 550 input_dir
 tar cf test.tar input_*
 tar tvf test.tar | sed "s/.*[0-9] input/input/"
+chmod 770 input_dir
+rm -rf input_*
 tar xf test.tar 2>&1
 echo Ok: $?
 ls -l . input_dir/* | grep input_ | sed "s/\\(^[^ ]*\\) .* input/\\1 input/"
@@ -68,18 +79,22 @@ dr-xr-x--- input_dir
 -rwxr----x input_hard2
 " \
 "" ""
+SKIP=
 
+optional FEATURE_TAR_CREATE FEATURE_LS_SORTFILES
 testing "tar symlinks mode" '\
 rm -rf input_* test.tar 2>/dev/null
 >input_file
 chmod 741 input_file
 ln -s input_file input_soft
 mkdir input_dir
-chmod 550 input_dir
 ln input_file input_dir
 ln input_soft input_dir
+chmod 550 input_dir
 tar cf test.tar input_*
-tar tvf test.tar | sed "s/.*[0-9] input/input/"
+tar tvf test.tar | sed "s/.*[0-9] input/input/" | sort
+chmod 770 input_dir
+rm -rf input_*
 tar xf test.tar 2>&1
 echo Ok: $?
 ls -l . input_dir/* | grep input_ | sed "s/\\(^[^ ]*\\) .* input/\\1 input/"
@@ -97,8 +112,9 @@ dr-xr-x--- input_dir
 lrwxrwxrwx input_file
 " \
 "" ""
+SKIP=
 
-optional FEATURE_TAR_LONG_OPTIONS
+optional FEATURE_TAR_CREATE FEATURE_TAR_LONG_OPTIONS
 testing "tar --overwrite" "\
 rm -rf input_* test.tar 2>/dev/null
 ln input input_hard