All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH blktests] check: add command line switch to test device drivers only
@ 2018-06-12  9:57 Johannes Thumshirn
  2018-06-25 14:23 ` Johannes Thumshirn
  2018-06-25 18:25 ` Omar Sandoval
  0 siblings, 2 replies; 4+ messages in thread
From: Johannes Thumshirn @ 2018-06-12  9:57 UTC (permalink / raw)
  To: Omar Sandoval; +Cc: Linux Block Layer Mailinglist, Johannes Thumshirn

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.

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH blktests] check: add command line switch to test device drivers only
  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
  1 sibling, 0 replies; 4+ messages in thread
From: Johannes Thumshirn @ 2018-06-25 14:23 UTC (permalink / raw)
  To: Omar Sandoval; +Cc: Linux Block Layer Mailinglist

Ping?
-- 
Johannes Thumshirn                                          Storage
jthumshirn@suse.de                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N�rnberg
GF: Felix Imend�rffer, Jane Smithard, Graham Norton
HRB 21284 (AG N�rnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH blktests] check: add command line switch to test device drivers only
  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
  2018-06-26  7:03   ` Johannes Thumshirn
  1 sibling, 1 reply; 4+ messages in thread
From: Omar Sandoval @ 2018-06-25 18:25 UTC (permalink / raw)
  To: Johannes Thumshirn; +Cc: Linux Block Layer Mailinglist

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
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH blktests] check: add command line switch to test device drivers only
  2018-06-25 18:25 ` Omar Sandoval
@ 2018-06-26  7:03   ` Johannes Thumshirn
  0 siblings, 0 replies; 4+ messages in thread
From: Johannes Thumshirn @ 2018-06-26  7:03 UTC (permalink / raw)
  To: Omar Sandoval; +Cc: Linux Block Layer Mailinglist

Thanks :-)
-- 
Johannes Thumshirn                                          Storage
jthumshirn@suse.de                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N�rnberg
GF: Felix Imend�rffer, Jane Smithard, Graham Norton
HRB 21284 (AG N�rnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-06-26  7:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2018-06-26  7:03   ` Johannes Thumshirn

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.