KVM produces label-less pmem regions causing these tests to fail. Skip these tests when the NFIT does not describe aliased BLK + PMEM.
Signed-off-by: Dan Williams <[email protected]> --- test/blk_namespaces.c | 17 +++++++++++++++++ test/pmem_namespaces.c | 18 ++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/test/blk_namespaces.c b/test/blk_namespaces.c index 0ef5b65fd511..2e25c19b2f59 100644 --- a/test/blk_namespaces.c +++ b/test/blk_namespaces.c @@ -28,6 +28,13 @@ #include <linux/version.h> #include <test.h> #include <libkmod.h> +#include <ccan/array_size/array_size.h> + +#ifdef HAVE_NDCTL_H +#include <linux/ndctl.h> +#else +#include <ndctl.h> +#endif /* The purpose of this test is to verify that we can successfully do I/O to * multiple nd_blk namespaces that have discontiguous segments. It first @@ -229,6 +236,16 @@ int test_blk_namespaces(int log_level, struct ndctl_test *test) ndctl_set_log_priority(ctx, log_level); bus = ndctl_bus_get_by_provider(ctx, "ACPI.NFIT"); + if (bus) { + /* skip this bus if no BLK regions */ + ndctl_region_foreach(bus, region) + if (ndctl_region_get_nstype(region) + == ND_DEVICE_NAMESPACE_BLK) + break; + if (!region) + bus = NULL; + } + if (!bus) { fprintf(stderr, "ACPI.NFIT unavailable falling back to nfit_test\n"); kmod_ctx = kmod_new(NULL, NULL); diff --git a/test/pmem_namespaces.c b/test/pmem_namespaces.c index 387c5e011f66..8edfaba2d7f3 100644 --- a/test/pmem_namespaces.c +++ b/test/pmem_namespaces.c @@ -29,6 +29,14 @@ #include <linux/version.h> #include <test.h> +#include <ccan/array_size/array_size.h> + +#ifdef HAVE_NDCTL_H +#include <linux/ndctl.h> +#else +#include <ndctl.h> +#endif + #define err(msg)\ fprintf(stderr, "%s:%d: %s (%s)\n", __func__, __LINE__, msg, strerror(errno)) @@ -192,6 +200,16 @@ int test_pmem_namespaces(int log_level, struct ndctl_test *test) ndctl_set_log_priority(ctx, log_level); bus = ndctl_bus_get_by_provider(ctx, "ACPI.NFIT"); + if (bus) { + /* skip this bus if no label-enabled PMEM regions */ + ndctl_region_foreach(bus, region) + if (ndctl_region_get_nstype(region) + == ND_DEVICE_NAMESPACE_PMEM) + break; + if (!region) + bus = NULL; + } + if (!bus) { fprintf(stderr, "ACPI.NFIT unavailable falling back to nfit_test\n"); kmod_ctx = kmod_new(NULL, NULL); _______________________________________________ Linux-nvdimm mailing list [email protected] https://lists.01.org/mailman/listinfo/linux-nvdimm
