Lines Matching +full:qemu +full:- +full:1 +full:- +full:setup
2 # SPDX-License-Identifier: CDDL-1.0
14 # or https://opensource.org/licenses/CDDL-1.0.
31 SCRIPT_COMMON=${SCRIPT_COMMON:-${0%/*}/common.sh}
34 PROG=zfs-tests.sh
46 RUNFILES=${RUNFILES:-$DEFAULT_RUNFILES}
47 FILEDIR=${FILEDIR:-/var/tmp}
48 DISKS=${DISKS:-""}
52 ITERATIONS=1
61 TESTFAIL_CALLBACKS=${TESTFAIL_CALLBACKS:-"$ZFS_DMESG"}
66 TESTFAIL_CALLBACKS=${TESTFAIL_CALLBACKS:-"$ZFS_DBGMSG:$ZFS_DMESG:$ZFS_MMP"}
67 LOSETUP=${LOSETUP:-/sbin/losetup}
68 DMSETUP=${DMSETUP:-/sbin/dmsetup}
84 echo "$PROG: $1" >&2
86 exit 1
91 if [ -c "/dev/${TEST_LOOPBACK}" ]; then
92 sudo "${LOSETUP}" -d -u "${TEST_LOOPBACK}" ||
102 awk -v l="${LOOP_DEV}" '$0 ~ l {print $1}')
104 if [ -n "$DM_DEV" ]; then
109 if [ -n "${TEST_LOOPBACK}" ]; then
110 sudo "${LOSETUP}" -d "${TEST_LOOPBACK}" ||
118 # by this script to run the test framework. The '-k' option may be passed
136 rm -f ${FILES} >/dev/null 2>&1
138 if [ "$STF_PATH_REMOVE" = "yes" ] && [ -d "$STF_PATH" ]; then
139 rm -Rf "$STF_PATH"
151 TEST_POOLS=$(ASAN_OPTIONS=detect_leaks=false "$ZPOOL" list -Ho name | grep testpool)
153 TEST_LOOPBACKS=$(sudo "${LOSETUP}" -l)
155 TEST_LOOPBACKS=$("${LOSETUP}" -a | awk -F: '/file-vdev/ {print $1}')
157 TEST_FILES=$(ls "${FILEDIR}"/file-vdev* 2>/dev/null)
160 msg "--- Cleanup ---"
177 sudo "${LOSETUP}" -d -u "${TEST_LOOPBACK}"
179 sudo "${LOSETUP}" -d "${TEST_LOOPBACK}"
186 sudo rm -f ${TEST_FILES}
199 NAME=$1
201 if [ -f "$RUNFILE_DIR/$NAME" ]; then
203 elif [ -f "$RUNFILE_DIR/$NAME.run" ]; then
205 elif [ -f "$NAME" ]; then
207 elif [ -f "$NAME.run" ]; then
210 return 1
214 # Given a TAGS with a format like "1/3" or "2/3" then divide up the test list
215 # into portions and print that portion. So "1/3" for "the first third of the
221 NUM=$(echo "$TAGS" | cut -d/ -f1)
222 DEN=$(echo "$TAGS" | cut -d/ -f2)
226 # "/home/hutter/qemu/tests/runfiles/common.run,/home/hutter/qemu/tests/runfiles/linux.run"
230 # 1. Remove unneeded chars: [],\
234 # in multiple runfiles, then when you do '-T <tag>' ZTS is smart
235 # enough to know to run the tag in each runfile. So '-T zpool_add'
239 # so "1/3" will run tests 1,3,6,9 etc. That way the tests are
251 cat $_RUNFILES | tr -d "[],\'" | awk '/tags = /{print $NF}' | sort | \
252 uniq | grep -v functional | \
253 awk -v num="$NUM" -v den="$DEN" '{ if(NR % den == (num - 1)) {printf "%s,",$0}}' | \
254 sed -E 's/,$//'
261 dir_list="$1"
264 [ -n "$STF_PATH" ] || fail "STF_PATH wasn't correctly set"
268 [ ! -e "$STF_PATH/$i" ] || continue
270 if [ ! -d "$j/$i" ] && [ -e "$j/$i" ]; then
271 ln -sf "$j/$i" "$STF_PATH/$i" || \
277 [ ! -e "$STF_PATH/$i" ] && \
285 # When running in-tree a top level ./bin/ directory is created for
298 # Constrained path set to $(top_builddir)/tests/zfs-tests/bin
302 if [ ! -d "$STF_PATH" ]; then
311 create_links "$CMD_DIR/tests/zfs-tests/cmd" "$ZFSTEST_FILES"
314 SYSTEMDIR=${SYSTEMDIR:-$FILEDIR/constrained_path.XXXXXX}
315 STF_PATH=$(mktemp -d "$SYSTEMDIR")
339 ln -fs /sbin/fsck.ext4 "$STF_PATH/fsck"
340 ln -fs /sbin/mkfs.ext4 "$STF_PATH/newfs"
341 ln -fs "$STF_PATH/gzip" "$STF_PATH/compress"
342 ln -fs "$STF_PATH/gunzip" "$STF_PATH/uncompress"
344 ln -fs /usr/local/bin/ksh93 "$STF_PATH/ksh"
354 $0 [-hvqxkfS] [-s SIZE] [-r RUNFILES] [-t PATH] [-u USER]
360 -h Show this message
361 -v Verbose zfs-tests.sh output
362 -q Quiet test-runner output
363 -D Debug; show all test output immediately (noisy)
364 -x Remove all testpools, dm, lo, and files (unsafe)
365 -k Disable cleanup after test failure
366 -K Log test names to /dev/kmsg
367 -f Use files only, disables block device tests
368 -O Dump debugging info to /dev/kmsg on test timeout
369 -S Enable stack tracer (negative performance impact)
370 -c Only create and populate constrained path
371 -R Automatically rerun failing tests
372 -m Enable kmemleak reporting (Linux only)
373 -n NFSFILE Use the nfsfile to determine the NFS configuration
374 -I NUM Number of iterations
375 -d DIR Use world-writable DIR for files and loopback devices
376 -s SIZE Use vdevs of SIZE (default: 4G)
377 -r RUNFILES Run tests in RUNFILES (default: ${DEFAULT_RUNFILES})
378 -t PATH|NAME Run single test at PATH relative to test suite,
380 -T TAGS Comma separated list of tags (default: 'functional')
381 Alternately, specify a fraction like "1/3" or "2/3" to
385 -u USER Run single test as USER (default: root)
389 $0 -v
392 $0 -r linux-fast
395 $0 -t tests/functional/cli_root/zfs_bookmark/zfs_bookmark_cliargs.ksh
398 $0 -t zfs_bookmark_cliargs
402 $0 -x
411 exit 1
446 [ -f "$nfsfile" ] || fail "Cannot read file: $nfsfile"
447 export NFS=1
461 if [ "$ITERATIONS" -le 0 ]; then
472 if [ -n "$SINGLETEST" ]; then
473 fail "-t can only be provided once."
492 shift $((OPTIND-1))
494 FILES=${FILES:-"$FILEDIR/file-vdev0 $FILEDIR/file-vdev1 $FILEDIR/file-vdev2"}
495 LOOPBACKS=${LOOPBACKS:-""}
497 if [ -n "$SINGLETEST" ]; then
498 if [ -n "$TAGS" ]; then
499 fail "-t and -T are mutually exclusive."
502 RUNFILES="zfs-tests.$$.run"
503 [ -n "$QUIET" ] && SINGLEQUIET="True" || SINGLEQUIET="False"
516 NEWSINGLETEST=$(find "$STF_SUITE" -name "$SINGLETEST*" -print -quit)
517 if [ -z "$NEWSINGLETEST" ] ; then
526 [ -x "$SETUPDIR/setup.ksh" ] && SETUPSCRIPT="setup" || SETUPSCRIPT=
527 [ -x "$SETUPDIR/cleanup.ksh" ] && CLEANUPSCRIPT="cleanup" || CLEANUPSCRIPT=
553 if [ -n "$RUNFILE" ]; then
560 if [ ! -r "$RUNFILE" ]; then
569 # "1/3": Run first one third of all tests in runfiles
576 # "1/3" to a comma separate taglist, like:
580 if echo "$TAGS" | grep -Eq '^[0-9]+/[0-9]+$' ; then
589 if [ "$(id -u)" = "0" ]; then
593 if [ "$(sudo id -un)" != "root" ]; then
606 sudo ln -fs /usr/local/bin/ksh93 /bin/ksh
608 [ -e "$STF_PATH/ksh" ] || fail "This test suite requires ksh."
609 [ -e "$STF_SUITE/include/default.cfg" ] || fail \
616 sudo "${ZFS_SH}" -S >/dev/null 2>&1
618 sudo "${ZFS_SH}" >/dev/null 2>&1
631 if [ -z "${KEEP}" ]; then
632 KEEP="$(ASAN_OPTIONS=detect_leaks=false "$ZPOOL" list -Ho name | tr -s '[:space:]' ' ')"
633 if [ -z "${KEEP}" ]; then
637 KEEP="$(echo "$KEEP" | tr -s '[:space:]' ' ')"
644 # __ZFS_POOL_EXCLUDE - don't iterate over the pools it lists
645 # __ZFS_POOL_RESTRICT - iterate only over the pools it lists
657 if [ -z "${DISKS}" ]; then
669 [ -f "$TEST_FILE" ] && fail "Failed file exists: ${TEST_FILE}"
670 truncate -s "${FILESIZE}" "${TEST_FILE}" ||
675 # If requested setup loopback devices backed by the sparse files.
678 test -x "$LOSETUP" || fail "$LOSETUP utility must be installed"
682 MDDEVICE=$(sudo "${LOSETUP}" -a -t vnode -f "${TEST_FILE}")
683 if [ -z "$MDDEVICE" ] ; then
684 fail "Failed: ${TEST_FILE} -> loopback"
689 TEST_LOOPBACK=$(sudo "${LOSETUP}" --show -f "${TEST_FILE}") ||
690 fail "Failed: ${TEST_FILE} -> ${TEST_LOOPBACK}"
709 [ "$NUM_DISKS" -lt 3 ] && fail "Not enough disks ($NUM_DISKS/3 minimum)"
715 if command -v setenforce >/dev/null; then
716 sudo setenforce permissive >/dev/null 2>&1
722 if [ -e /sys/module/zfs/parameters/zfs_dbgmsg_enable ]; then
723 sudo sh -c "echo 1 >/sys/module/zfs/parameters/zfs_dbgmsg_enable"
724 sudo sh -c "echo 0 >/proc/spl/kstat/zfs/dbgmsg"
734 msg "--- Configuration ---"
764 mktemp -u "${FILEDIR}/$1.XXXXXX"
766 mktemp -ut "$1.XXXXXX" -p "$FILEDIR"
769 mkdir -p "$FILEDIR" || :
770 RESULTS_FILE=$(mktemp_file zts-results)
771 REPORT_FILE=$(mktemp_file zts-report)
777 "${QUIET:+-q}" \
778 "${DEBUG:+-D}" \
779 "${KMEMLEAK:+-m}" \
780 "${KMSG:+-K}" \
781 "${TIMEOUT_DEBUG:+-O}" \
782 "-c \"${RUNFILES}\"" \
783 "-T \"${TAGS}\"" \
784 "-i \"${STF_SUITE}\"" \
785 "-I \"${ITERATIONS}\""
788 ${QUIET:+-q} \
789 ${DEBUG:+-D} \
790 ${KMEMLEAK:+-m} \
791 ${KMSG:+-K} \
792 ${TIMEOUT_DEBUG:+-O} \
793 -c "${RUNFILES}" \
794 -T "${TAGS}" \
795 -i "${STF_SUITE}" \
796 -I "${ITERATIONS}" \
797 2>&1; echo $? >"$REPORT_FILE"; } | tee "$RESULTS_FILE"
798 read -r RUNRESULT <"$REPORT_FILE"
800 if [[ "$RUNRESULT" -eq "255" ]] ; then
807 ${ZTS_REPORT} ${RERUN:+--no-maybes} "$RESULTS_FILE" >"$REPORT_FILE"
810 if [ "$RESULT" -eq "2" ] && [ -n "$RERUN" ]; then
811 MAYBES="$($ZTS_REPORT --list-maybes)"
812 TEMP_RESULTS_FILE=$(mktemp_file zts-results-tmp)
813 TEST_LIST=$(mktemp_file test-list)
820 ${QUIET:+-q} \
821 ${DEBUG:+-D} \
822 ${KMEMLEAK:+-m} \
823 -c "${RUNFILES}" \
824 -T "${TAGS}" \
825 -i "${STF_SUITE}" \
826 -I "${ITERATIONS}" \
827 -l "${TEST_LIST}" \
828 2>&1; echo $? >"$REPORT_FILE"; } | tee "$RESULTS_FILE"
829 read -r RUNRESULT <"$REPORT_FILE"
833 ${ZTS_REPORT} --no-maybes "$RESULTS_FILE" >"$REPORT_FILE"
841 if [ -d "$RESULTS_DIR" ]; then
845 rm -f "$RESULTS_FILE" "$REPORT_FILE" "$TEST_LIST" "$TEMP_RESULTS_FILE"
847 if [ -n "$SINGLETEST" ]; then
848 rm -f "$RUNFILES" >/dev/null 2>&1
851 [ "$RUNRESULT" -gt 3 ] && exit "$RUNRESULT" || exit "$RESULT"