From patchwork Fri Dec 30 04:14:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Su Yue X-Patchwork-Id: 9491749 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 657C662AB9 for ; Fri, 30 Dec 2016 04:14:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 549A91FFD6 for ; Fri, 30 Dec 2016 04:14:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 48C552018E; Fri, 30 Dec 2016 04:14:29 +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=unavailable 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 E6A751FFD6 for ; Fri, 30 Dec 2016 04:14:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753450AbcL3EOZ (ORCPT ); Thu, 29 Dec 2016 23:14:25 -0500 Received: from cn.fujitsu.com ([59.151.112.132]:63052 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1753096AbcL3EOY (ORCPT ); Thu, 29 Dec 2016 23:14:24 -0500 X-IronPort-AV: E=Sophos;i="5.22,518,1449504000"; d="scan'208";a="14368758" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 30 Dec 2016 12:14:12 +0800 Received: from G08CNEXCHPEKD03.g08.fujitsu.local (unknown [10.167.33.85]) by cn.fujitsu.com (Postfix) with ESMTP id D0100477B1FD; Fri, 30 Dec 2016 12:14:12 +0800 (CST) Received: from localhost.localdomain (10.167.226.129) by G08CNEXCHPEKD03.g08.fujitsu.local (10.167.33.89) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 30 Dec 2016 12:14:12 +0800 From: Su Yue To: , Subject: [PATCH 2/2] fstests: btrfs/006: Fix false alert due to output change Date: Thu, 29 Dec 2016 23:14:10 -0500 Message-ID: <20161230041410.10038-2-suy.fnst@cn.fujitsu.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20161230041410.10038-1-suy.fnst@cn.fujitsu.com> References: <20161230041410.10038-1-suy.fnst@cn.fujitsu.com> MIME-Version: 1.0 X-Originating-IP: [10.167.226.129] X-yoursite-MailScanner-ID: D0100477B1FD.AA47E X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: suy.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 Btrfs-progs v4.9 changed "device status" output by adding one more space, which differs from golden output. Fix it by introducing new filter to convert multi space into one. Signed-off-by: Su Yue --- common/filter | 6 ++++++ tests/btrfs/006 | 16 ++++++++++++---- tests/btrfs/006.out | 24 ++++++++++++------------ 3 files changed, 30 insertions(+), 16 deletions(-) diff --git a/common/filter b/common/filter index 397b456..4d5e4d0 100644 --- a/common/filter +++ b/common/filter @@ -401,5 +401,11 @@ _filter_mknod() sed -e "s/mknod: [\`']\(.*\)': File exists/mknod: \1: File exists/" } +# Filter spaces into one +_filter_spaces() +{ + sed -e "s/\s\+/ /g" +} + # make sure this script returns success /bin/true diff --git a/tests/btrfs/006 b/tests/btrfs/006 index 0863394..dc9bfb9 100755 --- a/tests/btrfs/006 +++ b/tests/btrfs/006 @@ -82,13 +82,21 @@ echo "== Sync filesystem" $BTRFS_UTIL_PROG filesystem sync $SCRATCH_MNT > /dev/null echo "== Show device stats by mountpoint" -$BTRFS_UTIL_PROG device stats $SCRATCH_MNT | _filter_btrfs_device_stats $TOTAL_DEVS +$BTRFS_UTIL_PROG device stats $SCRATCH_MNT | \ + _filter_btrfs_device_stats $TOTAL_DEVS | \ + _filter_spaces echo "== Show device stats by first/scratch dev" -$BTRFS_UTIL_PROG device stats $SCRATCH_DEV | _filter_btrfs_device_stats +$BTRFS_UTIL_PROG device stats $SCRATCH_DEV | \ + _filter_btrfs_device_stats | \ + _filter_spaces echo "== Show device stats by second dev" -$BTRFS_UTIL_PROG device stats $FIRST_POOL_DEV | sed -e "s,$FIRST_POOL_DEV,FIRST_POOL_DEV,g" +$BTRFS_UTIL_PROG device stats $FIRST_POOL_DEV | \ + sed -e "s,$FIRST_POOL_DEV,FIRST_POOL_DEV,g" | \ + _filter_spaces echo "== Show device stats by last dev" -$BTRFS_UTIL_PROG device stats $LAST_POOL_DEV | sed -e "s,$LAST_POOL_DEV,LAST_POOL_DEV,g" +$BTRFS_UTIL_PROG device stats $LAST_POOL_DEV | \ + sed -e "s,$LAST_POOL_DEV,LAST_POOL_DEV,g" | \ + _filter_spaces # success, all done status=0 diff --git a/tests/btrfs/006.out b/tests/btrfs/006.out index 05b9ac0..a976972 100644 --- a/tests/btrfs/006.out +++ b/tests/btrfs/006.out @@ -16,25 +16,25 @@ Label: 'TestLabel.006' uuid: == Sync filesystem == Show device stats by mountpoint [SCRATCH_DEV].corruption_errs - [SCRATCH_DEV].flush_io_errs + [SCRATCH_DEV].flush_io_errs [SCRATCH_DEV].generation_errs - [SCRATCH_DEV].read_io_errs - [SCRATCH_DEV].write_io_errs + [SCRATCH_DEV].read_io_errs + [SCRATCH_DEV].write_io_errs == Show device stats by first/scratch dev [SCRATCH_DEV].corruption_errs -[SCRATCH_DEV].flush_io_errs +[SCRATCH_DEV].flush_io_errs [SCRATCH_DEV].generation_errs -[SCRATCH_DEV].read_io_errs -[SCRATCH_DEV].write_io_errs +[SCRATCH_DEV].read_io_errs +[SCRATCH_DEV].write_io_errs == Show device stats by second dev -[FIRST_POOL_DEV].write_io_errs 0 -[FIRST_POOL_DEV].read_io_errs 0 -[FIRST_POOL_DEV].flush_io_errs 0 +[FIRST_POOL_DEV].write_io_errs 0 +[FIRST_POOL_DEV].read_io_errs 0 +[FIRST_POOL_DEV].flush_io_errs 0 [FIRST_POOL_DEV].corruption_errs 0 [FIRST_POOL_DEV].generation_errs 0 == Show device stats by last dev -[LAST_POOL_DEV].write_io_errs 0 -[LAST_POOL_DEV].read_io_errs 0 -[LAST_POOL_DEV].flush_io_errs 0 +[LAST_POOL_DEV].write_io_errs 0 +[LAST_POOL_DEV].read_io_errs 0 +[LAST_POOL_DEV].flush_io_errs 0 [LAST_POOL_DEV].corruption_errs 0 [LAST_POOL_DEV].generation_errs 0