Skip to content
Permalink
Browse files

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 <lundman@lundman.net>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: John Kennedy <john.kennedy@delphix.com>
Signed-off-by: Ryan Moeller <ryan@ixsystems.com>
Closes #9391
  • Loading branch information...
freqlabs authored and behlendorf committed Oct 9, 2019
1 parent ca57777 commit 5e74ac51c70ee978e338e828f05377092d0637d4
Showing with 1,036 additions and 949 deletions.
  1. +28 −20 scripts/zfs-tests.sh
  2. +2 −2 tests/README.md
  3. +1 −0 tests/runfiles/Makefile.am
  4. +907 −0 tests/runfiles/common.run
  5. +35 −879 tests/runfiles/linux.run
  6. +63 −48 tests/test-runner/bin/test-runner.py
@@ -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}
@@ -91,7 +91,7 @@ The following zfs-tests.sh options are supported:

-s SIZE Use vdevs of SIZE (default: 4G)

-r RUNFILE Run tests in RUNFILE (default: linux.run)
-r RUNFILES Run tests in RUNFILES (default: common.run,linux.run)

-t PATH Run single test at PATH relative to test suite

@@ -149,4 +149,4 @@ with the `zfs-tests.sh` wrapper script will look something like this:

Running Time: 02:35:33
Percent passed: 95.6%
Log directory: /var/tmp/test_results/20180515T054509
Log directory: /var/tmp/test_results/20180515T054509
@@ -1,5 +1,6 @@
pkgdatadir = $(datadir)/@PACKAGE@/runfiles
dist_pkgdata_DATA = \
common.run \
linux.run \
longevity.run \
perf-regression.run

0 comments on commit 5e74ac5

Please sign in to comment.
You can’t perform that action at this time.