aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2021-08-16 00:48:50 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2021-08-16 00:48:50 +0200
commit8d718686f7dc5ce765544dcb8c7d2d5bc40b9d01 (patch)
treeb5476d234a2fd8325d608a34a81067a923ad2bb3
parent1ce60699c15e5fc2ecff5db40ea1e1ae583b8b34 (diff)
downloadbusybox-w32-8d718686f7dc5ce765544dcb8c7d2d5bc40b9d01.tar.gz
busybox-w32-8d718686f7dc5ce765544dcb8c7d2d5bc40b9d01.tar.bz2
busybox-w32-8d718686f7dc5ce765544dcb8c7d2d5bc40b9d01.zip
tar: fix testsuite
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rwxr-xr-xtestsuite/tar.tests17
1 files changed, 10 insertions, 7 deletions
diff --git a/testsuite/tar.tests b/testsuite/tar.tests
index d71a34910..0f2e89112 100755
--- a/testsuite/tar.tests
+++ b/testsuite/tar.tests
@@ -3,6 +3,7 @@
3# Licensed under GPLv2, see file LICENSE in this source tree. 3# Licensed under GPLv2, see file LICENSE in this source tree.
4 4
5. ./testing.sh 5. ./testing.sh
6test -f "$bindir/.config" && . "$bindir/.config"
6 7
7unset LANG 8unset LANG
8unset LANGUAGE 9unset LANGUAGE
@@ -12,7 +13,7 @@ umask 022
12 13
13# testing "test name" "script" "expected result" "file input" "stdin" 14# testing "test name" "script" "expected result" "file input" "stdin"
14 15
15testing "Empty file is not a tarball" '\ 16testing "tar Empty file is not a tarball" '\
16tar xvf - 2>&1; echo $? 17tar xvf - 2>&1; echo $?
17' "\ 18' "\
18tar: short read 19tar: short read
@@ -25,7 +26,7 @@ optional FEATURE_SEAMLESS_GZ GUNZIP
25# In NOMMU case, "invalid magic" message comes from gunzip child process. 26# In NOMMU case, "invalid magic" message comes from gunzip child process.
26# Otherwise, it comes from tar. 27# Otherwise, it comes from tar.
27# Need to fix output up to avoid false positive. 28# Need to fix output up to avoid false positive.
28testing "Empty file is not a tarball.tar.gz" '\ 29testing "tar Empty file is not a tarball.tar.gz" '\
29{ tar xvzf - 2>&1; echo $?; } | grep -Fv "invalid magic" 30{ tar xvzf - 2>&1; echo $?; } | grep -Fv "invalid magic"
30' "\ 31' "\
31tar: short read 32tar: short read
@@ -34,7 +35,7 @@ tar: short read
34"" "" 35"" ""
35SKIP= 36SKIP=
36 37
37testing "Two zeroed blocks is a ('truncated') empty tarball" '\ 38testing "tar Two zeroed blocks is a ('truncated') empty tarball" '\
38dd if=/dev/zero bs=512 count=2 2>/dev/null | tar xvf - 2>&1; echo $? 39dd if=/dev/zero bs=512 count=2 2>/dev/null | tar xvf - 2>&1; echo $?
39' "\ 40' "\
400 410
@@ -42,7 +43,7 @@ dd if=/dev/zero bs=512 count=2 2>/dev/null | tar xvf - 2>&1; echo $?
42"" "" 43"" ""
43SKIP= 44SKIP=
44 45
45testing "Twenty zeroed blocks is an empty tarball" '\ 46testing "tar Twenty zeroed blocks is an empty tarball" '\
46dd if=/dev/zero bs=512 count=20 2>/dev/null | tar xvf - 2>&1; echo $? 47dd if=/dev/zero bs=512 count=20 2>/dev/null | tar xvf - 2>&1; echo $?
47' "\ 48' "\
480 490
@@ -313,9 +314,10 @@ l4/V8LDoe90yiWJhOJvIypgEfxdyRThQkBVn/bI=
313SKIP= 314SKIP=
314cd .. || exit 1; rm -rf tar.tempdir 2>/dev/null 315cd .. || exit 1; rm -rf tar.tempdir 2>/dev/null
315 316
317if test x"$CONFIG_UNICODE_USING_LOCALE" != x"y"; then
316mkdir tar.tempdir && cd tar.tempdir || exit 1 318mkdir tar.tempdir && cd tar.tempdir || exit 1
317optional UNICODE_SUPPORT FEATURE_TAR_GNU_EXTENSIONS FEATURE_SEAMLESS_BZ2 FEATURE_TAR_AUTODETECT 319optional UNICODE_SUPPORT FEATURE_TAR_GNU_EXTENSIONS FEATURE_SEAMLESS_BZ2 FEATURE_TAR_AUTODETECT
318testing "Pax-encoded UTF8 names and symlinks" '\ 320testing "tar Pax-encoded UTF8 names and symlinks" '\
319tar xvf ../tar.utf8.tar.bz2 2>&1; echo $? 321tar xvf ../tar.utf8.tar.bz2 2>&1; echo $?
320export LANG=en_US.UTF-8 322export LANG=en_US.UTF-8
321ls -l etc/ssl/certs/* | sed "s:.*etc/:etc/:" | sort 323ls -l etc/ssl/certs/* | sed "s:.*etc/:etc/:" | sort
@@ -334,10 +336,11 @@ etc/ssl/certs/f80cc7f6.0 -> EBG_Elektronik_Sertifika_Hizmet_Sağlayıcısı.pem
334"" "" 336"" ""
335SKIP= 337SKIP=
336cd .. || exit 1; rm -rf tar.tempdir 2>/dev/null 338cd .. || exit 1; rm -rf tar.tempdir 2>/dev/null
339fi
337 340
338mkdir tar.tempdir && cd tar.tempdir || exit 1 341mkdir tar.tempdir && cd tar.tempdir || exit 1
339optional FEATURE_SEAMLESS_BZ2 FEATURE_TAR_AUTODETECT LS 342optional FEATURE_SEAMLESS_BZ2 FEATURE_TAR_AUTODETECT LS
340testing "Symlink attack: create symlink and then write through it" '\ 343testing "tar Symlink attack: create symlink and then write through it" '\
341exec 2>&1 344exec 2>&1
342uudecode -o input && tar xvf input; echo $? 345uudecode -o input && tar xvf input; echo $?
343ls /tmp/bb_test_evilfile 346ls /tmp/bb_test_evilfile
@@ -367,7 +370,7 @@ cd .. || exit 1; rm -rf tar.tempdir 2>/dev/null
367 370
368mkdir tar.tempdir && cd tar.tempdir || exit 1 371mkdir tar.tempdir && cd tar.tempdir || exit 1
369optional FEATURE_TAR_CREATE 372optional FEATURE_TAR_CREATE
370testing "Symlinks and hardlinks coexist" '\ 373testing "tar Symlinks and hardlinks coexist" '\
371mkdir dir 374mkdir dir
372>dir/a 375>dir/a
373ln -s ../dir/a dir/b 376ln -s ../dir/a dir/b