## Configuration
Test configuration goes in the `config` file at the top-level directory of the
-blktests repository.
+blktests repository. Test configuration options can also be set as environment
+variables instead of in the `config` file.
### Test Devices
```
If `TEST_DEVS` is not defined or is empty, only tests which do not require a
-device will be run.
+device will be run. If `TEST_DEVS` is defined as a normal variable instead of
+an array, it will be converted to an array by splitting on whitespace.
### Excluding Tests
Tests specified explicitly on the command line will always run even if they are
in `EXCLUDE`.
+If `EXCLUDE` is defined as a normal variable instead of an array, it will be
+converted to an array by splitting on whitespace.
+
### Quick Runs and Test Timeouts
Many tests can take a long time to run. By setting the `TIMEOUT` variable, you
eval set -- "$TEMP"
unset TEMP
-# Default configuration.
-DEVICE_ONLY=0
-QUICK_RUN=0
-EXCLUDE=()
-TEST_DEVS=()
-
if [[ -r config ]]; then
# shellcheck disable=SC1091
. config
fi
+# Default configuration.
+: "${DEVICE_ONLY:=0}"
+: "${QUICK_RUN:=0}"
+if [[ -v EXCLUDE ]] && ! declare -p EXCLUDE | grep -q '^declare -a'; then
+ # If EXCLUDE was not defined as an array, convert it to one.
+ # shellcheck disable=SC2190,SC2206
+ EXCLUDE=($EXCLUDE)
+elif [[ ! -v EXCLUDE ]]; then
+ EXCLUDE=()
+fi
+if [[ -v TEST_DEVS ]] && ! declare -p TEST_DEVS | grep -q '^declare -a'; then
+ # If TEST_DEVS was not defined as an array, convert it to one.
+ # shellcheck disable=SC2206
+ TEST_DEVS=($TEST_DEVS)
+else
+ TEST_DEVS=()
+fi
+
while true; do
case "$1" in
'-d'|'--device-only')