aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/zfs-tests.sh
diff options
context:
space:
mode:
authorRyan Moeller <[email protected]>2019-10-09 13:39:26 -0400
committerBrian Behlendorf <[email protected]>2019-10-09 10:39:26 -0700
commit5e74ac51c70ee978e338e828f05377092d0637d4 (patch)
tree7182de383e8467e4a07481dbdc59cd0739cd4990 /scripts/zfs-tests.sh
parentca5777793ee10b9f7bb57aef00a6c8d57969625e (diff)
Move platform independent tests to a shared runfile
Tests that aren't limited to running on Linux can be moved to a common runfile to be shared with other platforms. The test runner and wrapper script are enhanced to allow specifying multiple runfiles as a comma-separated list. The default runfiles are now "common.run,PLATFORM.run" where PLATFORM is determined at run time. Sections in runfiles that share a path with another runfile can append a colon separator and an identifier to the path in the section name, ie `[tests/functional/atime:Linux]`, to avoid overriding the tests specified by other runfiles. Reviewed-by: Jorgen Lundman <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: John Kennedy <[email protected]> Signed-off-by: Ryan Moeller <[email protected]> Closes #9391
Diffstat (limited to 'scripts/zfs-tests.sh')
-rwxr-xr-xscripts/zfs-tests.sh48
1 files changed, 28 insertions, 20 deletions
diff --git a/scripts/zfs-tests.sh b/scripts/zfs-tests.sh
index ce766e239..1610d4a57 100755
--- a/scripts/zfs-tests.sh
+++ b/scripts/zfs-tests.sh
@@ -37,7 +37,8 @@ CLEANUPALL="no"
LOOPBACK="yes"
STACK_TRACER="no"
FILESIZE="4G"
-RUNFILE=${RUNFILE:-"linux.run"}
+DEFAULT_RUNFILES="common.run,$(uname | tr '[:upper:]' '[:lower:]').run"
+RUNFILES=${RUNFILES:-$DEFAULT_RUNFILES}
FILEDIR=${FILEDIR:-/var/tmp}
DISKS=${DISKS:-""}
SINGLETEST=()
@@ -259,7 +260,7 @@ constrain_path() {
usage() {
cat << EOF
USAGE:
-$0 [hvqxkfS] [-s SIZE] [-r RUNFILE] [-t PATH] [-u USER]
+$0 [hvqxkfS] [-s SIZE] [-r RUNFILES] [-t PATH] [-u USER]
DESCRIPTION:
ZFS Test Suite launch script
@@ -277,7 +278,7 @@ OPTIONS:
-I NUM Number of iterations
-d DIR Use DIR for files and loopback devices
-s SIZE Use vdevs of SIZE (default: 4G)
- -r RUNFILE Run tests in RUNFILE (default: linux.run)
+ -r RUNFILES Run tests in RUNFILES (default: ${DEFAULT_RUNFILES})
-t PATH Run single test at PATH relative to test suite
-T TAGS Comma separated list of tags (default: 'functional')
-u USER Run single test as USER (default: root)
@@ -344,7 +345,7 @@ while getopts 'hvqxkfScn:d:s:r:?t:T:u:I:' OPTION; do
FILESIZE="$OPTARG"
;;
r)
- RUNFILE="$OPTARG"
+ RUNFILES="$OPTARG"
;;
t)
if [ ${#SINGLETEST[@]} -ne 0 ]; then
@@ -375,14 +376,14 @@ if [ ${#SINGLETEST[@]} -ne 0 ]; then
fail "-t and -T are mutually exclusive."
fi
RUNFILE_DIR="/var/tmp"
- RUNFILE="zfs-tests.$$.run"
+ RUNFILES="zfs-tests.$$.run"
SINGLEQUIET="False"
if [ -n "$QUIET" ]; then
SINGLEQUIET="True"
fi
- cat >$RUNFILE_DIR/$RUNFILE << EOF
+ cat >$RUNFILE_DIR/$RUNFILES << EOF
[DEFAULT]
pre =
quiet = $SINGLEQUIET
@@ -408,7 +409,7 @@ EOF
CLEANUPSCRIPT="cleanup"
fi
- cat >>$RUNFILE_DIR/$RUNFILE << EOF
+ cat >>$RUNFILE_DIR/$RUNFILES << EOF
[$SINGLETESTDIR]
tests = ['$SINGLETESTFILE']
@@ -425,17 +426,24 @@ fi
TAGS=${TAGS:='functional'}
#
-# Attempt to locate the runfile describing the test workload.
+# Attempt to locate the runfiles describing the test workload.
#
-if [ -n "$RUNFILE" ]; then
- SAVED_RUNFILE="$RUNFILE"
- RUNFILE=$(find_runfile "$RUNFILE")
- [ -z "$RUNFILE" ] && fail "Cannot find runfile: $SAVED_RUNFILE"
-fi
+R=""
+IFS=,
+for RUNFILE in $RUNFILES; do
+ if [ -n "$RUNFILE" ]; then
+ SAVED_RUNFILE="$RUNFILE"
+ RUNFILE=$(find_runfile "$RUNFILE")
+ [ -z "$RUNFILE" ] && fail "Cannot find runfile: $SAVED_RUNFILE"
+ R+="${R:+,}${RUNFILE}"
+ fi
-if [ ! -r "$RUNFILE" ]; then
- fail "Cannot read runfile: $RUNFILE"
-fi
+ if [ ! -r "$RUNFILE" ]; then
+ fail "Cannot read runfile: $RUNFILE"
+ fi
+done
+unset IFS
+RUNFILES=$R
#
# This script should not be run as root. Instead the test user, which may
@@ -507,7 +515,7 @@ __ZFS_POOL_EXCLUDE="$(echo "$KEEP" | sed ':a;N;s/\n/ /g;ba')"
msg
msg "--- Configuration ---"
-msg "Runfile: $RUNFILE"
+msg "Runfiles: $RUNFILES"
msg "STF_TOOLS: $STF_TOOLS"
msg "STF_SUITE: $STF_SUITE"
msg "STF_PATH: $STF_PATH"
@@ -603,12 +611,12 @@ REPORT_FILE=$(mktemp -u -t zts-report.XXXX -p "$FILEDIR")
# Run all the tests as specified.
#
msg "${TEST_RUNNER} ${QUIET:+-q}" \
- "-c \"${RUNFILE}\"" \
+ "-c \"${RUNFILES}\"" \
"-T \"${TAGS}\"" \
"-i \"${STF_SUITE}\"" \
"-I \"${ITERATIONS}\""
${TEST_RUNNER} ${QUIET:+-q} \
- -c "${RUNFILE}" \
+ -c "${RUNFILES}" \
-T "${TAGS}" \
-i "${STF_SUITE}" \
-I "${ITERATIONS}" \
@@ -630,7 +638,7 @@ fi
rm -f "$RESULTS_FILE" "$REPORT_FILE"
if [ ${#SINGLETEST[@]} -ne 0 ]; then
- rm -f "$RUNFILE" &>/dev/null
+ rm -f "$RUNFILES" &>/dev/null
fi
exit ${RESULT}