linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Omar Sandoval <osandov@osandov.com>
To: Johannes Thumshirn <jthumshirn@suse.de>
Cc: Linux Block Layer Mailinglist <linux-block@vger.kernel.org>
Subject: Re: [PATCH blktests] check: add command line switch to test device drivers only
Date: Mon, 25 Jun 2018 11:25:10 -0700	[thread overview]
Message-ID: <20180625182510.GA11014@vader> (raw)
In-Reply-To: <20180612095706.4831-1-jthumshirn@suse.de>

On Tue, Jun 12, 2018 at 11:57:06AM +0200, Johannes Thumshirn wrote:
> Sometimes it's useful to only run tests which exercise a device
> special driver to verify a patch for the driver doesn't introduce a
> regression.
> 
> Running the whole test-suite is just a waste of time in this case, so
> provide a way to only run tests which have a test_device() function
> set and not a test() function.

Thanks, applied with a few fixes mentioned below.

> Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
> ---
>  check | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
> 
> diff --git a/check b/check
> index 4baa8dde2436..639fcc43f09d 100755
> --- a/check
> +++ b/check
> @@ -395,6 +395,12 @@ _run_test() {
>  	. "tests/${TEST_NAME}"
>  
>  	if declare -fF test >/dev/null; then
> +		if [[ -v DEVICE_ONLY ]]; then
> +			SKIP_REASON="test excluded by user"
> +			_output_notrun "$TEST_NAME"
> +			return 0
> +		fi
> +

This should go in _found_test() where we do the -q skipping, too.

>  		if declare -fF requires >/dev/null && ! requires; then
>  			_output_notrun "$TEST_NAME"
>  			return 0
> @@ -546,6 +552,9 @@ Test runs:
>    -x, --exclude=TEST     exclude a test (or test group) from the list of
>  			 tests to run
>  
> +  -d --device-only       only run test which use a test device from the
> +                         TEST_DEV config setting
> +
>  Miscellaneous:
>    -h, --help             display this help message and exit"
>  
> @@ -570,6 +579,7 @@ unset TEMP
>  
>  # Default configuration.
>  QUICK_RUN=0
> +DEVICE_ONLY=0
>  EXCLUDE=()
>  TEST_DEVS=()
>  
> @@ -592,6 +602,10 @@ while true; do
>  			EXCLUDE+=("$2")
>  			shift 2
>  			;;
> +		'-d'|'--device-only')
> +			DEVICE_ONLY=1
> +			shift 2

This doesn't take an argument, so it's just shift, not shift 2.

> +			;;

This needs a matching "d" added to the getopt call.

>  		'-h'|'--help')
>  			usage out
>  			;;
> @@ -609,6 +623,10 @@ if [[ QUICK_RUN -ne 0 && ! -v TIMEOUT ]]; then
>  	_error "QUICK_RUN specified without TIMEOUT"
>  fi
>  
> +if [[ DEVICE_ONLY -ne 0 && ${#TEST_DEVS[@]} -eq 0 ]]; then

This should be $DEVICE_ONLY. Looks like I made the same mistake above
with $QUICK_RUN ;)

> +	_error "DEVICE_ONLY specified without TEST_DEVS"
> +fi
> +
>  # Convert the exclude list to an associative array.
>  TEMP_EXCLUDE=("${EXCLUDE[@]}")
>  unset EXCLUDE
> -- 
> 2.16.4
> 

  parent reply	other threads:[~2018-06-25 18:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-12  9:57 [PATCH blktests] check: add command line switch to test device drivers only Johannes Thumshirn
2018-06-25 14:23 ` Johannes Thumshirn
2018-06-25 18:25 ` Omar Sandoval [this message]
2018-06-26  7:03   ` Johannes Thumshirn

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=20180625182510.GA11014@vader \
    --to=osandov@osandov.com \
    --cc=jthumshirn@suse.de \
    --cc=linux-block@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 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).