linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Adam Buchbinder <abuchbinder@google.com>
To: linux-btrfs@vger.kernel.org
Cc: dave@jikos.cz, Adam Buchbinder <abuchbinder@google.com>
Subject: [PATCH] Use sparse files for filesystem conversion tests.
Date: Thu, 12 Jun 2014 09:08:33 -0700	[thread overview]
Message-ID: <1402589313-15493-1-git-send-email-abuchbinder@google.com> (raw)

On my system, this brings the FS conversion test suite's runtime from over
ten seconds down to under two.

Thanks to Julien Muchembled for the suggestion.

Signed-off-by: Adam Buchbinder <abuchbinder@google.com>
---
 tests/convert-tests.sh | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/tests/convert-tests.sh b/tests/convert-tests.sh
index 87369c5..9f7a5c8 100644
--- a/tests/convert-tests.sh
+++ b/tests/convert-tests.sh
@@ -13,15 +13,16 @@ _fail()
 }
 
 rm -f convert-tests-results.txt
-rm -f test.img
 
 test(){
 	echo "     [TEST]    $1"
-        shift
-        echo "creating ext image with: $*" >> convert-tests-results.txt
+	shift
+	echo "creating ext image with: $*" >> convert-tests-results.txt
 	# 256MB is the smallest acceptable btrfs image.
-	dd if=/dev/zero of=$here/test.img bs=1024 count=$((256*1024)) \
-		>> convert-tests-results.txt 2>&1 || _fail "dd failed"
+	rm -f $here/test.img >> convert-tests-results.txt 2>&1 \
+		|| _fail "could not remove test image file"
+	truncate -s 256M $here/test.img >> convert-tests-results.txt 2>&1 \
+		|| _fail "could not create test image file"
 	$* -F $here/test.img >> convert-tests-results.txt 2>&1 \
 		|| _fail "filesystem create failed"
 	$here/btrfs-convert $here/test.img >> convert-tests-results.txt 2>&1 \
@@ -30,6 +31,7 @@ test(){
 		|| _fail "btrfsck detected errors"
 }
 
-test "ext2, 4k blocksize" mke2fs -b 4096
-test "ext3, 4k blocksize" mke2fs -j -b 4096
-test "ext4, 4k blocksize" mke2fs -t ext4 -b 4096
+# btrfs-convert requires 4k blocksize.
+test "ext2" mke2fs -b 4096
+test "ext3" mke2fs -j -b 4096
+test "ext4" mke2fs -t ext4 -b 4096
-- 
2.0.0.526.g5318336


                 reply	other threads:[~2014-06-12 16:08 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1402589313-15493-1-git-send-email-abuchbinder@google.com \
    --to=abuchbinder@google.com \
    --cc=dave@jikos.cz \
    --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 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).