aboutsummaryrefslogtreecommitdiff
path: root/bin/tar2sqfs/test/test_tar_sqfs.sh.in
blob: eb25fd99c55b0c154c0d7a96eea37cfa7ae306cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/sh

set -e

TARDIR="@abs_top_srcdir@/lib/tar/test/data"
TARDIR2="@abs_top_srcdir@/bin/tar2sqfs/test"
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;.*/test/;test_tar/;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"
imgname="./test_tar/root-becomes.sqfs"

"$TAR2SQFS" --root-becomes foo --defaults mtime=0 \
	    -c gzip -q "$imgname" < "$filename"

# verify
sha512sum -c "$SHA512FILE"

# cleanup
rm -rf "./test_tar"