]> www.infradead.org Git - users/sagi/blktests.git/commitdiff
check: support QUICK_RUN, TIMEOUT, and EXCLUDED in config
authorOmar Sandoval <osandov@fb.com>
Fri, 19 May 2017 18:35:34 +0000 (11:35 -0700)
committerOmar Sandoval <osandov@fb.com>
Fri, 19 May 2017 18:44:02 +0000 (11:44 -0700)
Signed-off-by: Omar Sandoval <osandov@fb.com>
Documentation/running-tests.md
check

index c5035ccca4841e5852b37a66a97c3922122a7ccd..ea2ce85bf243e3a066a14531aa4bc463fa115193 100644 (file)
@@ -32,13 +32,34 @@ and will overwrite any data on these devices.
 TEST_DEVS=(/dev/nvme0n1 /dev/sdb)
 ```
 
-### Test Timeout
+### Excluding Tests
+
+
+The `EXCLUDE` variable is an array of tests or test groups to exclude. This
+corresponds to the `-x` command line option.
+
+```sh
+EXCLUDE=(loop block/001)
+```
+
+Tests specified explicitly on the command line will always run even if they are
+in `EXCLUDE`.
+
+### Quick Runs and Test Timeouts
 
 Many tests can take a long time to run. By setting the `TIMEOUT` variable, you
 can limit the runtime of each test to a specific length (in seconds).
 
 ```sh
-TIMEOUT=30
+TIMEOUT=60
 ```
 
-Note that not all tests honor this timeout.
+Note that not all tests honor this timeout. You can define the `QUICK_RUN`
+variable in addition to `TIMEOUT` to specify that only tests which honor the
+timeout or are otherwise "quick" should run. This corresponds to the `-q`
+command line option.
+
+```sh
+QUICK_RUN=1
+TIMEOUT=30
+```
diff --git a/check b/check
index 50de0e8832fba3151892a2228b3b328350dbd366..22dedec2cf8b2f447000dcdda3bcfab046a4bf3b 100755 (executable)
--- a/check
+++ b/check
@@ -557,13 +557,22 @@ fi
 eval set -- "$TEMP"
 unset TEMP
 
+# Default configuration.
 QUICK_RUN=0
 EXCLUDE=()
+TEST_DEVS=()
+
+if [[ -r config ]]; then
+       . config
+fi
+
 while true; do
        case "$1" in
                '-q'|'--quick')
                        QUICK_RUN=1
-                       TIMEOUT="${2:-30}"
+                       # Use the timeout specified on the command line, from
+                       # the config, or the default.
+                       TIMEOUT="${2:-${TIMEOUT:-30}}"
                        shift 2
                        ;;
                '-x'|'--exclude')
@@ -583,12 +592,8 @@ while true; do
        esac
 done
 
-if [[ -r config ]]; then
-       . config
-fi
-
-if [[ ! -v TEST_DEVS ]]; then
-       TEST_DEVS=()
+if [[ QUICK_RUN -ne 0 && ! -v TIMEOUT ]]; then
+       _error "QUICK_RUN specified without TIMEOUT"
 fi
 
 # Convert the exclude list to an associative array.