diff options
author | David Sterba <dsterba@suse.com> | 2018-01-23 17:22:30 +0100 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2018-01-31 15:14:02 +0100 |
commit | 81dd246d953585c08984aa4b059d8c1ee1c8e715 (patch) | |
tree | 3d7f7a0333af175c65abf756d1780ec54f34a1ba /tests/common | |
parent | 07eafd93b27051f75a51cff634f8ed23858f6fa7 (diff) |
btrfs-progs: tests: truncate test image to 0 first
We use the prepare_test_dev helper to make sure the image has at least
this size. The "at least" part is not desired by some tests as the
device might be larger than the test expects.
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'tests/common')
-rw-r--r-- | tests/common | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/tests/common b/tests/common index a2e2f50d..2fac202a 100644 --- a/tests/common +++ b/tests/common @@ -444,6 +444,7 @@ prepare_test_dev() [[ "$size" ]] || size='2G' # Still truncate it to new size if [ -n "$TEST_DEV" ]; then + truncate -s 0 "$TEST_DEV" truncate -s "$size" "$TEST_DEV" return; fi @@ -452,6 +453,7 @@ prepare_test_dev() "$RESULTS" TEST_DEV="$TOP/tests/test.img" + truncate -s 0 "$TEST_DEV" truncate -s "$size" "$TEST_DEV" || _not_run "create file for loop device failed" } |