summaryrefslogtreecommitdiff
path: root/tests/convert-tests.sh
diff options
context:
space:
mode:
authorAdam Buchbinder <abuchbinder@google.com>2014-06-12 09:08:33 -0700
committerDavid Sterba <dsterba@suse.cz>2014-08-22 14:43:09 +0200
commit4156fadc5399adfb4681f01908a1927760d12bdc (patch)
treebf565edb6ff90f736717bee22a8088ce727d05fc /tests/convert-tests.sh
parent978542ff59e731dcc45084a7341b2cd8b5437163 (diff)
btrfs-progs: Use sparse files for filesystem conversion tests
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> Signed-off-by: David Sterba <dsterba@suse.cz>
Diffstat (limited to 'tests/convert-tests.sh')
-rw-r--r--tests/convert-tests.sh18
1 files changed, 10 insertions, 8 deletions
diff --git a/tests/convert-tests.sh b/tests/convert-tests.sh
index 87369c5e..9f7a5c8b 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