Commit c8802892 authored by Krzysztof Karas's avatar Krzysztof Karas Committed by Tomasz Zawadzki
Browse files

hotplug: rename and refactor hotplug.sh



Rename hotplug.sh to sw_hotplug.sh (software hotplug)
and refactor its code in preparation for new software
based hotplug test.

Signed-off-by: default avatarMaciej Szwed <maciej.szwed@intel.com>
Change-Id: I751fc60ee013de341e064c83f0be3a9b404008e7
Signed-off-by: default avatarKrzysztof Karas <krzysztof.karas@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8834


Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
parent d66bb2d1
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -212,8 +212,8 @@ if [ $SPDK_RUN_FUNCTIONAL_TEST -eq 1 ]; then
		# Only test hotplug without ASAN enabled. Since if it is
		# enabled, it catches SEGV earlier than our handler which
		# breaks the hotplug logic.
		if [ $SPDK_RUN_ASAN -eq 0 ]; then
			run_test "nvme_hotplug" test/nvme/hotplug.sh
		if [ $SPDK_RUN_ASAN -eq 0 ] && [ $(uname -s) = Linux ]; then
			run_test "sw_hotplug" test/nvme/sw_hotplug.sh
		fi
	fi

+15 −13
Original line number Diff line number Diff line
@@ -2,10 +2,10 @@

testdir=$(readlink -f $(dirname $0))
rootdir=$(readlink -f $testdir/../..)
source $rootdir/scripts/common.sh
source $rootdir/test/common/autotest_common.sh

[[ $(uname -s) == Linux ]] || exit 0

# Pci bus hotplug
cleanup() {
	[[ -e /proc/$hotplug_pid/status ]] || return 0
	kill "$hotplug_pid"
@@ -41,9 +41,19 @@ remove_attach_helper() {
	done
}

hotplug() {
run_hotplug() {
	"$rootdir/scripts/setup.sh"

	local hotplug_events=3
	local hotplug_wait=6 # This should be enough for more stubborn nvmes in the CI
	local nvmes=($(nvme_in_userspace))
	local nvme_count=${#nvmes[@]}

	xtrace_disable
	cache_pci_bus_sysfs
	xtrace_restore

	trap "cleanup" EXIT

	remove_attach_helper "$hotplug_events" "$hotplug_wait" &
	hotplug_pid=$!
@@ -56,13 +66,5 @@ hotplug() {
		-l warning
}

"$rootdir/scripts/setup.sh"
nvmes=($(nvme_in_userspace)) nvme_count=${#nvmes[@]}

xtrace_disable
cache_pci_bus_sysfs
xtrace_restore

trap "cleanup" EXIT

hotplug
# Run pci bus hotplug test
run_hotplug