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: cunyinch <cunyin.chang@intel.com>
Reviewed-on: https://review.gerrithub.io/365742
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
cunyinch 2017-06-16 10:36:26 +08:00 committed by Jim Harris
parent 4f2d6a2fc9
commit 22f65e474d

View File

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