From patchwork Wed Aug 3 23:23:21 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 9262331 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id AB39B6048F for ; Wed, 3 Aug 2016 23:25:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9CE5727FA1 for ; Wed, 3 Aug 2016 23:25:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 91C4028068; Wed, 3 Aug 2016 23:25:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1F7E927FA1 for ; Wed, 3 Aug 2016 23:25:50 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 1229E1A1DFF; Wed, 3 Aug 2016 16:25:50 -0700 (PDT) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by ml01.01.org (Postfix) with ESMTP id 0C34F1A1DFF for ; Wed, 3 Aug 2016 16:25:49 -0700 (PDT) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga103.fm.intel.com with ESMTP; 03 Aug 2016 16:25:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,468,1464678000"; d="scan'208";a="150241408" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.14]) by fmsmga004.fm.intel.com with ESMTP; 03 Aug 2016 16:25:46 -0700 Subject: [ndctl PATCH 3/4] test: skip pmem/blk-ns tests on KVM From: Dan Williams To: linux-nvdimm@lists.01.org Date: Wed, 03 Aug 2016 16:23:21 -0700 Message-ID: <147026660186.11162.5796906746157807312.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <147026658649.11162.4510254495491443980.stgit@dwillia2-desk3.amr.corp.intel.com> References: <147026658649.11162.4510254495491443980.stgit@dwillia2-desk3.amr.corp.intel.com> User-Agent: StGit/0.17.1-9-g687f MIME-Version: 1.0 X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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 #include #include +#include + +#ifdef HAVE_NDCTL_H +#include +#else +#include +#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 #include +#include + +#ifdef HAVE_NDCTL_H +#include +#else +#include +#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);