All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Misono, Tomohiro" <misono.tomohiro@jp.fujitsu.com>
To: fstests@vger.kernel.org, Eryu Guan <eguan@redhat.com>
Cc: linux-btrfs@vger.kernel.org
Subject: [PATCH 1/2] Add new common filter function
Date: Fri, 1 Sep 2017 14:39:44 +0900	[thread overview]
Message-ID: <5f6cd84d-6e12-2b23-09fc-c0f744d1d2f2@jp.fujitsu.com> (raw)

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 <misono.tomohiro@jp.fujitsu.com>
---
 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()
 {
-- 
2.9.5


             reply	other threads:[~2017-09-01  5:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-01  5:39 Misono, Tomohiro [this message]
2017-09-01  5:41 ` [PATCH 2/2] Use common filter function in several tests Misono, Tomohiro
2017-09-01  7:04 ` [PATCH 1/2] Add new common filter function Eryu Guan
2017-09-01  7:14   ` Amir Goldstein
2017-09-01  7:43     ` Eryu Guan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5f6cd84d-6e12-2b23-09fc-c0f744d1d2f2@jp.fujitsu.com \
    --to=misono.tomohiro@jp.fujitsu.com \
    --cc=eguan@redhat.com \
    --cc=fstests@vger.kernel.org \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.