From 14d4c7f06da2bb8eb82b8865aa9f909657c72101 Mon Sep 17 00:00:00 2001 From: Pawel Wodkowski Date: Thu, 7 Feb 2019 11:35:21 +0100 Subject: [PATCH] test/ftl: use OCSSD instead first NVMe like Change-Id: I175bebb68ea1752fda6fe80932cd27c30cf3dcff Signed-off-by: Pawel Wodkowski Reviewed-on: https://review.gerrithub.io/c/443737 (master) Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/447183 Tested-by: SPDK CI Jenkins Reviewed-by: Ben Walker Reviewed-by: Darek Stojaczyk --- autotest.sh | 3 +++ test/ftl/ftl.sh | 25 ++++++++++++++++--------- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/autotest.sh b/autotest.sh index cf638833d..f60f9c766 100755 --- a/autotest.sh +++ b/autotest.sh @@ -78,9 +78,12 @@ if [ $(uname -s) = Linux ]; then bdf="$(basename $(readlink -e /sys/class/nvme/${dev#/dev/}/device))" echo "INFO: blacklisting OCSSD device: $dev ($bdf)" PCI_BLACKLIST+=" $bdf" + OCSSD_PCI_DEVICES+=" $bdf" fi done + export OCSSD_PCI_DEVICES + # Now, bind blacklisted devices to pci-stub module. This will prevent # automatic grabbing these devices when we add device/vendor ID to # proper driver. diff --git a/test/ftl/ftl.sh b/test/ftl/ftl.sh index ea1f751a8..c7670fc87 100755 --- a/test/ftl/ftl.sh +++ b/test/ftl/ftl.sh @@ -7,20 +7,27 @@ rootdir=$(readlink -f $testdir/../..) source $rootdir/test/common/autotest_common.sh -function ftl_kill() { - rm -f $testdir/.testfile_* +function at_ftl_exit() { + # restore original driver + PCI_WHITELIST="$device" PCI_BLACKLIST="" DRIVER_OVERRIDE="$ocssd_original_dirver" ./scripts/setup.sh } -vendor_id='0x1d1d' -device_id='0x1f1f' -device=$(lspci -d ${vendor_id}:${device_id} | cut -d' ' -f 1) +read device _ <<< "$OCSSD_PCI_DEVICES" -if [ -z "$device" ]; then - echo "Could not find FTL device. Tests skipped." - exit 0 +if [[ -z "$device" ]]; then + echo "OCSSD device list is empty." + echo "This test require that OCSSD_PCI_DEVICES environment variable to be set" + echo "and point to OCSSD devices PCI BDF. You can specify multiple space" + echo "separated BDFs in this case first one will be used." + exit 1 fi -trap "ftl_kill; exit 1" SIGINT SIGTERM EXIT +ocssd_original_dirver="$(basename $(readlink /sys/bus/pci/devices/$device/driver))" + +trap "at_ftl_exit" SIGINT SIGTERM EXIT + +# OCSSD is blacklisted so bind it to vfio/uio driver before testing +PCI_WHITELIST="$device" PCI_BLACKLIST="" DRIVER_OVERRIDE="" ./scripts/setup.sh timing_enter ftl timing_enter fio