@@ -333,6 +333,10 @@ test-inst: all
test: test-fsck test-mkfs test-convert test-misc test-fuzz test-cli
+package: btrfs-corrupt-block fssum
+ @echo "Export tests as a package"
+ $(Q)bash tests/export-tests.sh
+
#
# NOTE: For static compiles, you need to have all the required libs
# static equivalent available
new file mode 100755
@@ -0,0 +1,28 @@
+#!/bin/bash
+# export the testsuite files to a separate tar
+
+SCRIPT_DIR=$(dirname $(readlink -f "$0"))
+TESTDIR=$(basename $SCRIPT_DIR)
+FSSUM=fssum
+CORRUPT=btrfs-corrupt-block
+DESTNAME="tests.tar.gz"
+DESTDIR="."
+
+test -n "$EXPORT" && DESTDIR=$(realpath "$EXPORT")
+if [ ! -d $DESTDIR ]; then
+ echo "dest directory is not exsit."
+ exit 1
+fi
+
+DEST=$DESTDIR/$DESTNAME
+
+if [ -f $DEST ];then
+ echo "remove exsit package: " $DEST
+ rm $DEST
+fi
+
+echo "begin create tar: " $DEST
+tar --exclude-vcs-ignores -zScf $DEST $TESTDIR $FSSUM $CORRUPT
+if [ $? -eq 0 ]; then
+ echo "create tar successfully."
+fi
Export the testsuite files to a separate tar. Since fsck tests depend on btrfs-corrupt-block, and misc tests depends on both btrfs-corrupt-block and fssum, so set it as prerequisites for package commad. Because, althougth fssum can be generated by source that are all in tests directory, and has no rely on the btrfs's structure. But btrfs-corrupt-block deeply relys on btrfs's structure. For consistency, at the present stage, generete the two when create test tar. Signed-off-by: Gu Jinxiang <gujx@cn.fujitsu.com> --- Makefile | 4 ++++ tests/export-tests.sh | 28 ++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100755 tests/export-tests.sh