Commit 22f65e47 authored by cunyinch's avatar cunyinch Committed by Jim Harris
Browse files

test/nvme: detect the online NVMe devices before the setup.sh.



This patch remove the fixed delay time before the setup.sh, make sure the test
could keep go on as soon as all the NVMe devices get online.

Change-Id: I42b49f9b1dc79690aabb3f1a855fecf28a570aba
Signed-off-by: default avatarcunyinch <cunyin.chang@intel.com>
Reviewed-on: https://review.gerrithub.io/365742


Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
parent 4f2d6a2f
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -20,6 +20,19 @@ function monitor_cmd() {
	return $rc
}

function get_online_devices_count() {
	ssh_vm "lspci | grep "NVM" | wc -l"
}

function wait_for_devices_ready() {
	count=$(get_online_devices_count)

	while [ "$count" -ne "4" ]; do
		echo "waitting for all devices online"
		count=$(get_online_devices_count)
	done
}

function devices_initialization() {
	timing_enter devices_initialization
	dd if=/dev/zero of=/root/test0 bs=1M count=1024
@@ -38,7 +51,7 @@ function insert_devices() {
	monitor_cmd "device_add nvme,drive=drive1,id=nvme1,serial=nvme1"
	monitor_cmd "device_add nvme,drive=drive2,id=nvme2,serial=nvme2"
	monitor_cmd "device_add nvme,drive=drive3,id=nvme3,serial=nvme3"
	sleep 5
	wait_for_devices_ready
	ssh_vm "scripts/setup.sh"
}