Not all transport support the same features thus we need to be able to
express this. Add a transport require check which can be runtime
parameterized.
While at it also update the existing helpers to test for trtype to with
an explicit list of transport types.
Signed-off-by: Daniel Wagner <dwagner@suse.de>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
return 0
}
+_require_nvme_trtype() {
+ local trtype
+ for trtype in "$@"; do
+ if [[ "${nvme_trtype}" == "$trtype" ]]; then
+ return 0
+ fi
+ done
+ SKIP_REASONS+=("nvme_trtype=${nvme_trtype} is not supported in this test")
+ return 1
+}
+
_require_nvme_trtype_is_loop() {
- if [[ "${nvme_trtype}" != "loop" ]]; then
- SKIP_REASONS+=("nvme_trtype=${nvme_trtype} is not supported in this test")
+ if ! _require_nvme_trtype loop; then
return 1
fi
return 0
}
_require_nvme_trtype_is_fabrics() {
- if [[ "${nvme_trtype}" == "pci" ]]; then
- SKIP_REASONS+=("nvme_trtype=${nvme_trtype} is not supported in this test")
+ if ! _require_nvme_trtype loop fc rdma tcp; then
return 1
fi
return 0