@@ -148,6 +148,36 @@ fi
AC_SUBST([BASH_COMPLETION_DIR])
AM_CONDITIONAL([ENABLE_BASH_COMPLETION], [test "x$with_bash" = "xyes"])
+AC_CANONICAL_HOST
+AS_CASE([$host_cpu],
+ [x86_64|arm*],
+ [
+ AC_DEFINE([ACPI], [1], ["Build for ACPI NFIT"])
+ ]
+)
+
+# Build on a qemu
+AC_ARG_ENABLE(qemu-test,
+ [ --enable-qemu-test Enable compilation for testing on qemu],
+ [case "${enableval}" in
+ yes | no ) QEMU_PMEM_TEST="${enableval}" ;;
+ *) AC_MSG_ERROR(bad value ${enableval} for --enable-qemu-test) ;;
+ esac],
+ [QEMU_PMEM_TEST="yes"]
+)
+
+AM_CONDITIONAL([QEMU_PMEM_TEST], [test "x$QEMU_PMEM_TEST" = "xyes"])
+
+if test "x$QEMU_PMEM_TEST" = "xyes"; then
+ AC_DEFINE([QEMU_PMEM_TEST], [1], ["build for qemu pmem testing"])
+ AC_DEFINE_UNQUOTED([NFIT_PROVIDER0], [["$BUS_PROVIDER0"]], ["pmem device"])
+ AC_DEFINE_UNQUOTED([NFIT_PROVIDER1], [["$BUS_PROVIDER1"]], ["pmem device"])
+ AC_MSG_NOTICE([building for pmem testing on qemu])
+else
+ AC_DEFINE_UNQUOTED([NFIT_PROVIDER0], [["nfit_test.0"]], ["nfit device"])
+ AC_DEFINE_UNQUOTED([NFIT_PROVIDER1], [["nfit_test.1"]], ["nfit device"])
+fi
+
AC_ARG_ENABLE([local],
AS_HELP_STRING([--disable-local], [build against kernel ndctl.h @<:@default=system@:>@]),
[], [enable_local=yes])
@@ -17,8 +17,14 @@ fi
# NFIT_TEST_BUS[01]
#
-NFIT_TEST_BUS0=nfit_test.0
-NFIT_TEST_BUS1=nfit_test.1
+if [ -z $BUS_PROVIDER0]; then
+ NFIT_TEST_BUS0=nfit_test.0
+ NFIT_TEST_BUS1=nfit_test.1
+else
+ NFIT_TEST_BUS0=$BUS_PROVIDER0
+ NFIT_TEST_BUS1=$BUS_PROVIDER1
+ QEMU_PMEM_TEST=yes
+fi
# Functions
@@ -71,7 +77,9 @@ _cleanup()
{
$NDCTL disable-region -b $NFIT_TEST_BUS0 all
$NDCTL disable-region -b $NFIT_TEST_BUS1 all
- modprobe -r nfit_test
+ if [ "x$QEMU_PMEM_TEST" = "x" ]; then
+ modprobe -r nfit_test
+ fi
}
# json2var
@@ -126,7 +126,9 @@ int nfit_test_init(struct kmod_ctx **ctx, struct kmod_module **mod,
struct ndctl_bus *bus;
struct log_ctx log_ctx;
const char *list[] = {
+#ifdef ACPI
"nfit",
+#endif
"device_dax",
"dax_pmem",
"dax_pmem_core",
@@ -134,7 +136,9 @@ int nfit_test_init(struct kmod_ctx **ctx, struct kmod_module **mod,
"libnvdimm",
"nd_blk",
"nd_btt",
+#ifdef ACPI
"nd_e820",
+#endif
"nd_pmem",
};
@@ -228,10 +232,11 @@ retry:
/* caller wants a full nfit_test reset */
ndctl_bus_foreach(nd_ctx, bus) {
struct ndctl_region *region;
-
+#ifdef ACPI
if (strncmp(ndctl_bus_get_provider(bus),
"nfit_test", 9) != 0)
continue;
+#endif
ndctl_region_foreach(bus, region)
ndctl_region_disable_invalidate(region);
}
@@ -23,7 +23,11 @@ check_min_kver "4.5" || do_skip "may lack namespace mode attribute"
trap 'err $LINENO' ERR
# setup (reset nfit_test dimms)
-modprobe nfit_test
+if [ -z $QEMU_PMEM_TEST ]; then
+ # setup (reset nfit_test dimms)
+ modprobe nfit_test
+fi
+
$NDCTL disable-region -b $NFIT_TEST_BUS0 all
$NDCTL zero-labels -b $NFIT_TEST_BUS0 all
$NDCTL enable-region -b $NFIT_TEST_BUS0 all
@@ -45,7 +45,6 @@ struct check_cmd {
static sigjmp_buf sj_env;
static int sig_count;
-static const char *NFIT_PROVIDER0 = "nfit_test.0";
static struct check_cmd *check_cmds;
static void sigbus_hdl(int sig, siginfo_t *siginfo, void *ptr)
@@ -30,8 +30,6 @@
#include <ndctl/libndctl.h>
#include <ccan/array_size/array_size.h>
-static const char *NFIT_PROVIDER0 = "nfit_test.0";
-static const char *NFIT_PROVIDER1 = "nfit_test.1";
#define NUM_NAMESPACES 4
struct test_dpa_namespace {
@@ -94,8 +94,6 @@
* dimm.
*/
-static const char *NFIT_PROVIDER0 = "nfit_test.0";
-static const char *NFIT_PROVIDER1 = "nfit_test.1";
#define SZ_4K 0x00001000
#define SZ_128K 0x00020000
#define SZ_7M 0x00700000
For QEMU emulated devices, nfit drivers need not be loaded, also the nfit_test, libnvdimm_test modules are not required. This patch adds a configure option to enable testing on qemu without nfit dependencies. Signed-off-by: Santosh Sivaraj <santosh@fossix.org> --- configure.ac | 30 ++++++++++++++++++++++++++++++ test/common | 14 +++++++++++--- test/core.c | 7 ++++++- test/create.sh | 6 +++++- test/daxdev-errors.c | 1 - test/dpa-alloc.c | 2 -- test/libndctl.c | 2 -- 7 files changed, 52 insertions(+), 10 deletions(-)