From patchwork Tue Mar 15 07:28:44 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiaoguang Wang X-Patchwork-Id: 8586021 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id A02F3C0553 for ; Tue, 15 Mar 2016 07:55:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B5D3C2022D for ; Tue, 15 Mar 2016 07:55:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B705A2021B for ; Tue, 15 Mar 2016 07:55:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933539AbcCOHzB (ORCPT ); Tue, 15 Mar 2016 03:55:01 -0400 Received: from cn.fujitsu.com ([59.151.112.132]:17803 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1751155AbcCOHzA (ORCPT ); Tue, 15 Mar 2016 03:55:00 -0400 X-IronPort-AV: E=Sophos;i="5.22,518,1449504000"; d="scan'208";a="4585326" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 15 Mar 2016 15:48:32 +0800 Received: from G08CNEXCHPEKD02.g08.fujitsu.local (unknown [10.167.33.83]) by cn.fujitsu.com (Postfix) with ESMTP id 46AF042B4B13; Tue, 15 Mar 2016 15:48:32 +0800 (CST) Received: from localhost.localdomain (10.167.226.24) by G08CNEXCHPEKD02.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.181.6; Tue, 15 Mar 2016 15:48:31 +0800 From: Xiaoguang Wang To: CC: , Wang Xiaoguang Subject: [PATCH] btrfs/059: add a filter for btrfs compression property Date: Tue, 15 Mar 2016 15:28:44 +0800 Message-ID: <1458026924-24194-1-git-send-email-wangxg.fnst@cn.fujitsu.com> X-Mailer: git-send-email 1.8.2.1 MIME-Version: 1.0 X-Originating-IP: [10.167.226.24] X-yoursite-MailScanner-ID: 46AF042B4B13.A0C4A X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: wangxg.fnst@cn.fujitsu.com X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Wang Xiaoguang btrfs/059.out should not be hardcoded to zlib, if compression method is lzo, this case will fail wrongly, so here add a filter. Signed-off-by: Wang Xiaoguang --- common/filter.btrfs | 4 ++++ tests/btrfs/059 | 16 +++++++++++----- tests/btrfs/059.out | 6 +++--- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/common/filter.btrfs b/common/filter.btrfs index 9bb6479..56cf4b2 100644 --- a/common/filter.btrfs +++ b/common/filter.btrfs @@ -65,7 +65,11 @@ _filter_transaction_commit() { _filter_btrfs_subvol_delete() { _filter_scratch | _filter_transaction_commit +} +_filter_btrfs_compress_property() +{ + sed -e "s/compression=\(lzo\|zlib\)/COMPRESSION=XXX/g" } # make sure this script returns success diff --git a/tests/btrfs/059 b/tests/btrfs/059 index f6c2e27..d7db1df 100755 --- a/tests/btrfs/059 +++ b/tests/btrfs/059 @@ -44,6 +44,7 @@ _cleanup() # get standard environment, filters and checks . ./common/rc . ./common/filter +. ./common/filter.btrfs # real QA test starts here _supported_fs btrfs @@ -61,24 +62,29 @@ mkdir $SCRATCH_MNT/testdir echo "Setting compression flag in the directory..." chattr +c $SCRATCH_MNT/testdir echo "Directory compression property value:" -$BTRFS_UTIL_PROG property get $SCRATCH_MNT/testdir compression +$BTRFS_UTIL_PROG property get $SCRATCH_MNT/testdir compression | \ + _filter_btrfs_compress_property touch $SCRATCH_MNT/testdir/file1 echo "file1 compression property value:" -$BTRFS_UTIL_PROG property get $SCRATCH_MNT/testdir/file1 compression +$BTRFS_UTIL_PROG property get $SCRATCH_MNT/testdir/file1 compression | \ + _filter_btrfs_compress_property echo "Clearing compression flag from directory..." chattr -c $SCRATCH_MNT/testdir echo "Directory compression property value:" -$BTRFS_UTIL_PROG property get $SCRATCH_MNT/testdir compression +$BTRFS_UTIL_PROG property get $SCRATCH_MNT/testdir compression | \ + _filter_btrfs_compress_property touch $SCRATCH_MNT/testdir/file2 echo "file2 compression property value:" -$BTRFS_UTIL_PROG property get $SCRATCH_MNT/testdir/file2 compression +$BTRFS_UTIL_PROG property get $SCRATCH_MNT/testdir/file2 compression | \ + _filter_btrfs_compress_property touch $SCRATCH_MNT/testdir/file1 echo "file1 compression property value:" -$BTRFS_UTIL_PROG property get $SCRATCH_MNT/testdir/file1 compression +$BTRFS_UTIL_PROG property get $SCRATCH_MNT/testdir/file1 compression | \ + _filter_btrfs_compress_property status=0 exit diff --git a/tests/btrfs/059.out b/tests/btrfs/059.out index 9ec9a53..4e7539a 100644 --- a/tests/btrfs/059.out +++ b/tests/btrfs/059.out @@ -1,11 +1,11 @@ QA output created by 059 Setting compression flag in the directory... Directory compression property value: -compression=zlib +COMPRESSION=XXX file1 compression property value: -compression=zlib +COMPRESSION=XXX Clearing compression flag from directory... Directory compression property value: file2 compression property value: file1 compression property value: -compression=zlib +COMPRESSION=XXX