From patchwork Fri Oct 27 00:53:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qu Wenruo X-Patchwork-Id: 10028931 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 BD7966022E for ; Fri, 27 Oct 2017 00:53:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AE95C28EEE for ; Fri, 27 Oct 2017 00:53:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A387E28EF0; Fri, 27 Oct 2017 00:53:35 +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 2832F28EEE for ; Fri, 27 Oct 2017 00:53:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751712AbdJ0Axd (ORCPT ); Thu, 26 Oct 2017 20:53:33 -0400 Received: from prv3-mh.provo.novell.com ([137.65.250.26]:48662 "EHLO prv3-mh.provo.novell.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751646AbdJ0Axc (ORCPT ); Thu, 26 Oct 2017 20:53:32 -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); Thu, 26 Oct 2017 18:53:28 -0600 From: Qu Wenruo To: linux-btrfs@vger.kernel.org Cc: dsterba@suse.cz Subject: [PATCH v3 2/2] btrfs-progs: test/mkfs: Test if the minimal device size is valid Date: Fri, 27 Oct 2017 08:53:24 +0800 Message-Id: <20171027005324.17950-2-wqu@suse.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20171027005324.17950-1-wqu@suse.com> References: <20171027005324.17950-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..f55760df061f --- /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 -f $@ "$TEST_DEV" + run_check $SUDO_HELPER mount "$TEST_DEV" "$TEST_MNT" + run_check $SUDO_HELPER umount "$TEST_MNT" +} + +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