All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] btrfs-progs: mkfs-tests: Check sectorsize and nodesize combination
@ 2015-11-30  1:39 Qu Wenruo
  2015-11-30 10:00 ` David Sterba
  0 siblings, 1 reply; 3+ messages in thread
From: Qu Wenruo @ 2015-11-30  1:39 UTC (permalink / raw)
  To: linux-btrfs

Add mkfs selftest for invalid and valid sectorsize/nodesize
combination.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
---
 .../008-secorsize-nodesize-combination/test.sh     | 51 ++++++++++++++++++++++
 1 file changed, 51 insertions(+)
 create mode 100755 tests/mkfs-tests/008-secorsize-nodesize-combination/test.sh

diff --git a/tests/mkfs-tests/008-secorsize-nodesize-combination/test.sh b/tests/mkfs-tests/008-secorsize-nodesize-combination/test.sh
new file mode 100755
index 0000000..5bc3a48
--- /dev/null
+++ b/tests/mkfs-tests/008-secorsize-nodesize-combination/test.sh
@@ -0,0 +1,51 @@
+#!/bin/bash
+# test variant sectorsize and node size combination
+# including valid ones and invalid ones
+# only do mkfs and fsck check, no mounting check as
+# sub/multi-pagesize is not supported yet.
+
+source $TOP/tests/common
+
+check_prereq mkfs.btrfs
+check_prereq btrfs
+
+# disable mixed bg to avoid sectorsize == nodesize check
+features="^mixed-bg"
+image_size=1g
+image=image
+
+# caller need to judge whether the combination is valid
+do_test()
+{
+	sectorsize=$1
+	nodesize=$2
+	truncate -s $image_size $image
+	run_mayfail $TOP/mkfs.btrfs -O $features -n $nodesize -s $sectorsize \
+		$image
+	ret=$?
+	if [ $ret == 0 ]; then
+		run_check $TOP/btrfs check $image
+	fi
+	return $ret
+}
+
+# Invalid: Unaligned sectorsize and nodesize
+do_test 8191 8191 && _fail
+
+# Invalid: Aligned sectorsize with unaligned nodesize
+do_test 4k 16385 && _fail
+
+# Invalid: Ungliend sectorsize with aligned nodesize
+do_test 8191 16k && _fail
+
+# Valid: Aligned sectorsize and nodesize
+do_test 4k 16k || _fail
+
+# Invalid: Sectorsize larger than nodesize
+do_test 8k 4k && _fail
+
+# Invalid: too large nodesize
+do_test 16k 128k && _fail
+
+# Valid: large sectorsize
+do_test 64k 64k || _fail
-- 
2.6.2




^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] btrfs-progs: mkfs-tests: Check sectorsize and nodesize combination
  2015-11-30  1:39 [PATCH] btrfs-progs: mkfs-tests: Check sectorsize and nodesize combination Qu Wenruo
@ 2015-11-30 10:00 ` David Sterba
  2015-11-30 10:42   ` Qu Wenruo
  0 siblings, 1 reply; 3+ messages in thread
From: David Sterba @ 2015-11-30 10:00 UTC (permalink / raw)
  To: Qu Wenruo; +Cc: linux-btrfs

On Mon, Nov 30, 2015 at 09:39:30AM +0800, Qu Wenruo wrote:
> Add mkfs selftest for invalid and valid sectorsize/nodesize
> combination.
> 
> Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>

Applied with some changes, thanks.

> +image_size=1g
> +image=image

If you need a single image, just use prepare_test_dev and $TEST_DEV

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] btrfs-progs: mkfs-tests: Check sectorsize and nodesize combination
  2015-11-30 10:00 ` David Sterba
@ 2015-11-30 10:42   ` Qu Wenruo
  0 siblings, 0 replies; 3+ messages in thread
From: Qu Wenruo @ 2015-11-30 10:42 UTC (permalink / raw)
  To: dsterba, Qu Wenruo, linux-btrfs



On 11/30/2015 06:00 PM, David Sterba wrote:
> On Mon, Nov 30, 2015 at 09:39:30AM +0800, Qu Wenruo wrote:
>> Add mkfs selftest for invalid and valid sectorsize/nodesize
>> combination.
>>
>> Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
>
> Applied with some changes, thanks.
>
>> +image_size=1g
>> +image=image
>
> If you need a single image, just use prepare_test_dev and $TEST_DEV

Nice advice, just forgot that.

Thanks,
Qu

> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-11-30 10:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-30  1:39 [PATCH] btrfs-progs: mkfs-tests: Check sectorsize and nodesize combination Qu Wenruo
2015-11-30 10:00 ` David Sterba
2015-11-30 10:42   ` Qu Wenruo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.