summaryrefslogtreecommitdiff
path: root/tests/test_tar_sqfs.sh.in
blob: ea3b8847b76d7e39d94894e02f5940b56132b7a4 (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
#!/bin/sh

set -e

TARDIR="@abs_top_srcdir@/tests/tar"
SHA512FILE="@abs_top_srcdir@/tests/tar/sqfs.sha512"
TAR2SQFS="@abs_top_builddir@/tar2sqfs"

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

sha512sum -c "$SHA512FILE"

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