public inbox for linux-block@vger.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

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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox