linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Qu Wenruo <wqu@suse.com>
To: linux-btrfs@vger.kernel.org
Cc: dsterba@suse.cz
Subject: [PATCH v4 3/4] btrfs-progs: test/common: Enhance prepare_test_dev to reset device size
Date: Wed,  1 Nov 2017 09:30:42 +0800	[thread overview]
Message-ID: <20171101013043.19294-4-wqu@suse.com> (raw)
In-Reply-To: <20171101013043.19294-1-wqu@suse.com>

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>
---
 tests/common | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tests/common b/tests/common
index 977bade201a6..63750dbfeffe 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 [[ "$TEST_DEV" ]]; then
+		truncate -s "$size" "$TEST_DEV"
+		return;
+	fi
 
 	echo "\$TEST_DEV not given, use $TOP/test/test.img as fallback" >> \
 		"$RESULTS"
-- 
2.14.3


  parent reply	other threads:[~2017-11-01  1:30 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-01  1:30 [PATCH v4 0/4] mkfs: Fix minimal device check so that reported Qu Wenruo
2017-11-01  1:30 ` [PATCH v4 1/4] btrfs-progs: mkfs: Enhance minimal device size calculation to fix mkfs failure on small file Qu Wenruo
2017-11-27 23:21   ` David Sterba
2017-11-28  0:40     ` Qu Wenruo
2017-11-28 12:32       ` David Sterba
2017-11-01  1:30 ` [PATCH v4 2/4] btrfs-progs: test/common: Introduce run_mustfail_stdout Qu Wenruo
2017-11-27 23:28   ` David Sterba
2017-11-01  1:30 ` Qu Wenruo [this message]
2017-11-27 23:30   ` [PATCH v4 3/4] btrfs-progs: test/common: Enhance prepare_test_dev to reset device size David Sterba
2017-11-01  1:30 ` [PATCH v4 4/4] btrfs-progs: test/mkfs: Test if the minimal device size is valid Qu Wenruo
2017-11-28 14:34   ` David Sterba

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=20171101013043.19294-4-wqu@suse.com \
    --to=wqu@suse.com \
    --cc=dsterba@suse.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).