From patchwork Fri Mar 10 07:39:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amir Goldstein X-Patchwork-Id: 9615169 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 A69EB60415 for ; Fri, 10 Mar 2017 07:40:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 89D9E286F5 for ; Fri, 10 Mar 2017 07:40:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7585C28706; Fri, 10 Mar 2017 07:40:01 +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.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID 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 E0730286F5 for ; Fri, 10 Mar 2017 07:40:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752598AbdCJHkB (ORCPT ); Fri, 10 Mar 2017 02:40:01 -0500 Received: from mail-wr0-f193.google.com ([209.85.128.193]:34443 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750969AbdCJHkA (ORCPT ); Fri, 10 Mar 2017 02:40:00 -0500 Received: by mail-wr0-f193.google.com with SMTP id u48so10555004wrc.1 for ; Thu, 09 Mar 2017 23:39:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=46Wr3tLaKFfJLq1UybgDptLzhVyCeQSQVsDpq02uVKM=; b=BQg0qV6D3pLaw4bxGOP4iiFElO5VbTvTWrCseMqpr5T/ixpXPdNo5pB3wzhC2fTpSK OfvZqCb7oxAy/4FeWcgnZslr7OY4xesLk8Y8ABY9eF2fCaTNfpzDnn6cQYA0v45fYfI/ zksc7i/4XAhaseyhyLi+ZtrhAFcICrFYgX+DkIYE+3qn0JStUT24zTu2Ci7pLyxd0LRB Lal2O8U2cu5jknBHoNTB4lakdfewdzDLP+o++S0TMZXybahsNpRYj4+vXLVMEKSgUces Ey//onZY83rDxHfmSp1lf+rzwXrNkMiQVckdOkk7nT0t7el31sBkGNAuXw3wR3Sx/gUT +NXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=46Wr3tLaKFfJLq1UybgDptLzhVyCeQSQVsDpq02uVKM=; b=LkGDGcf0sIvMVeIedkCvO9IZA3Jo8X0nMa69aKGvgnAlona2IkOo1crfiASzi6Cat3 j0nSm6DzY4UevmycIC1J8sYNWXJNRk6E2gpDmaJYLbM1BDpt+crEJ3mo3qOgBeNIEamE a0E6IWoMRco9+QdICfemvbsNJjxM6pk2LVkDzhahmtcFFmckf2egYfUuZkzQ/GE+Kxef 5gLKNqEUbxjgzqAaTFzpCqKSVHheOmPbLtLCp6oXncJVHE6mj5WqfvaQtHtiThkYRiNy fm4GHnbnxP4DaB23WeJ6lZgdaew0fGs4qP89TRVixsMurZgTi3t7tdKz7JjOSYZUqiZ0 SrGw== X-Gm-Message-State: AMke39ljdJTi9ujTnw/6QXDcAmm6pVtsnRYZxOLIhr9ekG5tu81eaFuJv5T3ahc2JS9Nsg== X-Received: by 10.223.135.109 with SMTP id 42mr15723742wrz.141.1489131598452; Thu, 09 Mar 2017 23:39:58 -0800 (PST) Received: from localhost.localdomain (bzq-79-176-143-83.red.bezeqint.net. [79.176.143.83]) by smtp.gmail.com with ESMTPSA id d42sm11571435wrd.37.2017.03.09.23.39.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 09 Mar 2017 23:39:57 -0800 (PST) From: Amir Goldstein To: Eryu Guan Cc: fstests@vger.kernel.org Subject: [PATCH v2] filter: match $TEST_* $SCRATCH_* in beginning of path string Date: Fri, 10 Mar 2017 09:39:56 +0200 Message-Id: <1489131596-9726-1-git-send-email-amir73il@gmail.com> X-Mailer: git-send-email 2.7.4 Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP For example, if $TEST_DIR=/mnt, only replace instances of /mnt that are in the beginning of a path string, e.g.: "/mnt/mntA/mntB:/mnt/mntC" => "TEST_DIR/mntA/mntB:TEST_DIR/mntC" With this change, there is no longer a need to check the case of $TEST_DEV being a substring of $TEST_DIR, because that would mean that $TEST_DIR is a prefix of $TEST_DIR and that is not possible. Signed-off-by: Amir Goldstein --- Eryu, Here's the formal patch you requested. Tested it with: kvm-xfstests -c overlay/large -g quick Where kvm-xfstests uses new overlay config, see: github.com/amir73il/xfstests-bld/commits/overlayfs-devel v2: - Remove the 'else' case in filters v1: - Add \B to pattern match common/filter | 31 +++++++++---------------------- 1 file changed, 9 insertions(+), 22 deletions(-) diff --git a/common/filter b/common/filter index 1ceb346..5fd71a8 100644 --- a/common/filter +++ b/common/filter @@ -280,32 +280,19 @@ _filter_xfs_io_pages_modified() _filter_test_dir() { - if ( echo $TEST_DIR | grep -q $TEST_DEV ); then - # TEST_DEV is substr of TEST_DIR (e.g. /mnt and /mnt/ovl-mnt) - # substitute TEST_DIR first - sed -e "s,$TEST_DIR,TEST_DIR,g" \ - -e "s,$TEST_DEV,TEST_DEV,g" - else - # TEST_DIR maybe a substr of TEST_DIR (e.g. /vdc and /dev/vdc) - # substitute TEST_DEV first - sed -e "s,$TEST_DEV,TEST_DEV,g" \ - -e "s,$TEST_DIR,TEST_DIR,g" - fi + # TEST_DEV may be a prefix of TEST_DIR (e.g. /mnt, /mnt/ovl-mnt) + # so substitute TEST_DIR first + sed -e "s,\B$TEST_DIR,TEST_DIR,g" \ + -e "s,\B$TEST_DEV,TEST_DEV,g" } _filter_scratch() { - if ( echo $SCRATCH_MNT | grep -q $SCRATCH_DEV ); then - # SCRATCH_DEV is substr of SCRATCH_MNT - sed -e "s,$SCRATCH_MNT,SCRATCH_MNT,g" \ - -e "s,$SCRATCH_DEV,SCRATCH_DEV,g" \ - -e "/.use_space/d" - else - # SCRATCH_MNT maybe a substr of SCRATCH_DEV - sed -e "s,$SCRATCH_DEV,SCRATCH_DEV,g" \ - -e "s,$SCRATCH_MNT,SCRATCH_MNT,g" \ - -e "/.use_space/d" - fi + # SCRATCH_DEV may be a prefix of SCRATCH_MNT (e.g. /mnt, /mnt/ovl-mnt) + # so substitute SCRATCH_MNT first + sed -e "s,\B$SCRATCH_MNT,SCRATCH_MNT,g" \ + -e "s,\B$SCRATCH_DEV,SCRATCH_DEV,g" \ + -e "/.use_space/d" } # Turn any device in the scratch pool into SCRATCH_DEV