From: Omar Sandoval Date: Fri, 19 May 2017 18:35:34 +0000 (-0700) Subject: check: support QUICK_RUN, TIMEOUT, and EXCLUDED in config X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=4afefc7ec90c1cbbec3ec578f2d89614beea5ff6;p=users%2Fsagi%2Fblktests.git check: support QUICK_RUN, TIMEOUT, and EXCLUDED in config Signed-off-by: Omar Sandoval --- diff --git a/Documentation/running-tests.md b/Documentation/running-tests.md index c5035cc..ea2ce85 100644 --- a/Documentation/running-tests.md +++ b/Documentation/running-tests.md @@ -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 50de0e8..22dedec 100755 --- 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.