From patchwork Fri Sep 1 05:39:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Misono Tomohiro X-Patchwork-Id: 9933481 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 B19916021C for ; Fri, 1 Sep 2017 05:40:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A261D2850F for ; Fri, 1 Sep 2017 05:40:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 95F872851E; Fri, 1 Sep 2017 05:40:58 +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 15BA72850F for ; Fri, 1 Sep 2017 05:40:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751047AbdIAFjz (ORCPT ); Fri, 1 Sep 2017 01:39:55 -0400 Received: from mgwkm02.jp.fujitsu.com ([202.219.69.169]:12889 "EHLO mgwkm02.jp.fujitsu.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750878AbdIAFjy (ORCPT ); Fri, 1 Sep 2017 01:39:54 -0400 Received: from kw-mxoi2.gw.nic.fujitsu.com (unknown [192.168.231.133]) by mgwkm02.jp.fujitsu.com with smtp id 2096_e2aa_de98a00c_fb36_401f_9045_60259afe91f9; Fri, 01 Sep 2017 14:39:50 +0900 Received: from g01jpfmpwkw01.exch.g01.fujitsu.local (g01jpfmpwkw01.exch.g01.fujitsu.local [10.0.193.38]) by kw-mxoi2.gw.nic.fujitsu.com (Postfix) with ESMTP id 8C91EAC00A0; Fri, 1 Sep 2017 14:39:49 +0900 (JST) Received: from G01JPEXCHKW13.g01.fujitsu.local (G01JPEXCHKW13.g01.fujitsu.local [10.0.194.52]) by g01jpfmpwkw01.exch.g01.fujitsu.local (Postfix) with ESMTP id CD88169276B; Fri, 1 Sep 2017 14:39:48 +0900 (JST) X-SecurityPolicyCheck: OK by SHieldMailChecker v2.5.2 X-SHieldMailCheckerPolicyVersion: FJ-ISEC-20170217-enc X-SHieldMailCheckerMailID: 33c6e220d9ea4b26b5c86ca7f2f2ff81 To: , Eryu Guan CC: From: "Misono, Tomohiro" Subject: [PATCH 1/2] Add new common filter function Message-ID: <5f6cd84d-6e12-2b23-09fc-c0f744d1d2f2@jp.fujitsu.com> Date: Fri, 1 Sep 2017 14:39:44 +0900 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 Content-Language: en-US X-SecurityPolicyCheck-GC: OK by FENCE-Mail X-TM-AS-MML: disable 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 Several tests uses both _filter_test_dir and _filter_scratch concatenated by pipe to filter $TEST_DIR and $SCRATCH_MNT. However, this would fail if the shorter string is a substring of the other (like "/mnt" and "/mnt2"). This patch introduces new common filter function to safely call both _filter_test_dir and _filter_scratch. I chedked this with btrfs/029, generic/409,410,411, and generic/381,383, xfs/106,108 (which calls _filter_quota). Thanks Eryu for advice. Signed-off-by: Tomohiro Misono --- common/filter | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/common/filter b/common/filter index 1ef342b..75570f9 100644 --- a/common/filter +++ b/common/filter @@ -295,6 +295,17 @@ _filter_scratch() -e "/.use_space/d" } +_filter_testdir_and_scratch() +{ + # filter both $TEST_DIR and $SCRATCH_MNT, but always filter the longer + # string first if the other string is a substring of the first one + if echo "$TEST_DIR" | grep -q "$SCRATCH_MNT"; then + _filter_test_dir | _filter_scratch + else + _filter_scratch | _filter_test_dir + fi +} + # Turn any device in the scratch pool into SCRATCH_DEV _filter_scratch_pool() {