summaryrefslogtreecommitdiff
path: root/tests/cantrbry.sh.in
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-12-13 12:29:42 +0100
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-12-13 12:44:27 +0100
commitacdbae1723d1bc32d2e31d06ad76306af1749032 (patch)
tree700e5a0394e2d452447933949182a78ab3daeffc /tests/cantrbry.sh.in
parent2d2772341fa65e3d412e76c6e9d4a8815756c0ec (diff)
Add a simplistic integration and regression test
This test basically consists of the Canterbury Corpus which is turned into a SquashFS image using every supported compressor, with every supported block size, with and without tail end packing. The results MUST have an exact, given sha512sum. If that changes, it means either a regression in the output format, something broke or non-deterministic packing behaviour. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'tests/cantrbry.sh.in')
-rwxr-xr-xtests/cantrbry.sh.in46
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/cantrbry.sh.in b/tests/cantrbry.sh.in
new file mode 100755
index 0000000..c8ba917
--- /dev/null
+++ b/tests/cantrbry.sh.in
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+set -e
+
+CORPUS="@abs_top_srcdir@/tests/corpus/cantrbry.tar.xz"
+SHA512FILE="@abs_top_srcdir@/tests/corpus/cantrbry.sha512"
+TAR2SQFS="@abs_top_builddir@/tar2sqfs"
+
+COMPRESSORS=$(@abs_top_builddir@/tar2sqfs --help |\
+ sed -ne '/^Available compressors:$/{:a' -e 'n;p;ba' -e '}' |\
+ sed -n '/\t/p')
+
+for size in 4096 8192 16384 32768 65536 131072 262144 524288 1048576; do
+ for cmp in $COMPRESSORS; do
+ for threads in 1 2 3 4; do
+ name="cantrbry_${cmp}_${size}_${threads}.sqfs"
+
+ xzcat "$CORPUS" | \
+ "$TAR2SQFS" -q -c "$cmp" -b "$size" \
+ -j "$threads" "$name"
+
+ name="cantrbry_${cmp}_${size}_${threads}_T.sqfs"
+
+ xzcat "$CORPUS" | \
+ "$TAR2SQFS" -qT -c "$cmp" -b "$size" \
+ -j "$threads" "$name"
+ done
+
+ # check that the ones with > 1 thread are identical,
+ # then remove them.
+ for threads in 2 3 4; do
+ name="cantrbry_${cmp}_${size}_${threads}.sqfs"
+ ref="cantrbry_${cmp}_${size}_1.sqfs"
+ diff "$name" "$ref"
+ rm "$name"
+
+ name="cantrbry_${cmp}_${size}_${threads}_T.sqfs"
+ ref="cantrbry_${cmp}_${size}_1_T.sqfs"
+ diff "$name" "$ref"
+ rm "$name"
+ done
+ done
+done
+
+sha512sum --ignore-missing -c "$SHA512FILE"
+rm cantrbry_*.sqfs