linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Gu Jinxiang <gujx@cn.fujitsu.com>
To: <linux-btrfs@vger.kernel.org>
Cc: <dsterba@suse.cz>, <quwenruo.btrfs@gmx.com>
Subject: [RFC PATCH v2 1/4] btrfs-progs: Add package command for packaging tests
Date: Fri, 2 Feb 2018 16:34:02 +0800	[thread overview]
Message-ID: <1517560445-5712-2-git-send-email-gujx@cn.fujitsu.com> (raw)
In-Reply-To: <1517560445-5712-1-git-send-email-gujx@cn.fujitsu.com>

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

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 @@
+#!/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
-- 
2.14.3




  reply	other threads:[~2018-02-02  8:34 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-02  8:34 [RFC PATCH v2 0/4] Add support for export testsuits Gu Jinxiang
2018-02-02  8:34 ` Gu Jinxiang [this message]
2018-02-02  8:34 ` [RFC PATCH v2 2/4] btrfs-progs: Add EXEC represent path of executable file Gu Jinxiang
2018-02-02 18:07   ` David Sterba
2018-02-03  9:07     ` Gu, Jinxiang
2018-02-05 17:17       ` David Sterba
2018-02-02  8:34 ` [RFC PATCH v2 3/4] btrfs-progs: Modify rootdir files when use mkfs.btrfs Gu Jinxiang
2018-02-02 18:11   ` David Sterba
2018-02-02  8:34 ` [RFC PATCH v2 4/4] btrfs-progs: Add readme for export testsuits Gu Jinxiang
2018-02-02 10:41 ` [RFC PATCH v2 0/4] Add support " Nikolay Borisov
2018-02-02 10:59   ` Qu Wenruo
2018-02-02 18:47 ` David Sterba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1517560445-5712-2-git-send-email-gujx@cn.fujitsu.com \
    --to=gujx@cn.fujitsu.com \
    --cc=dsterba@suse.cz \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=quwenruo.btrfs@gmx.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).