mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2025-01-26 18:04:22 +03:00
Allow zfs-tests to run a single test
Add a -t flag to zfs-tests to allow a user to run a single test by providing the path to the test relative to STF_SUITE. Reviewed-by: George Melikov <mail@gmelikov.ru> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Giuseppe Di Natale <dinatale2@llnl.gov> Closes #5775
This commit is contained in:
parent
6d82f98c3d
commit
d8fa599fab
@ -43,6 +43,8 @@ FILESIZE="4G"
|
|||||||
RUNFILE=${RUNFILE:-"linux.run"}
|
RUNFILE=${RUNFILE:-"linux.run"}
|
||||||
FILEDIR=${FILEDIR:-/var/tmp}
|
FILEDIR=${FILEDIR:-/var/tmp}
|
||||||
DISKS=${DISKS:-""}
|
DISKS=${DISKS:-""}
|
||||||
|
SINGLETEST=()
|
||||||
|
SINGLETESTUSER="root"
|
||||||
|
|
||||||
#
|
#
|
||||||
# Attempt to remove loopback devices and files which where created earlier
|
# Attempt to remove loopback devices and files which where created earlier
|
||||||
@ -167,6 +169,8 @@ OPTIONS:
|
|||||||
-d DIR Use DIR for files and loopback devices
|
-d DIR Use DIR for files and loopback devices
|
||||||
-s SIZE Use vdevs of SIZE (default: 4G)
|
-s SIZE Use vdevs of SIZE (default: 4G)
|
||||||
-r RUNFILE Run tests in RUNFILE (default: linux.run)
|
-r RUNFILE Run tests in RUNFILE (default: linux.run)
|
||||||
|
-t PATH Run single test at PATH
|
||||||
|
-u USER Run single test as USER (default: root)
|
||||||
|
|
||||||
EXAMPLES:
|
EXAMPLES:
|
||||||
# Run the default (linux) suite of tests and output the configuration used.
|
# Run the default (linux) suite of tests and output the configuration used.
|
||||||
@ -182,7 +186,7 @@ $0 -x
|
|||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
while getopts 'hvqxkfd:s:r:?' OPTION; do
|
while getopts 'hvqxkfd:s:r:?t:u:' OPTION; do
|
||||||
case $OPTION in
|
case $OPTION in
|
||||||
h)
|
h)
|
||||||
usage
|
usage
|
||||||
@ -212,6 +216,15 @@ while getopts 'hvqxkfd:s:r:?' OPTION; do
|
|||||||
r)
|
r)
|
||||||
RUNFILE="$OPTARG"
|
RUNFILE="$OPTARG"
|
||||||
;;
|
;;
|
||||||
|
t)
|
||||||
|
if [ ${#SINGLETEST[@]} -ne 0 ]; then
|
||||||
|
fail "-t can only be provided once."
|
||||||
|
fi
|
||||||
|
SINGLETEST+=("$OPTARG")
|
||||||
|
;;
|
||||||
|
u)
|
||||||
|
SINGLETESTUSER="$OPTARG"
|
||||||
|
;;
|
||||||
?)
|
?)
|
||||||
usage
|
usage
|
||||||
exit
|
exit
|
||||||
@ -224,6 +237,51 @@ shift $((OPTIND-1))
|
|||||||
FILES=${FILES:-"$FILEDIR/file-vdev0 $FILEDIR/file-vdev1 $FILEDIR/file-vdev2"}
|
FILES=${FILES:-"$FILEDIR/file-vdev0 $FILEDIR/file-vdev1 $FILEDIR/file-vdev2"}
|
||||||
LOOPBACKS=${LOOPBACKS:-""}
|
LOOPBACKS=${LOOPBACKS:-""}
|
||||||
|
|
||||||
|
if [ ${#SINGLETEST[@]} -ne 0 ]; then
|
||||||
|
RUNFILEDIR="/var/tmp"
|
||||||
|
RUNFILE="zfs-tests.$$.run"
|
||||||
|
SINGLEQUIET="False"
|
||||||
|
|
||||||
|
if [ -n "$QUIET" ]; then
|
||||||
|
SINGLEQUIET="True"
|
||||||
|
fi
|
||||||
|
|
||||||
|
cat >$RUNFILEDIR/$RUNFILE << EOF
|
||||||
|
[DEFAULT]
|
||||||
|
pre =
|
||||||
|
quiet = $SINGLEQUIET
|
||||||
|
pre_user = root
|
||||||
|
user = $SINGLETESTUSER
|
||||||
|
timeout = 600
|
||||||
|
post_user = root
|
||||||
|
post =
|
||||||
|
outputdir = /var/tmp/test_results
|
||||||
|
EOF
|
||||||
|
for t in "${SINGLETEST[@]}"
|
||||||
|
do
|
||||||
|
SINGLETESTDIR=$(dirname "$t")
|
||||||
|
SINGLETESTFILE=$(basename "$t")
|
||||||
|
SETUPSCRIPT=
|
||||||
|
CLEANUPSCRIPT=
|
||||||
|
|
||||||
|
if [ -f "$SINGLETESTDIR/setup.ksh" ]; then
|
||||||
|
SETUPSCRIPT="setup"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f "$SINGLETESTDIR/cleanup.ksh" ]; then
|
||||||
|
CLEANUPSCRIPT="cleanup"
|
||||||
|
fi
|
||||||
|
|
||||||
|
cat >>$RUNFILEDIR/$RUNFILE << EOF
|
||||||
|
|
||||||
|
[$SINGLETESTDIR]
|
||||||
|
tests = ['$SINGLETESTFILE']
|
||||||
|
pre = $SETUPSCRIPT
|
||||||
|
post = $CLEANUPSCRIPT
|
||||||
|
EOF
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
#
|
#
|
||||||
# Attempt to locate the runfile describing the test workload.
|
# Attempt to locate the runfile describing the test workload.
|
||||||
#
|
#
|
||||||
@ -350,4 +408,8 @@ ${TEST_RUNNER} ${QUIET} -c ${RUNFILE} -i ${STF_SUITE}
|
|||||||
RESULT=$?
|
RESULT=$?
|
||||||
echo
|
echo
|
||||||
|
|
||||||
|
if [ ${#SINGLETEST[@]} -ne 0 ]; then
|
||||||
|
rm -f "$RUNFILEDIR/$RUNFILE" &>/dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
exit ${RESULT}
|
exit ${RESULT}
|
||||||
|
Loading…
Reference in New Issue
Block a user