All of lore.kernel.org
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo@cn.fujitsu.com>
To: dsterba@suse.com, linux-btrfs@vger.kernel.org
Subject: [PATCH v2 1/2] btrfs-progs: convert-tests: Add support for custom test scripts
Date: Fri,  3 Jun 2016 10:34:25 +0800	[thread overview]
Message-ID: <20160603023426.25216-1-quwenruo@cn.fujitsu.com> (raw)

Add support for custom convert test scripts, just like fsck tests.

Instead of generic convert tests, we need more specifically created images
for new convert tests.

This patch provide the needed infrastructure for later convert test
cases.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
---
v2:
  Split test case with infrastructure
---
 tests/common           |  8 ++++++++
 tests/convert-tests.sh | 31 +++++++++++++++++++++++++++++++
 2 files changed, 39 insertions(+)

diff --git a/tests/common b/tests/common
index 91682ef..fed9ede 100644
--- a/tests/common
+++ b/tests/common
@@ -94,6 +94,14 @@ check_prereq()
 	fi
 }
 
+check_global_prereq()
+{
+	which $1 &> /dev/null
+	if [ $? -ne 0 ]; then
+		_fail "Failed system wide prerequisities: $1";
+	fi
+}
+
 check_image()
 {
 	local image
diff --git a/tests/convert-tests.sh b/tests/convert-tests.sh
index 06d8419..a02311d 100755
--- a/tests/convert-tests.sh
+++ b/tests/convert-tests.sh
@@ -15,6 +15,11 @@ DATASET_SIZE=50
 
 source $TOP/tests/common
 
+# Allow child test to use $TOP and $RESULTS
+export TOP
+export RESULTS
+export LANG
+
 rm -f $RESULTS
 
 setup_root_helper
@@ -22,6 +27,25 @@ prepare_test_dev 512M
 
 CHECKSUMTMP=$(mktemp --tmpdir btrfs-progs-convert.XXXXXXXXXX)
 
+run_one_test() {
+	local testname
+
+	testname="$1"
+	echo "    [TEST/conv]   $testname"
+	cd $testname
+	echo "=== Entering $testname" >> $RESULTS
+	if [ -x test.sh ]; then
+		# Difference convert test case needs different tools to restore
+		# and check image, so only support custom test scripts
+		./test.sh
+		if [ $? -ne 0 ]; then
+			_fail "test failed for case $(basename $testname)"
+		fi
+	else
+		_fail "custom test script not found"
+	fi
+}
+
 generate_dataset() {
 
 	dataset_type="$1"
@@ -163,4 +187,11 @@ for feature in '' 'extref' 'skinny-metadata' 'no-holes'; do
 	convert_test "$feature" "ext4 64k nodesize" 65536 mke2fs -t ext4 -b 4096
 done
 
+# Test special images
+for i in $(find $TOP/tests/convert-tests -maxdepth 1 -mindepth 1 -type d \
+	   ${TEST:+-name "$TEST"} | sort)
+do
+	run_one_test "$i"
+done
+
 rm $CHECKSUMTMP
-- 
2.8.3




             reply	other threads:[~2016-06-03  2:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-03  2:34 Qu Wenruo [this message]
2016-06-03  2:34 ` [PATCH v2 2/2] btrfs-progs: convert-tests: Add test case for backup superblock migration Qu Wenruo
2016-06-06  9:05   ` David Sterba
2016-06-06  9:01 ` [PATCH v2 1/2] btrfs-progs: convert-tests: Add support for custom test scripts 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=20160603023426.25216-1-quwenruo@cn.fujitsu.com \
    --to=quwenruo@cn.fujitsu.com \
    --cc=dsterba@suse.com \
    --cc=linux-btrfs@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.