diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2022-11-27 10:32:13 +0100 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2022-11-27 10:32:13 +0100 |
commit | a487eec3e3e7c1c5552d17acd0db8cd5dcc59fc7 (patch) | |
tree | 783c4c23ec005545c1cc04925f17c980a4608d93 /tests/tar2sqfs/test_tar_sqfs.sh.in | |
parent | 62e598c500b53902e3d97b62d879e6e9c7785d00 (diff) |
Continue cleanup of the test cases
- Force all tests into their proper sub directory
- Temporarily remove the corpora tests. They have been used for
regression tests before releases and are disabled by default, so
we should not ship them either. A script should be added for that,
downloading what is needed.
- The "pack a directory" test is also removed. It was rather hacky
and there already is a test case for the fstree_from_dir function,
which isn't ideal either. Something should be added to the
regression test suite.
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'tests/tar2sqfs/test_tar_sqfs.sh.in')
-rwxr-xr-x | tests/tar2sqfs/test_tar_sqfs.sh.in | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/tar2sqfs/test_tar_sqfs.sh.in b/tests/tar2sqfs/test_tar_sqfs.sh.in new file mode 100755 index 0000000..750add4 --- /dev/null +++ b/tests/tar2sqfs/test_tar_sqfs.sh.in @@ -0,0 +1,44 @@ +#!/bin/sh + +set -e + +TARDIR="@abs_top_srcdir@/tests/libtar/data" +TARDIR2="@abs_top_srcdir@/tests/tar2sqfs" +SHA512FILE="$TARDIR2/sqfs.sha512" +TAR2SQFS="@abs_top_builddir@/tar2sqfs" + +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" + + mkdir -p "$dir" + "$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" + + rm "$imgname" + rmdir -p "$dir" || true +done |