Commit 76a2663e authored by Michal Berger's avatar Michal Berger Committed by Konrad Sztyber
Browse files

test/common: use vhost's at_app_exit() during cleanup



This function can be used to kill all lingering vhost and qemu
processes that might have been left behind by vfio-user|vhost
tests.

Signed-off-by: default avatarMichal Berger <michal.berger@intel.com>
Change-Id: I17121f416e26732d53b5dfec0f010e5db8bd369f
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15186


Reviewed-by: default avatarKrzysztof Karas <krzysztof.karas@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
parent b76cb37c
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -1332,12 +1332,19 @@ function autotest_cleanup() {
	local autotest_es=$?
	xtrace_disable

	# Slurp at_app_exit() so we can kill all lingering vhost and qemu processes
	# in one swing. We do this in a subshell as vhost/common.sh is too eager to
	# do some extra work which we don't care about in this context.
	# shellcheck source=/dev/null
	vhost_reap() (source "$rootdir/test/vhost/common.sh" || return 0 && at_app_exit)

	# catch any stray core files and kill all remaining SPDK processes. Update
	# autotest_es in case autotest reported success but cores and/or processes
	# were left behind regardless.

	process_core || autotest_es=1
	reap_spdk_processes || autotest_es=1
	vhost_reap || autotest_es=1

	$rootdir/scripts/setup.sh reset
	$rootdir/scripts/setup.sh cleanup
+1 −1
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@ WORKDIR=$(readlink -f "$(dirname "$0")")

if ! hash $QEMU_IMG_BIN $QEMU_BIN; then
	echo 'ERROR: QEMU is not installed on this system. Unable to run vhost tests.' >&2
	exit 1
	return 1
fi

mkdir -p $VHOST_DIR