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>
This commit is contained in:
parent
2bf30fb3b1
commit
2c2db167c7
|
@ -441,8 +441,12 @@ prepare_test_dev()
|
||||||
# num[K/M/G/T...]
|
# num[K/M/G/T...]
|
||||||
local size="$1"
|
local size="$1"
|
||||||
|
|
||||||
[[ "$TEST_DEV" ]] && return
|
|
||||||
[[ "$size" ]] || size='2G'
|
[[ "$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" >> \
|
echo "\$TEST_DEV not given, use $TOP/test/test.img as fallback" >> \
|
||||||
"$RESULTS"
|
"$RESULTS"
|
||||||
|
|
Loading…
Reference in New Issue