From: Amir Goldstein <amir73il@gmail.com>
To: Eryu Guan <eguan@redhat.com>
Cc: Miklos Szeredi <miklos@szeredi.hu>, Xiong Zhou <xzhou@redhat.com>,
linux-unionfs@vger.kernel.org, fstests@vger.kernel.org
Subject: [PATCH v5 04/10] fstests: fix test and scratch filters for overlapping DEV/MNT paths
Date: Tue, 28 Feb 2017 14:18:31 +0200 [thread overview]
Message-ID: <1488284317-3119-5-git-send-email-amir73il@gmail.com> (raw)
In-Reply-To: <1488284317-3119-1-git-send-email-amir73il@gmail.com>
When configuring overlay base fs, TEST_DEV/DIR and SCRATCH_DEV/MNT
are derived from the base fs mount points, where *_DEV are the
path of the base fs mount point and TEST_DIR/SCRATCH_MNT are
a directory under the base fs mount point.
This means that the overlay DEV paths are prefixes of the overlay
mount points.
Fix the test and sctach filters to check if TEST_DEV/SCRATCH_DEV is
a substring of TEST_DIR/SCRATCH_MNT and try and match the longer
string first.
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
---
common/filter | 26 ++++++++++++++++++++++----
1 file changed, 22 insertions(+), 4 deletions(-)
diff --git a/common/filter b/common/filter
index 4328159..010f080 100644
--- a/common/filter
+++ b/common/filter
@@ -280,14 +280,32 @@ _filter_xfs_io_pages_modified()
_filter_test_dir()
{
- sed -e "s,$TEST_DEV,TEST_DEV,g" -e "s,$TEST_DIR,TEST_DIR,g"
+ 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
}
_filter_scratch()
{
- sed -e "s,$SCRATCH_DEV,SCRATCH_DEV,g" \
- -e "s,$SCRATCH_MNT,SCRATCH_MNT,g" \
- -e "/.use_space/d"
+ 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
}
# Turn any device in the scratch pool into SCRATCH_DEV
--
2.7.4
next prev parent reply other threads:[~2017-02-28 12:20 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-28 12:18 [PATCH v5 0/10] fstests: new way to run overlay tests Amir Goldstein
2017-02-28 12:18 ` [PATCH v5 01/10] fstests: sanity check that test partitions are not mounted elsewhere Amir Goldstein
2017-02-28 12:18 ` [PATCH v5 02/10] fstests: use _test_mount() consistently Amir Goldstein
2017-02-28 12:18 ` [PATCH v5 03/10] fstests: canonicalize mount points on every config section Amir Goldstein
2017-02-28 12:18 ` Amir Goldstein [this message]
2017-02-28 12:18 ` [PATCH v5 05/10] fstests: allow overlay SCRATCH_DEV to be a base fs mount point Amir Goldstein
2017-02-28 12:18 ` [PATCH v5 06/10] generic/064: access SCRATCH_MNT after _scratch_mount Amir Goldstein
2017-02-28 12:18 ` [PATCH v5 07/10] overlay: rename OVERLAY_LOWER/UPPER/WORK_DIR Amir Goldstein
2017-02-28 12:18 ` [PATCH v5 08/10] overlay: configure TEST/SCRATCH vars to base fs Amir Goldstein
2017-02-28 12:18 ` [PATCH v5 09/10] overlay: mount/unmount base fs before/after running tests Amir Goldstein
2017-02-28 12:18 ` [PATCH v5 10/10] overlay: use OVL_BASE_SCRATCH_MNT instead of SCRATCH_DEV Amir Goldstein
2017-03-01 3:47 ` [PATCH v5 0/10] fstests: new way to run overlay tests 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=1488284317-3119-5-git-send-email-amir73il@gmail.com \
--to=amir73il@gmail.com \
--cc=eguan@redhat.com \
--cc=fstests@vger.kernel.org \
--cc=linux-unionfs@vger.kernel.org \
--cc=miklos@szeredi.hu \
--cc=xzhou@redhat.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox