aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore2
-rw-r--r--configure.ac2
-rw-r--r--tests/Makemodule.am4
-rwxr-xr-xtests/pack_dir_root.sh.in23
-rw-r--r--tests/pack_dir_root.txt.ref9
5 files changed, 39 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore
index b1eb995..3501319 100644
--- a/.gitignore
+++ b/.gitignore
@@ -41,7 +41,7 @@ ltmain.sh
m4/libtool.m4
m4/lt*.m4
Doxyfile
-tests/cantrbry.sh
+tests/*.sh
/mknastyfs
/mk42sqfs
/list_files
diff --git a/configure.ac b/configure.ac
index 9ec1f6a..100539a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -7,6 +7,7 @@ AC_PROG_CC([cc gcc clang])
LT_INIT([win32-dll])
AC_PROG_CC_C99
AC_PROG_INSTALL
+AC_PROG_SED
AC_SYS_LARGEFILE
AC_CANONICAL_HOST
@@ -247,6 +248,7 @@ AC_CONFIG_FILES([lib/sqfs/libsquashfs0.pc])
AC_CONFIG_FILES([Doxyfile])
AC_CONFIG_FILES([tests/cantrbry.sh], [chmod +x tests/cantrbry.sh])
AC_CONFIG_FILES([tests/test_tar_sqfs.sh], [chmod +x tests/test_tar_sqfs.sh])
+AC_CONFIG_FILES([tests/pack_dir_root.sh], [chmod +x tests/pack_dir_root.sh])
AC_OUTPUT([Makefile])
diff --git a/tests/Makemodule.am b/tests/Makemodule.am
index f4aca03..14a2cb1 100644
--- a/tests/Makemodule.am
+++ b/tests/Makemodule.am
@@ -127,6 +127,9 @@ TESTS += test_tar_gnu test_tar_sparse_gnu test_tar_sparse_gnu1
TESTS += test_tar_sparse_gnu2 test_tar_xattr_bsd test_tar_xattr_schily
TESTS += test_tar_xattr_schily_bin
+check_SCRIPTS += tests/pack_dir_root.sh
+TESTS += tests/pack_dir_root.sh
+
if CORPORA_TESTS
check_SCRIPTS += tests/cantrbry.sh tests/test_tar_sqfs.sh
TESTS += tests/cantrbry.sh tests/test_tar_sqfs.sh
@@ -137,3 +140,4 @@ EXTRA_DIST += $(top_srcdir)/tests/tar $(top_srcdir)/tests/words.txt
EXTRA_DIST += $(top_srcdir)/tests/fstree1.txt
EXTRA_DIST += $(top_srcdir)/tests/corpus/cantrbry.tar.xz
EXTRA_DIST += $(top_srcdir)/tests/corpus/cantrbry.sha512
+EXTRA_DIST += $(top_srcdir)/tests/pack_dir_root.txt.ref
diff --git a/tests/pack_dir_root.sh.in b/tests/pack_dir_root.sh.in
new file mode 100755
index 0000000..ad0a085
--- /dev/null
+++ b/tests/pack_dir_root.sh.in
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+set -e
+
+LICDIR="@abs_top_srcdir@/licenses"
+REFFILE="@abs_top_srcdir@/tests/pack_dir_root.txt.ref"
+GENSQFS="@abs_top_builddir@/gensquashfs"
+RDSQFS="@abs_top_builddir@/rdsquashfs"
+IMAGE="pack_dir_root.sqfs"
+SED="@SED@"
+
+if [ ! -f "$GENSQFS" -a -f "${GENSQFS}.exe" ]; then
+ GENSQFS="${GENSQFS}.exe"
+ RDSQFS="${RDSQFS}.exe"
+fi
+
+"$GENSQFS" --all-root --pack-dir "$LICDIR" --defaults mtime=0 \
+ -c gzip -q "$IMAGE"
+
+"$RDSQFS" -l / "$IMAGE" | "$SED" 's/^-[rwx-]* //g' > "${IMAGE}.txt"
+
+diff "$REFFILE" "${IMAGE}.txt"
+rm "$IMAGE" "${IMAGE}.txt"
diff --git a/tests/pack_dir_root.txt.ref b/tests/pack_dir_root.txt.ref
new file mode 100644
index 0000000..7addf59
--- /dev/null
+++ b/tests/pack_dir_root.txt.ref
@@ -0,0 +1,9 @@
+0/0 18k GPLv2.txt
+0/0 34k GPLv3.txt
+0/0 7k LGPLv3.txt
+0/0 1k LZ4.txt
+0/0 1k hash_table.txt
+0/0 1k xxhash.txt
+0/0 768 xz.txt
+0/0 983 zlib.txt
+0/0 1k zstd.txt