From patchwork Wed Nov 1 01:30:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qu Wenruo X-Patchwork-Id: 10035811 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0EEF9603B5 for ; Wed, 1 Nov 2017 01:31:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F247528920 for ; Wed, 1 Nov 2017 01:31:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E60F128B2B; Wed, 1 Nov 2017 01:31:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7050828920 for ; Wed, 1 Nov 2017 01:31:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754064AbdKABbI (ORCPT ); Tue, 31 Oct 2017 21:31:08 -0400 Received: from prv3-mh.provo.novell.com ([137.65.250.26]:54260 "EHLO prv3-mh.provo.novell.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754005AbdKABbH (ORCPT ); Tue, 31 Oct 2017 21:31:07 -0400 Received: from adam-pc.lan (prv-ext-foundry1int.gns.novell.com [137.65.251.240]) by prv3-mh.provo.novell.com with ESMTP (NOT encrypted); Tue, 31 Oct 2017 19:30:52 -0600 From: Qu Wenruo To: linux-btrfs@vger.kernel.org Cc: dsterba@suse.cz Subject: [PATCH v4 4/4] btrfs-progs: test/mkfs: Test if the minimal device size is valid Date: Wed, 1 Nov 2017 09:30:43 +0800 Message-Id: <20171101013043.19294-5-wqu@suse.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20171101013043.19294-1-wqu@suse.com> References: <20171101013043.19294-1-wqu@suse.com> Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP New test case to test if the minimal device size given by "mkfs.btrfs" failure case is valid. Signed-off-by: Qu Wenruo --- tests/mkfs-tests/010-small-image/test.sh | 49 ++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100755 tests/mkfs-tests/010-small-image/test.sh diff --git a/tests/mkfs-tests/010-small-image/test.sh b/tests/mkfs-tests/010-small-image/test.sh new file mode 100755 index 000000000000..304c87057304 --- /dev/null +++ b/tests/mkfs-tests/010-small-image/test.sh @@ -0,0 +1,49 @@ +#!/bin/bash +# test if the reported minimal size of mkfs.btrfs is valid + +source "$TOP"/tests/common + +check_prereq mkfs.btrfs +check_prereq btrfs + +setup_root_helper + +do_test() +{ + # Well, 1M small enough to fail, we just use the output + # to get the minimal device size + prepare_test_dev 1M + output=$(run_mustfail_stdout "mkfs.btrfs for small image" \ + "$TOP"/mkfs.btrfs -f $@ "$TEST_DEV") + good_size=$(echo "$output" | grep -oP "(?<=is )\d+") + + prepare_test_dev "$good_size" + run_check "$TOP"/mkfs.btrfs -b $good_size -f $@ "$TEST_DEV" + run_check_mount_test_dev + run_check_umount_test_dev +} + +do_test -n 4k -m single -d single +do_test -n 4k -m single -d dup +do_test -n 4k -m dup -d single +do_test -n 4k -m dup -d dup + +do_test -n 8k -m single -d single +do_test -n 8k -m single -d dup +do_test -n 8k -m dup -d single +do_test -n 8k -m dup -d dup + +do_test -n 16k -m single -d single +do_test -n 16k -m single -d dup +do_test -n 16k -m dup -d single +do_test -n 16k -m dup -d dup + +do_test -n 32k -m single -d single +do_test -n 32k -m single -d dup +do_test -n 32k -m dup -d single +do_test -n 32k -m dup -d dup + +do_test -n 64k -m single -d single +do_test -n 64k -m single -d dup +do_test -n 64k -m dup -d single +do_test -n 64k -m dup -d dup