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: Michal Berger <michal.berger@intel.com>
Change-Id: I17121f416e26732d53b5dfec0f010e5db8bd369f
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15186
Reviewed-by: Krzysztof Karas <krzysztof.karas@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
This commit is contained in:
Michal Berger 2022-10-31 10:13:47 +01:00 committed by Konrad Sztyber
parent b76cb37ce4
commit 76a2663e43
2 changed files with 8 additions and 1 deletions

View File

@ -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

View File

@ -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