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 9/9] btrfs-progs: tests/mkfs: Introduce test case to verify if mkfs.btrfs rootdir shrink behaves correctly
Date: Wed, 29 Nov 2017 17:16:04 +0800	[thread overview]
Message-ID: <20171129091604.2194-10-wqu@suse.com> (raw)
In-Reply-To: <20171129091604.2194-1-wqu@suse.com>

Signed-off-by: Qu Wenruo <wqu@suse.com>
---
 tests/mkfs-tests/012-rootdir-no-shrink/test.sh | 38 ++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)
 create mode 100755 tests/mkfs-tests/012-rootdir-no-shrink/test.sh

diff --git a/tests/mkfs-tests/012-rootdir-no-shrink/test.sh b/tests/mkfs-tests/012-rootdir-no-shrink/test.sh
new file mode 100755
index 000000000000..1dfa55b376f6
--- /dev/null
+++ b/tests/mkfs-tests/012-rootdir-no-shrink/test.sh
@@ -0,0 +1,38 @@
+#!/bin/bash
+# Test if mkfs.btrfs --rootdir will skip shrinking correctly
+
+source "$TOP/tests/common"
+
+check_prereq mkfs.btrfs
+
+setup_root_helper
+
+fs_size=$((512 * 1024 * 1024))
+bs=$((1024 * 1024))
+tmp=$(mktemp -d --tmpdir btrfs-progs-mkfs.rootdirXXXXXXX)
+
+prepare_test_dev $fs_size
+
+### no shrink case ###
+
+run_check "$TOP/mkfs.btrfs" -f -r $tmp "$TEST_DEV"
+run_check_mount_test_dev
+
+# We should be able to write at least half of the fs size data since
+# the fs is not shrunk
+run_check $SUDO_HELPER dd if=/dev/zero bs=$bs count=$(($fs_size / $bs / 2)) \
+	of="$TEST_MNT/file"
+
+run_check_umount_test_dev
+
+### shrink case ###
+run_check "$TOP/mkfs.btrfs" -f -r $tmp --shrink "$TEST_DEV"
+run_check_mount_test_dev
+
+run_mustfail "mkfs.btrfs for shrink rootdir" \
+	$SUDO_HELPER dd if=/dev/zero bs=$bs count=$(($fs_size / $bs / 2)) \
+	of="$TEST_MNT/file"
+
+run_check_umount_test_dev
+
+rm -rf -- "$tmp"
-- 
2.15.0


  parent reply	other threads:[~2017-11-29  9:16 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-29  9:15 [PATCH 0/9] Remaining part of mkfs --rootdir rework Qu Wenruo
2017-11-29  9:15 ` [PATCH 1/9] btrfs-progs: mkfs: Cleanup temporary chunks before filling rootdir Qu Wenruo
2017-11-29  9:15 ` [PATCH 2/9] btrfs-progs: mkfs: Don't use custom chunk allocator for rootdir Qu Wenruo
2017-11-29  9:15 ` [PATCH 3/9] btrfs-progs: mkfs/rootdir: Use over-reserve method to make size estimate easier Qu Wenruo
2017-11-29  9:15 ` [PATCH 4/9] btrfs-progs: mkfs/rootdir: Shrink fs for rootdir option Qu Wenruo
2017-11-29  9:16 ` [PATCH 5/9] btrfs-progs: mkfs: Separate shrink from rootdir Qu Wenruo
2017-11-29  9:16 ` [PATCH 6/9] btrfs-progs: mkfs: Fix regression preventing --rootdir to create file Qu Wenruo
2017-11-30  5:16   ` Misono, Tomohiro
2017-11-29  9:16 ` [PATCH 7/9] btrfs-progs: tests/mkfs: Introduce test case to check if mkfs rootdir can create new file Qu Wenruo
2017-11-29  9:16 ` [PATCH 8/9] btrfs-progs: mkfs: Use the whole file or block device to mkfs for rootdir Qu Wenruo
2017-11-29  9:16 ` Qu Wenruo [this message]
2017-12-07 19:06 ` [PATCH 0/9] Remaining part of mkfs --rootdir rework 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=20171129091604.2194-10-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).