From: Eryu Guan <eguan@redhat.com>
To: Amir Goldstein <amir73il@gmail.com>
Cc: Miklos Szeredi <miklos@szeredi.hu>,
linux-unionfs@vger.kernel.org, fstests@vger.kernel.org
Subject: Re: [PATCH v3 2/9] fstests: use _test_mount() consistently
Date: Mon, 13 Feb 2017 19:17:11 +0800 [thread overview]
Message-ID: <20170213111711.GG24562@eguan.usersys.redhat.com> (raw)
In-Reply-To: <1486932224-17075-3-git-send-email-amir73il@gmail.com>
On Sun, Feb 12, 2017 at 10:43:37PM +0200, Amir Goldstein wrote:
> On start of every test run and on every test, in init_rc() helper,
> the test partition is verified to be mounted, or is mounted by
> the helper _test_mount().
>
> _test_mount() uses mount options $TEST_FS_MOUNT_OPTS and not
> $MOUNT_OPTIONS like _scratch_mount() does.
>
> _test_cycle_mount(), which is called by some tests uses the
> _test_mount() helper as well.
>
> Contrary to those cases, in _require_test() helper, if test
> partition is not mounted, the helper _mount_or_remount_rw()
> is called to mount the test partition with $MOUNT_OPTIONS.
> Although this should never happen, because of the test in
> init_rc(), this case is inconsistent with the rest of the code,
> so it has been changed to use _test_mount() as it should.
>
> When running tests with a multi section configuration, and
> either FSTYP or MOUNT_OPTIONS change between sections, the
> helper _test_unmount() is called to unmount the old test mount
> and then _mount_or_remount_rw() is called to mount it again
> with new FSTYP and/or MOUNT_OPTIONS.
> This is again inconsistent with the rest of the code, so
> was changed to use _test_mount() and instead of checking
> if MOUNT_OPTIONS have changed between sections, we check if
> TEST_FS_MOUNT_OPTS were changed between sections.
> Otherwise, we can leave the test partition mounted.
>
> This change is needed to support overlay base fs mount
> and for multi section config files which include overlay FSTYP.
>
> Signed-off-by: Amir Goldstein <amir73il@gmail.com>
> ---
> check | 22 ++++++++++------------
> common/rc | 6 +++---
> 2 files changed, 13 insertions(+), 15 deletions(-)
>
> diff --git a/check b/check
> index 5a93c94..ec9798a 100755
> --- a/check
> +++ b/check
> @@ -474,7 +474,7 @@ fi
>
> for section in $HOST_OPTIONS_SECTIONS; do
> OLD_FSTYP=$FSTYP
> - OLD_MOUNT_OPTIONS=$MOUNT_OPTIONS
> + OLD_TEST_FS_MOUNT_OPTS=$TEST_FS_MOUNT_OPTS
> get_next_config $section
>
> # Do we need to run only some sections ?
> @@ -527,20 +527,18 @@ for section in $HOST_OPTIONS_SECTIONS; do
> status=1
> exit
> fi
> - out=`_mount_or_remount_rw "$MOUNT_OPTIONS" $TEST_DEV $TEST_DIR`
> - if [ $? -ne 1 ]; then
> - echo $out
> - status=1
> - exit
> + if ! _test_mount
> + then
> + echo "check: failed to mount $TEST_DEV on $TEST_DIR"
> + exit 1
Have to set status=1 before exiting here and below, otherwise return
value of check is zero even when error happens. See commit a276c261c9c
Thanks,
Eryu
> fi
> _prepare_test_list
> - elif [ "$OLD_MOUNT_OPTIONS" != "$MOUNT_OPTIONS" ]; then
> + elif [ "$OLD_TEST_FS_MOUNT_OPTS" != "$TEST_FS_MOUNT_OPTS" ]; then
> _test_unmount 2> /dev/null
> - out=`_mount_or_remount_rw "$MOUNT_OPTIONS" $TEST_DEV $TEST_DIR`
> - if [ $? -ne 1 ]; then
> - echo $out
> - status=1
> - exit
> + if ! _test_mount
> + then
> + echo "check: failed to mount $TEST_DEV on $TEST_DIR"
> + exit 1
> fi
> fi
>
> diff --git a/common/rc b/common/rc
> index d831b17..00afb31 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -1485,9 +1485,9 @@ _require_test()
>
> if ! _check_mounted_on TEST_DEV $TEST_DEV TEST_DIR $TEST_DIR
> then
> - out=`_mount_or_remount_rw "$MOUNT_OPTIONS" $TEST_DEV $TEST_DIR`
> - if [ $? -ne 1 ]; then
> - echo $out
> + if ! _test_mount
> + then
> + echo "!!! failed to mount $TEST_DEV on $TEST_DIR"
> exit 1
> fi
> fi
> --
> 2.7.4
>
next prev parent reply other threads:[~2017-02-13 11:17 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-12 20:43 [PATCH v3 0/9] fstests: new way to run overlay tests Amir Goldstein
2017-02-12 20:43 ` [PATCH v3 1/9] fstests: sanity check that test partitions are not mounted elsewhere Amir Goldstein
2017-02-13 11:10 ` Eryu Guan
2017-02-13 11:44 ` Amir Goldstein
2017-02-13 13:33 ` Amir Goldstein
2017-02-14 5:51 ` Eryu Guan
2017-02-14 6:02 ` Amir Goldstein
2017-02-14 7:23 ` Eryu Guan
2017-02-14 8:05 ` Amir Goldstein
2017-02-16 8:53 ` Amir Goldstein
2017-02-12 20:43 ` [PATCH v3 2/9] fstests: use _test_mount() consistently Amir Goldstein
2017-02-13 11:17 ` Eryu Guan [this message]
2017-02-12 20:43 ` [PATCH v3 3/9] fstests: canonicalize mount points on every config section Amir Goldstein
2017-02-12 20:43 ` [PATCH v3 4/9] overlay: rename OVERLAY_LOWER/UPPER/WORK_DIR Amir Goldstein
2017-02-12 20:43 ` [PATCH v3 5/9] overlay: allow SCRATCH_DEV to be the base fs mount point Amir Goldstein
2017-02-12 20:43 ` [PATCH v3 6/9] overlay: configure TEST/SCRATCH vars to base fs Amir Goldstein
2017-02-13 11:28 ` Eryu Guan
2017-02-13 20:31 ` Amir Goldstein
2017-02-14 11:03 ` Eryu Guan
2017-02-15 14:59 ` Amir Goldstein
2017-02-12 20:43 ` [PATCH v3 7/9] overlay: use OVL_BASE_SCRATCH_MNT instead of SCRATCH_DEV Amir Goldstein
2017-02-12 20:43 ` [PATCH v3 8/9] overlay: fix test and scratch filters for overlay base fs Amir Goldstein
2017-02-13 20:39 ` Amir Goldstein
2017-02-12 20:43 ` [PATCH v3 9/9] overlay: mount/unmount base fs before/after running tests Amir Goldstein
2017-02-13 11:31 ` Eryu Guan
2017-02-13 11:59 ` Amir Goldstein
2017-02-14 0:23 ` Theodore Ts'o
2017-02-14 5:24 ` Eryu Guan
2017-02-14 6:43 ` Amir Goldstein
2017-02-14 17:07 ` Theodore Ts'o
2017-02-14 17:55 ` Amir Goldstein
2017-02-16 8:50 ` Amir Goldstein
2017-02-12 20:51 ` [PATCH v3 0/9] fstests: new way to run overlay tests Amir Goldstein
2017-02-13 4:19 ` Xiong Zhou
2017-02-13 5:37 ` Amir Goldstein
2017-02-14 4:40 ` Xiong Zhou
2017-02-14 6:15 ` Amir Goldstein
2017-02-14 9:25 ` Xiong Zhou
2017-02-14 9:51 ` Amir Goldstein
2017-02-13 11:02 ` Eryu Guan
2017-02-16 9:02 ` Amir Goldstein
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=20170213111711.GG24562@eguan.usersys.redhat.com \
--to=eguan@redhat.com \
--cc=amir73il@gmail.com \
--cc=fstests@vger.kernel.org \
--cc=linux-unionfs@vger.kernel.org \
--cc=miklos@szeredi.hu \
/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