From patchwork Mon Oct 10 03:11:21 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qu Wenruo X-Patchwork-Id: 9368901 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 5FA1760CDC for ; Mon, 10 Oct 2016 03:11:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 624EE28BF2 for ; Mon, 10 Oct 2016 03:11:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5720128BF4; Mon, 10 Oct 2016 03:11:57 +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 AE2C228BF6 for ; Mon, 10 Oct 2016 03:11:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751998AbcJJDLl (ORCPT ); Sun, 9 Oct 2016 23:11:41 -0400 Received: from cn.fujitsu.com ([222.73.24.84]:4152 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1751939AbcJJDLk (ORCPT ); Sun, 9 Oct 2016 23:11:40 -0400 X-IronPort-AV: E=Sophos;i="5.20,367,1444665600"; d="scan'208";a="887929" Received: from unknown (HELO cn.fujitsu.com) ([10.167.250.3]) by song.cn.fujitsu.com with ESMTP; 10 Oct 2016 11:11:28 +0800 Received: from adam-work.localdomain (unknown [10.167.226.34]) by cn.fujitsu.com (Postfix) with ESMTP id AAFBA41B4BC2; Mon, 10 Oct 2016 11:11:24 +0800 (CST) From: Qu Wenruo To: linux-btrfs@vger.kernel.org Cc: dsterba@suse.cz, lakshmipathi.g@gmail.com Subject: [PATCH 4/4] btrfs-progs: convert-test: Add test case for common inode flags Date: Mon, 10 Oct 2016 11:11:21 +0800 Message-Id: <20161010031121.5017-5-quwenruo@cn.fujitsu.com> X-Mailer: git-send-email 2.10.0 In-Reply-To: <20161010031121.5017-1-quwenruo@cn.fujitsu.com> References: <20161010031121.5017-1-quwenruo@cn.fujitsu.com> MIME-Version: 1.0 X-yoursite-MailScanner-ID: AAFBA41B4BC2.A1464 X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: quwenruo@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 Add a new test case to check if btrfs-convert copies common inode flags like append(a), immutable(i). Signed-off-by: Qu Wenruo --- tests/convert-tests/009-common-inode-flags/test.sh | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100755 tests/convert-tests/009-common-inode-flags/test.sh diff --git a/tests/convert-tests/009-common-inode-flags/test.sh b/tests/convert-tests/009-common-inode-flags/test.sh new file mode 100755 index 0000000..8bbac22 --- /dev/null +++ b/tests/convert-tests/009-common-inode-flags/test.sh @@ -0,0 +1,34 @@ +#!/bin/bash +# Check if btrfs-convert can copy common inode flags like SYNC/IMMUTABLE + +source $TOP/tests/common +source $TOP/tests/common.convert + +setup_root_helper +prepare_test_dev 512M +check_prereq btrfs-convert + +fail=0 +default_mke2fs="mke2fs -t ext4 -b 4096" +convert_test_preamble '' 'common inode flags test' 16k "$default_mke2fs" +convert_test_prep_fs $default_mke2fs + +# create file with specific flags +$SUDO_HELPER run_check touch $TEST_MNT/flag_test +$SUDO_HELPER run_check chattr +aSidA $TEST_MNT/flag_test + +run_check_umount_test_dev +convert_test_do_convert +run_check_mount_test_dev + +# Above flags should be copied to btrfs flags, and lsattr should get them +run_check_stdout lsattr $TEST_MNT/flag_test | cut -f1 -d\ > tmp_output +grep -e "S" -e "i" -e "a" -e "d" -e "A" -q tmp_output +if [ $? -ne 0 ]; then + rm tmp_output + _fail "no common inode flags are copied after convert" +fi +rm tmp_output + +run_check_umount_test_dev +convert_test_post_rollback