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.

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 <g...@cn.fujitsu.com>
 Makefile              |  4 ++++
 tests/export-tests.sh | 28 ++++++++++++++++++++++++++++
 2 files changed, 32 insertions(+)
 create mode 100755 tests/export-tests.sh

diff --git a/Makefile b/Makefile
index 6369e8f4..23decc4d 100644
--- a/Makefile
+++ b/Makefile
@@ -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
diff --git a/tests/export-tests.sh b/tests/export-tests.sh
new file mode 100755
index 00000000..d7f6ca17
--- /dev/null
+++ b/tests/export-tests.sh
@@ -0,0 +1,28 @@
+# export the testsuite files to a separate tar
+SCRIPT_DIR=$(dirname $(readlink -f "$0"))
+TESTDIR=$(basename $SCRIPT_DIR)
+test -n "$EXPORT" && DESTDIR=$(realpath "$EXPORT")
+if [ ! -d $DESTDIR ]; then
+       echo "dest directory is not exsit."
+       exit 1
+if [ -f $DEST ];then
+       echo "remove exsit package: " $DEST
+       rm $DEST
+echo "begin create tar:  " $DEST
+tar --exclude-vcs-ignores -zScf $DEST $TESTDIR $FSSUM $CORRUPT
+if [ $? -eq 0 ]; then
+       echo "create tar successfully."

To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to