aboutsummaryrefslogtreecommitdiff
path: root/tests/test_tar_sqfs.sh.in
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-10-31 17:27:50 +0100
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2020-10-31 18:34:37 +0100
commit3e98d13d625f3a13fb183ee44627ab9e65dca378 (patch)
tree319f78c4b5071ca49dbcad351986cd9d9e6f710a /tests/test_tar_sqfs.sh.in
parent5ca4295edfde4c1603d9e3e31546c8f6228e7b8f (diff)
Add a test case for tar2sqfs root becomes file & link filtering
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'tests/test_tar_sqfs.sh.in')
-rwxr-xr-xtests/test_tar_sqfs.sh.in15
1 files changed, 15 insertions, 0 deletions
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"