diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2022-08-20 14:38:49 +0200 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2022-08-20 14:45:16 +0200 |
commit | 26e3ec10db15409256bf773ad93c944156697e9e (patch) | |
tree | f8bc4aa1c8c7dd0bdf9405da2530d4c487dc88bd /tests | |
parent | 62753ec36958c40f151fa223605aea5e6a50bd89 (diff) |
Overhaul tar compression test script, add to corpora test set
- Make the script faster by unpacking everything at once instead
of file-by-file
- Also compare symlinks and directories
- More verbose output
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Makemodule.am | 6 | ||||
-rw-r--r-- | tests/tarcompress.sh.in | 39 |
2 files changed, 35 insertions, 10 deletions
diff --git a/tests/Makemodule.am b/tests/Makemodule.am index 0ae3f8b..39db3ba 100644 --- a/tests/Makemodule.am +++ b/tests/Makemodule.am @@ -6,8 +6,10 @@ include tests/libsqfs/Makemodule.am if BUILD_TOOLS if CORPORA_TESTS -check_SCRIPTS += tests/cantrbry.sh tests/test_tar_sqfs.sh tests/pack_dir_root.sh -TESTS += tests/cantrbry.sh tests/test_tar_sqfs.sh tests/pack_dir_root.sh +check_SCRIPTS += tests/cantrbry.sh tests/test_tar_sqfs.sh \ + tests/pack_dir_root.sh tests/tarcompress.sh +TESTS += tests/cantrbry.sh tests/test_tar_sqfs.sh \ + tests/pack_dir_root.sh tests/tarcompress.sh endif endif diff --git a/tests/tarcompress.sh.in b/tests/tarcompress.sh.in index 99075a2..726f4e8 100644 --- a/tests/tarcompress.sh.in +++ b/tests/tarcompress.sh.in @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -e @@ -31,18 +31,41 @@ rm "$DIR/out2.sqfs" "$DIR/out3.sqfs" rm "$DIR/linux-3.11.tar.bz2" rm "$DIR/linux-3.11.tar.gz" -# every file that exists in the tar ball MUST exist in the squashfs image -# and they MUST be identical +# unpack tarball and squashfs image tar -C "$DIR" -xf "$DIR/linux-3.11.tar.xz" +rm "$DIR/linux-3.11.tar.xz" + +"$RDSQFS" -DSF -u / -p "$DIR/sqfs/" "$DIR/out1.sqfs" +rm "$DIR/out1.sqfs" +# every file that exists in the tar ball MUST exist in the squashfs image +# and they MUST be identical find "$DIR/linux-3.11" -type f | sed "s#$DIR/##" | \ while read fname; do - "$RDSQFS" -c "$fname" "$DIR/out1.sqfs" > "$DIR/temp" + set -e + diff "$DIR/$fname" "$DIR/sqfs/$fname" + rm "$DIR/sqfs/$fname" "$DIR/$fname" + echo "match $DIR/$fname" +done - diff "$DIR/$fname" "$DIR/temp" +find "$DIR/linux-3.11" -type l | sed "s#$DIR/##" | \ +while read fname; do + set -e + a=$(readlink "$DIR/$fname") + b=$(readlink "$DIR/sqfs/$fname") + [ "x$a" = "x$b" ] || exit 1 + unlink "$DIR/sqfs/$fname" + unlink "$DIR/$fname" + echo "match $DIR/$fname" +done + +# match directories and cleanup at the same time +find "$DIR/linux-3.11" -type d | sed "s#$DIR/##" | sort -ur | \ +while read fname; do + set -e + rmdir "$DIR/$fname" "$DIR/sqfs/$fname" done -# cleanup -rm "$DIR/temp" "$DIR/out1.sqfs" "$DIR/linux-3.11.tar.xz" -rm --one-file-system -rf "$DIR/linux-3.11" +rmdir "$DIR/sqfs" rmdir "$DIR" +echo "DONE!" |