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

test/vhost: Attempt to verify vhost status upon termination



This is a bit problematic, since vhost_kill() operates on PID files,
meaning, that it may attempt to kill a process which doesn't belong
to the instance that's calling it. So to make it somewhat sensible,
we need to check first if vhost is our child - only then attempt
to verify it's status.

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


Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: default avatarJim Harris <jim.harris@samsung.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
parent f37d64d6
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -1662,6 +1662,16 @@ function get_zoned_devs() {
	done
}

function is_pid_child() {
	local pid=$1 _pid

	while read -r _pid; do
		((pid == _pid)) && return 0
	done < <(jobs -pr)

	return 1
}

# Define temp storage for all the tests. Look for 2GB at minimum
set_test_storage "${TEST_MIN_STORAGE_SIZE:-$((1 << 31))}"

+7 −0
Original line number Diff line number Diff line
@@ -240,6 +240,13 @@ function vhost_kill() {
				echo "."
			done
		fi
		# If this PID is our child, we should attempt to verify its status
		# to catch any "silent" crashes that may happen upon termination.
		if is_pid_child "$vhost_pid"; then
			notice "Checking status of $vhost_pid"
			wait "$vhost_pid" || rc=1
		fi

	elif kill -0 $vhost_pid; then
		error "vhost NOT killed - you need to kill it manually"
		rc=1