summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorQu Wenruo <wqu@suse.com>2017-11-01 09:30:42 +0800
committerDavid Sterba <dsterba@suse.com>2018-01-03 17:10:05 +0100
commit2c2db167c79bee6c0ce88f55f964135908654f74 (patch)
treecd23359ed4085acf431e17d8a72a2f699ee86242 /tests
parent2bf30fb3b1e420e3f737eb9c2acc2fc96f7467dd (diff)
btrfs-progs: test/common: Enhance prepare_test_dev to reset device size
So prepare_test_dev() can be called several times in one test case, to test different device sizes. Signed-off-by: Qu Wenruo <wqu@suse.com> [ switch to [ ] ] Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/common6
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/common b/tests/common
index 3ce99090..734cd171 100644
--- a/tests/common
+++ b/tests/common
@@ -441,8 +441,12 @@ prepare_test_dev()
# num[K/M/G/T...]
local size="$1"
- [[ "$TEST_DEV" ]] && return
[[ "$size" ]] || size='2G'
+ # Still truncate it to new size
+ if [ -n "$TEST_DEV" ]; then
+ truncate -s "$size" "$TEST_DEV"
+ return;
+ fi
echo "\$TEST_DEV not given, use $TOP/test/test.img as fallback" >> \
"$RESULTS"