From b7d5bae1f37aea25b44665d245ccd21dfac2b014 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 Reviewed-by: Darek Stojaczyk Reviewed-by: Konrad Sztyber Reviewed-by: Ben Walker Tested-by: SPDK CI Jenkins --- autotest.sh | 3 +++ test/ftl/ftl.sh | 25 +++++++++++++++++++------ 2 files changed, 22 insertions(+), 6 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 bb9f56e56..21083bdd2 100755 --- a/test/ftl/ftl.sh +++ b/test/ftl/ftl.sh @@ -8,15 +8,28 @@ rpc_py=$rootdir/scripts/rpc.py source $rootdir/test/common/autotest_common.sh -vendor_id='0x1d1d' -device_id='0x1f1f' -device=$(lspci -d ${vendor_id}:${device_id} | cut -d' ' -f 1) +function at_ftl_exit() { + # restore original driver + PCI_WHITELIST="$device" PCI_BLACKLIST="" DRIVER_OVERRIDE="$ocssd_original_dirver" ./scripts/setup.sh +} -if [ -z "$device" ]; then - echo "Could not find FTL device. Tests skipped." - exit 0 +read device _ <<< "$OCSSD_PCI_DEVICES" + +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 +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