diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2020-10-31 17:27:50 +0100 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2020-10-31 17:27:50 +0100 |
commit | f4348c0153a743044167cf738792634bf060c63a (patch) | |
tree | eb29cd4a6ad3794052a0f8e15ff28dc6f68ae820 | |
parent | f49aa54434d0483a9aedd5de2b27ee35410821b6 (diff) |
Add a test case for tar2sqfs root becomes file & link filtering
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
-rw-r--r-- | tests/Makemodule.am | 1 | ||||
-rw-r--r-- | tests/tar/sqfs.sha512 | 1 | ||||
-rw-r--r-- | tests/tar2sqfs/simple.tar | bin | 0 -> 20480 bytes | |||
-rwxr-xr-x | tests/test_tar_sqfs.sh.in | 15 |
4 files changed, 17 insertions, 0 deletions
diff --git a/tests/Makemodule.am b/tests/Makemodule.am index 8d12d40..651f61c 100644 --- a/tests/Makemodule.am +++ b/tests/Makemodule.am @@ -276,6 +276,7 @@ endif endif EXTRA_DIST += $(top_srcdir)/tests/tar $(top_srcdir)/tests/words.txt +EXTRA_DIST += $(top_srcdir)/tests/tar2sqfs EXTRA_DIST += $(top_srcdir)/tests/fstree1.txt EXTRA_DIST += $(top_srcdir)/tests/corpus/cantrbry.tar.xz EXTRA_DIST += $(top_srcdir)/tests/corpus/cantrbry.sha512 diff --git a/tests/tar/sqfs.sha512 b/tests/tar/sqfs.sha512 index 79c0b94..0abbe82 100644 --- a/tests/tar/sqfs.sha512 +++ b/tests/tar/sqfs.sha512 @@ -25,3 +25,4 @@ f97561018def03e8af41c3b479925052469d4a15645886c500a60a5caa835a1ad152b4e72912df52 273eb1af519f01f116fd0017f6016d50474fe94e596bda8f3e2467e7dd5741fb45fb7df8830d9e62112a24ce8f8a40f8afa6783459ec04f4c0004ca40a050c49 tests/tar/xattr/xattr-schily.sqfs 273eb1af519f01f116fd0017f6016d50474fe94e596bda8f3e2467e7dd5741fb45fb7df8830d9e62112a24ce8f8a40f8afa6783459ec04f4c0004ca40a050c49 tests/tar/xattr/xattr-libarchive.sqfs dabba481b7e0d6888c1cb429eca304aac3c39146910ab0160179947de5ee3b68b5dcca2be3aff4536343357c6c48733f22b26cee1c2d4ff000c2edc276f2c235 tests/tar/xattr/acl.sqfs +a050ee2a296900bcb06d9616d06b1d947d9f26f0b57d6aff318c3dc656810c919f63a24144f890a4fae60268fda19becf9021182f1c0afd8acc0874e720f720e tests/tar2sqfs/root-becomes.sqfs diff --git a/tests/tar2sqfs/simple.tar b/tests/tar2sqfs/simple.tar Binary files differnew file mode 100644 index 0000000..ba1020b --- /dev/null +++ b/tests/tar2sqfs/simple.tar diff --git a/tests/test_tar_sqfs.sh.in b/tests/test_tar_sqfs.sh.in index 2c8e675..c23a217 100755 --- a/tests/test_tar_sqfs.sh.in +++ b/tests/test_tar_sqfs.sh.in @@ -3,6 +3,7 @@ set -e TARDIR="@abs_top_srcdir@/tests/tar" +TARDIR2="@abs_top_srcdir@/tests/tar2sqfs" SHA512FILE="@abs_top_srcdir@/tests/tar/sqfs.sha512" TAR2SQFS="@abs_top_builddir@/tar2sqfs" @@ -10,6 +11,7 @@ if [ ! -f "$TAR2SQFS" -a -f "${TAR2SQFS}.exe" ]; then TAR2SQFS="${TAR2SQFS}.exe" fi +# process tar files used for conformance tests for filename in $(find "$TARDIR" -name "*.tar" | grep -v ".*/file-size/.*"); do dir="$(dirname $filename | sed -n -e 's;.*/tests/;tests/;p')" imgname="$dir/$(basename $filename .tar).sqfs" @@ -18,8 +20,21 @@ for filename in $(find "$TARDIR" -name "*.tar" | grep -v ".*/file-size/.*"); do "$TAR2SQFS" --defaults mtime=0 -c gzip -q "$imgname" < "$filename" done +# edge case test +filename="$TARDIR2/simple.tar" +dir="$(dirname $filename | sed -n -e 's;.*/tests/;tests/;p')" +imgname="$dir/root-becomes.sqfs" + +mkdir -p "$dir" +"$TAR2SQFS" --root-becomes foo --defaults mtime=0 \ + -c gzip -q "$imgname" < "$filename" + +# verify sha512sum -c "$SHA512FILE" +# cleanup +rm "$dir/root-becomes.sqfs" + for filename in $(find "$TARDIR" -name "*.tar" | grep -v ".*/file-size/.*"); do dir="$(dirname $filename | sed -n -e 's;.*/tests/;tests/;p')" imgname="$dir/$(basename $filename .tar).sqfs" |