Commit 6b19775b authored by Tomasz Zawadzki's avatar Tomasz Zawadzki Committed by Jim Harris
Browse files

test/common: fail the tests if get_nvme_bdfs() returns no devices



Usual way to call get_nvme_bdfs() is to iterate over resulting bdfs.
When no bdfs are returned, most of the scripts do no not execute tests
at all and assume success.

Instead of adding error checking for each and every script for no bdfs,
this patch makes get_nvme_bdfs() exit with test failure.

This assumes that there will never be a test that expects no devices
to be present.

Signed-off-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I1e41a885c76ce6cc248fb076bc4f4efd4695ff3c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/2836


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarMaciej Wawryk <maciejx.wawryk@intel.com>
Reviewed-by: default avatarKarol Latecki <karol.latecki@intel.com>
parent 9798e12b
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -1240,7 +1240,12 @@ function opal_revert_cleanup() {
# uio-pci-generic or vfio-pci
function get_nvme_bdfs() {
	xtrace_disable
	jq -r .config[].params.traddr <<< $($rootdir/scripts/gen_nvme.sh --json)
	bdfs=$(jq -r .config[].params.traddr <<< $($rootdir/scripts/gen_nvme.sh --json))
	if [[ -z $bdfs ]]; then
		echo "No devices to test on!"
		exit 1
	fi
	echo "$bdfs"
	xtrace_restore
}