From: Omar Sandoval <osandov@osandov.com>
To: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Cc: linux-block@vger.kernel.org, Omar Sandoval <osandov@fb.com>,
Masato Suzuki <masato.suzuki@wdc.com>,
Jens Axboe <axboe@kernel.dk>,
Matias Bjorling <matias.bjorling@wdc.com>,
Hannes Reinecke <hare@suse.de>, Mike Snitzer <snitzer@redhat.com>,
"Martin K . Petersen" <martin.petersen@oracle.com>,
Chaitanya Kulkarni <Chaitanya.Kulkarni@wdc.com>
Subject: Re: [PATCH blktests v3 05/13] check: Introduce fallback_device() and cleanup_fallback_device()
Date: Fri, 25 Jan 2019 13:14:01 -0800 [thread overview]
Message-ID: <20190125211401.GD26739@vader> (raw)
In-Reply-To: <20190118094453.13773-6-shinichiro.kawasaki@wdc.com>
On Fri, Jan 18, 2019 at 06:44:45PM +0900, Shin'ichiro Kawasaki wrote:
> These optional functions can be defined by a test case script. When
> defined and TEST_DEVS is empty, the fallback_device() is executed before
> runing the test case. The fallback_device() function intializes a virtual
> device to run the test case and return the device to be set in TEST_DEVS.
> After running the test case, cleanup_fallback_device() is executed to
> clean up the device.
>
> This feature allows to run test cases with test_device() function even if
> TEST_DEVS is not set in the config, using virtaul devices such as null_blk.
>
> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
> ---
> check | 25 +++++++++++++++++++++++++
> 1 file changed, 25 insertions(+)
>
> diff --git a/check b/check
> index 4563d62..4b66995 100755
> --- a/check
> +++ b/check
> @@ -407,6 +407,7 @@ _run_test() {
> CHECK_DMESG=1
> DMESG_FILTER="cat"
> RUN_FOR_ZONED=0
> + FALLBACK_DEVICE=0
>
> # shellcheck disable=SC1090
> . "tests/${TEST_NAME}"
> @@ -425,6 +426,23 @@ _run_test() {
> _call_test test
> fi
> else
> + if [[ ${#TEST_DEVS[@]} -eq 0 ]] && \
> + declare -fF fallback_device >/dev/null && \
> + declare -fF cleanup_fallback_device >/dev/null; then
We should check in _found_test that cleanup_fallback_device is defined
if fallback_device is defined, and vice versa. Then, we can just check
for fallback_device here.
> + if ! test_dev=$(fallback_device); then
> + _warning "$TEST_NAME: fallback_device call failure"
> + return 0
> + fi
> + if ! sysfs_dir="$(_find_sysfs_dir "$test_dev")"; then
> + _warning "$TEST_NAME: could not find sysfs directory for ${test_dev}"
> + cleanup_fallback_device
> + return 0
> + fi
> + TEST_DEVS=( "${test_dev}" )
> + TEST_DEV_SYSFS_DIRS["$test_dev"]="$sysfs_dir"
> + FALLBACK_DEVICE=1
> + fi
> +
> if [[ ${#TEST_DEVS[@]} -eq 0 ]]; then
> return 0
> fi
> @@ -451,6 +469,13 @@ _run_test() {
> ret=1
> fi
> done
> +
> + if (( FALLBACK_DEVICE )); then
> + cleanup_fallback_device
> + unset TEST_DEV_SYSFS_DIRS["${TEST_DEVS[0]}"]
> + TEST_DEVS=()
> + fi
> +
> return $ret
> fi
> }
> --
> 2.20.1
>
next prev parent reply other threads:[~2019-01-25 21:14 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-18 9:44 [PATCH blktests v3 00/13] Implement zoned block device support Shin'ichiro Kawasaki
2019-01-18 9:44 ` [PATCH blktests v3 01/13] config: Introduce RUN_ZONED_TESTS variable and CAN_BE_ZONED flag Shin'ichiro Kawasaki
2019-01-25 20:59 ` Omar Sandoval
2019-01-28 10:07 ` Shinichiro Kawasaki
2019-01-18 9:44 ` [PATCH blktests v3 02/13] common: Introduce _have_fio_zbd_zonemode() helper function Shin'ichiro Kawasaki
2019-01-18 9:44 ` [PATCH blktests v3 03/13] block/004: Adjust fio conditions for zoned block devices Shin'ichiro Kawasaki
2019-01-25 21:09 ` Omar Sandoval
2019-01-28 10:13 ` Shinichiro Kawasaki
2019-01-18 9:44 ` [PATCH blktests v3 04/13] block: Whitelist tests supporting " Shin'ichiro Kawasaki
2019-01-25 21:11 ` Omar Sandoval
2019-01-28 10:37 ` Shinichiro Kawasaki
2019-01-18 9:44 ` [PATCH blktests v3 05/13] check: Introduce fallback_device() and cleanup_fallback_device() Shin'ichiro Kawasaki
2019-01-25 21:14 ` Omar Sandoval [this message]
2019-01-28 10:54 ` Shinichiro Kawasaki
2019-01-18 9:44 ` [PATCH blktests v3 06/13] common: Introduce _dd() helper function Shin'ichiro Kawasaki
2019-01-25 21:17 ` Omar Sandoval
2019-01-28 12:18 ` Shinichiro Kawasaki
2019-01-18 9:44 ` [PATCH blktests v3 07/13] src: Introduce zbdioctl program Shin'ichiro Kawasaki
2019-01-18 9:44 ` [PATCH blktests v3 08/13] tests: Introduce zbd test group Shin'ichiro Kawasaki
2019-01-18 9:44 ` [PATCH blktests v3 09/13] zbd/001: sysfs and ioctl consistency test Shin'ichiro Kawasaki
2019-01-18 9:44 ` [PATCH blktests v3 10/13] zbd/002: report zone test Shin'ichiro Kawasaki
2019-01-18 9:44 ` [PATCH blktests v3 11/13] zbd/003: Test sequential zones reset Shin'ichiro Kawasaki
2019-01-18 9:44 ` [PATCH blktests v3 12/13] zbd/004: Check write split accross sequential zones Shin'ichiro Kawasaki
2019-01-18 9:44 ` [PATCH blktests v3 13/13] zbd/005: Test write ordering Shin'ichiro Kawasaki
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=20190125211401.GD26739@vader \
--to=osandov@osandov.com \
--cc=Chaitanya.Kulkarni@wdc.com \
--cc=axboe@kernel.dk \
--cc=hare@suse.de \
--cc=linux-block@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=masato.suzuki@wdc.com \
--cc=matias.bjorling@wdc.com \
--cc=osandov@fb.com \
--cc=shinichiro.kawasaki@wdc.com \
--cc=snitzer@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;
as well as URLs for NNTP newsgroup(s).