From patchwork Tue Sep 18 08:44:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Su Yanjun X-Patchwork-Id: 10603857 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1303315A6 for ; Tue, 18 Sep 2018 08:45:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EC3012A640 for ; Tue, 18 Sep 2018 08:45:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E02332A67D; Tue, 18 Sep 2018 08:45:26 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, 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 57A912A640 for ; Tue, 18 Sep 2018 08:45:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729455AbeIRORA (ORCPT ); Tue, 18 Sep 2018 10:17:00 -0400 Received: from mail.cn.fujitsu.com ([183.91.158.132]:64618 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729192AbeIRORA (ORCPT ); Tue, 18 Sep 2018 10:17:00 -0400 X-IronPort-AV: E=Sophos;i="5.43,368,1503331200"; d="scan'208";a="45052356" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 18 Sep 2018 16:45:14 +0800 Received: from G08CNEXCHPEKD01.g08.fujitsu.local (unknown [10.167.33.80]) by cn.fujitsu.com (Postfix) with ESMTP id 2058B4B6EC8D for ; Tue, 18 Sep 2018 16:45:11 +0800 (CST) Received: from localhost.localdomain (10.167.226.155) by G08CNEXCHPEKD01.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server id 14.3.408.0; Tue, 18 Sep 2018 16:45:16 +0800 From: Su Yanjun To: CC: Su Yanjun Subject: [PATCH] btrfs-progs: tests: Add the testcase for subvolume name length limit test Date: Tue, 18 Sep 2018 16:44:48 +0800 Message-ID: <20180918084448.14195-1-suyj.fnst@cn.fujitsu.com> X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 X-yoursite-MailScanner-ID: 2058B4B6EC8D.AAA1E X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: suyj.fnst@cn.fujitsu.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 Total of three conditions are tested. One for short name, one with name length 255, the last one with more than 255. This case should pass after commit 'btrfs-progs: change filename limit to 255 when creating subvolume'. Signed-off-by: Su Yanjun --- .../033-filename-length-limit/test.sh | 86 +++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100755 tests/misc-tests/033-filename-length-limit/test.sh diff --git a/tests/misc-tests/033-filename-length-limit/test.sh b/tests/misc-tests/033-filename-length-limit/test.sh new file mode 100755 index 000000000000..7764ad9b584c --- /dev/null +++ b/tests/misc-tests/033-filename-length-limit/test.sh @@ -0,0 +1,86 @@ +#!/bin/bash +# +# test file name length limit settings + +source "$TEST_TOP/common" + +check_prereq mkfs.btrfs +check_prereq btrfs + +setup_root_helper + +prepare_test_dev +run_check "$TOP/mkfs.btrfs" -f "$TEST_DEV" +run_check_mount_test_dev +run_check $SUDO_HELPER chmod a+rw "$TEST_MNT" + +cd "$TEST_MNT" + +longname=\ +0123456789\ +0123456789\ +0123456789\ +0123456789\ +0123456789\ +\ +0123456789\ +0123456789\ +0123456789\ +0123456789\ +0123456789\ +\ +0123456789\ +0123456789\ +0123456789\ +0123456789\ +0123456789\ +\ +0123456789\ +0123456789\ +0123456789\ +0123456789\ +0123456789\ +\ +0123456789\ +0123456789\ +0123456789\ +0123456789\ +0123456789\ +\ +01234 + +# +# subvolume name length limit test +# + +# short name test +run_check $SUDO_HELPER "$TOP/btrfs" subvolume create aaa +# 255 +run_check $SUDO_HELPER "$TOP/btrfs" subvolume create "$longname" +# 256, must fail +run_mustfail "name 256 bytes long succeeded" \ + $SUDO_HELPER "$TOP/btrfs" subvolume create "$longname"5 +# 255*2, must fail +run_mustfail "name 2 * 255 bytes long succeeded" \ + $SUDO_HELPER "$TOP/btrfs" subvolume create "$longname$longname" + +# +# snapshot name length limit test +# + +run_check $SUDO_HELPER mkdir snaps + +# short name test +run_check $SUDO_HELPER "$TOP/btrfs" subvolume snapshot aaa snaps/bbb +# 255 +run_check $SUDO_HELPER "$TOP/btrfs" subvolume snapshot aaa snaps/"$longname" +# 256, must fail +run_mustfail "name 256 bytes long succeeded" \ + $SUDO_HELPER "$TOP/btrfs" subvolume snapshot aaa snaps/"$longname"5 +# 255*2, must fail +run_mustfail "name 2 * 255 bytes long succeeded" \ + $SUDO_HELPER "$TOP/btrfs" subvolume snapshot aaa snaps/"$longname$longname" + +cd .. + +run_check_umount_test_dev