* [PATCH 2/2] Enable ndctl tests for emulated pmem devices
2019-09-23 3:30 [PATCH 1/2] rename nfit_test_bus with a more generic name Santosh Sivaraj
@ 2019-09-23 3:30 ` Santosh Sivaraj
2019-11-27 5:42 ` [PATCH 1/2] rename nfit_test_bus with a more generic name Santosh Sivaraj
1 sibling, 0 replies; 3+ messages in thread
From: Santosh Sivaraj @ 2019-09-23 3:30 UTC (permalink / raw)
To: linux-nvdimm, Dan Williams; +Cc: harish
For QEMU emulated devices and other platforms, nfit drivers are not needed.
This patch achieves that by relying upon the environment variable called
'WITHOUT_NFIT'. If 'WITHOUT_NFIT=y', nfit drivers (nfit_test and
libnvdimm_test) are not loaded.
Signed-off-by: Santosh Sivaraj <santosh@fossix.org>
---
configure.ac | 8 ++++++++
test/btt-pad-compat.sh | 5 ++++-
test/clear.sh | 5 ++++-
test/common | 19 ++++++++++++++-----
test/core.c | 6 ++++++
test/create.sh | 5 ++++-
test/daxdev-errors.c | 14 ++++++++++----
test/daxdev-errors.sh | 5 ++++-
test/dpa-alloc.c | 17 +++++++++++++----
test/libndctl.c | 21 +++++++++++++++++----
10 files changed, 84 insertions(+), 21 deletions(-)
diff --git a/configure.ac b/configure.ac
index 4737cff..33fbd0b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -145,6 +145,14 @@ if test "x$with_bash" = "xyes"; then
[BASH_COMPLETION_DIR=$($PKG_CONFIG --variable=completionsdir bash-completion)], [])
fi
+AC_CANONICAL_HOST
+AS_CASE([$host_cpu],
+ [x86_64|arm*],
+ [
+ AC_DEFINE([ACPI], [1], ["Build for ACPI NFIT"])
+ ]
+)
+
AC_SUBST([BASH_COMPLETION_DIR])
AM_CONDITIONAL([ENABLE_BASH_COMPLETION], [test "x$with_bash" = "xyes"])
diff --git a/test/btt-pad-compat.sh b/test/btt-pad-compat.sh
index a5fc796..1e5ce48 100755
--- a/test/btt-pad-compat.sh
+++ b/test/btt-pad-compat.sh
@@ -187,7 +187,10 @@ do_tests()
ns_info_wipe
}
-modprobe nfit_test
+if [ -z "$WITHOUT_NFIT" ]; then
+ modprobe nfit_test
+fi
+
check_prereq xxd
rc=1
reset
diff --git a/test/clear.sh b/test/clear.sh
index f0b4a9b..e0b1f84 100755
--- a/test/clear.sh
+++ b/test/clear.sh
@@ -22,7 +22,10 @@ check_min_kver "4.6" || do_skip "lacks clear poison support"
trap 'err $LINENO' ERR
# setup (reset nfit_test dimms)
-modprobe nfit_test
+if [ -z "$WITHOUT_NFIT" ]; then
+ modprobe nfit_test
+fi
+
$NDCTL disable-region -b $TEST_BUS0 all
$NDCTL zero-labels -b $TEST_BUS0 all
$NDCTL enable-region -b $TEST_BUS0 all
diff --git a/test/common b/test/common
index 54085ae..1251ba5 100644
--- a/test/common
+++ b/test/common
@@ -29,10 +29,17 @@ fi
# TEST_BUS[01]
#
-TEST_BUS0="nfit_test.0"
-TEST_BUS1="nfit_test.1"
-ACPI_BUS="ACPI.NFIT"
-E820_BUS="e820"
+echo $WITHOUT_NFIT
+if [ -n "$WITHOUT_NFIT" ]; then
+ echo $BUS_PROVIDER0
+ TEST_BUS0="$BUS_PROVIDER0"
+ TEST_BUS1="$BUS_PROVIDER1"
+else
+ TEST_BUS0="nfit_test.0"
+ TEST_BUS1="nfit_test.1"
+ ACPI_BUS="ACPI.NFIT"
+ E820_BUS="e820"
+fi
# Functions
@@ -84,7 +91,9 @@ _cleanup()
{
$NDCTL disable-region -b $TEST_BUS0 all
$NDCTL disable-region -b $TEST_BUS1 all
- modprobe -r nfit_test
+ if [ -z "$WITHOUT_NFIT" ]; then
+ modprobe -r nfit_test
+ fi
}
# json2var
diff --git a/test/core.c b/test/core.c
index 888f5d8..1f0c215 100644
--- a/test/core.c
+++ b/test/core.c
@@ -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",
};
@@ -239,9 +243,11 @@ retry:
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);
}
diff --git a/test/create.sh b/test/create.sh
index 1398c79..afc34ac 100755
--- a/test/create.sh
+++ b/test/create.sh
@@ -23,7 +23,10 @@ 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 "$WITHOUT_NFIT" ]; then
+ modprobe nfit_test
+fi
+
$NDCTL disable-region -b $TEST_BUS0 all
$NDCTL zero-labels -b $TEST_BUS0 all
$NDCTL enable-region -b $TEST_BUS0 all
diff --git a/test/daxdev-errors.c b/test/daxdev-errors.c
index 29de16b..1022047 100644
--- a/test/daxdev-errors.c
+++ b/test/daxdev-errors.c
@@ -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)
@@ -245,7 +244,7 @@ static struct ndctl_dax * get_dax_region(struct ndctl_region *region)
static int test_daxdev_clear_error(const char *bus_name,
const char *region_name)
{
- int rc = 0, i;
+ int rc = 0, i, with_nfit;
struct ndctl_ctx *ctx;
struct ndctl_bus *bus;
struct ndctl_region *region;
@@ -259,6 +258,7 @@ static int test_daxdev_clear_error(const char *bus_name,
};
char path[256];
char buf[SYSFS_ATTR_SIZE];
+ char *bus_provider;
struct log_ctx log_ctx;
log_init(&log_ctx, "test/init", "NDCTL_DAXDEV_TEST");
@@ -266,7 +266,13 @@ static int test_daxdev_clear_error(const char *bus_name,
if (rc)
return rc;
- bus = ndctl_bus_get_by_provider(ctx, NFIT_PROVIDER0);
+ with_nfit = strlen(getenv("WITHOUT_NFIT")) == 0;
+ if (with_nfit)
+ bus_provider = "nfit_test.0";
+ else
+ bus_provider = getenv("BUS_PROVIDER0");
+
+ bus = ndctl_bus_get_by_provider(ctx, bus_provider);
if (!bus) {
rc = -ENODEV;
goto cleanup;
@@ -289,7 +295,7 @@ static int test_daxdev_clear_error(const char *bus_name,
/* get badblocks */
if (snprintf(path, 256,
"/sys/devices/platform/%s/%s/%s/badblocks",
- NFIT_PROVIDER0,
+ bus_provider,
bus_name,
ndctl_region_get_devname(region)) >= 256) {
fprintf(stderr, "%s: buffer too small!\n",
diff --git a/test/daxdev-errors.sh b/test/daxdev-errors.sh
index c877874..7678a9b 100755
--- a/test/daxdev-errors.sh
+++ b/test/daxdev-errors.sh
@@ -22,7 +22,10 @@ check_min_kver "4.12" || do_skip "lacks dax dev error handling"
trap 'err $LINENO' ERR
# setup (reset nfit_test dimms)
-modprobe nfit_test
+if [ -z "$WITHOUT_NFIT" ]; then
+ modprobe nfit_test
+fi
+
$NDCTL disable-region -b $TEST_BUS0 all
$NDCTL zero-labels -b $TEST_BUS0 all
$NDCTL enable-region -b $TEST_BUS0 all
diff --git a/test/dpa-alloc.c b/test/dpa-alloc.c
index 9a9c6b6..25bbe0e 100644
--- a/test/dpa-alloc.c
+++ b/test/dpa-alloc.c
@@ -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 {
@@ -46,23 +44,34 @@ static int do_test(struct ndctl_ctx *ctx, struct ndctl_test *test)
{
unsigned int default_available_slots, available_slots, i;
struct ndctl_region *region, *blk_region = NULL;
+ char *bus_provider0, *bus_provider1;
struct ndctl_namespace *ndns;
struct ndctl_dimm *dimm;
unsigned long size;
+ bool with_nfit;
struct ndctl_bus *bus;
char uuid_str[40];
int round;
int rc;
+ with_nfit = strlen(getenv("WITHOUT_NFIT")) == 0;
+ if (with_nfit) {
+ bus_provider0 = "nfit_test.0";
+ bus_provider1 = "nfit_test.1";
+ } else {
+ bus_provider0 = getenv("BUS_PROVIDER0");
+ bus_provider1 = getenv("BUS_PROVIDER1");
+ }
+
/* disable nfit_test.1, not used in this test */
- bus = ndctl_bus_get_by_provider(ctx, NFIT_PROVIDER1);
+ bus = ndctl_bus_get_by_provider(ctx, bus_provider1);
if (!bus)
return -ENXIO;
ndctl_region_foreach(bus, region)
ndctl_region_disable_invalidate(region);
/* init nfit_test.0 */
- bus = ndctl_bus_get_by_provider(ctx, NFIT_PROVIDER0);
+ bus = ndctl_bus_get_by_provider(ctx, bus_provider0);
if (!bus)
return -ENXIO;
ndctl_region_foreach(bus, region)
diff --git a/test/libndctl.c b/test/libndctl.c
index 02bb9cc..e6fa053 100644
--- a/test/libndctl.c
+++ b/test/libndctl.c
@@ -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
@@ -2594,11 +2592,18 @@ static void reset_bus(struct ndctl_bus *bus)
static int do_test0(struct ndctl_ctx *ctx, struct ndctl_test *test)
{
- struct ndctl_bus *bus = ndctl_bus_get_by_provider(ctx, NFIT_PROVIDER0);
+ struct ndctl_bus *bus;
struct ndctl_region *region;
struct ndctl_dimm *dimm;
+ bool with_nfit;
int rc;
+ with_nfit = strlen(getenv("WITHOUT_NFIT")) == 0;
+ if (with_nfit)
+ bus = ndctl_bus_get_by_provider(ctx, "nfit_test.0");
+ else
+ bus = ndctl_bus_get_by_provider(ctx, getenv("BUS_PROVIDER0"));
+
if (!bus)
return -ENXIO;
@@ -2646,9 +2651,17 @@ static int do_test0(struct ndctl_ctx *ctx, struct ndctl_test *test)
static int do_test1(struct ndctl_ctx *ctx, struct ndctl_test *test)
{
- struct ndctl_bus *bus = ndctl_bus_get_by_provider(ctx, NFIT_PROVIDER1);
+ struct ndctl_bus *bus;
+ bool with_nfit;
int rc;
+ with_nfit = strlen(getenv("WITHOUT_NFIT")) == 0;
+ if (with_nfit)
+ bus = ndctl_bus_get_by_provider(ctx, "nfit_test.1");
+ else
+ bus = ndctl_bus_get_by_provider(ctx, getenv("BUS_PROVIDER1"));
+
+
if (!bus)
return -ENXIO;
--
2.21.0
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] rename nfit_test_bus with a more generic name
2019-09-23 3:30 [PATCH 1/2] rename nfit_test_bus with a more generic name Santosh Sivaraj
2019-09-23 3:30 ` [PATCH 2/2] Enable ndctl tests for emulated pmem devices Santosh Sivaraj
@ 2019-11-27 5:42 ` Santosh Sivaraj
1 sibling, 0 replies; 3+ messages in thread
From: Santosh Sivaraj @ 2019-11-27 5:42 UTC (permalink / raw)
To: linux-nvdimm, Dan Williams, Vishal Verma, harish
Dan/Vishal, any comments on this?
Santosh Sivaraj <santosh@fossix.org> writes:
> This cleanup would avoid confusion when ndctl is used for testing
> on non-nfit platforms.
>
> Signed-off-by: Santosh Sivaraj <santosh@fossix.org>
> ---
> test/blk-exhaust.sh | 14 +++++++-------
> test/btt-check.sh | 8 ++++----
> test/btt-errors.sh | 22 +++++++++++-----------
> test/btt-pad-compat.sh | 12 ++++++------
> test/clear.sh | 12 ++++++------
> test/common | 10 +++++-----
> test/create.sh | 10 +++++-----
> test/daxdev-errors.sh | 14 +++++++-------
> test/firmware-update.sh | 8 ++++----
> test/inject-error.sh | 8 ++++----
> test/inject-smart.sh | 2 +-
> test/label-compat.sh | 10 +++++-----
> test/max_available_extent_ns.sh | 8 ++++----
> test/monitor.sh | 10 +++++-----
> test/multi-dax.sh | 12 ++++++------
> test/pfn-meta-errors.sh | 8 ++++----
> test/pmem-errors.sh | 8 ++++----
> test/rescan-partitions.sh | 8 ++++----
> test/sector-mode.sh | 14 +++++++-------
> test/security.sh | 14 +++++++-------
> 20 files changed, 106 insertions(+), 106 deletions(-)
>
> diff --git a/test/blk-exhaust.sh b/test/blk-exhaust.sh
> index 326ce73..067ed27 100755
> --- a/test/blk-exhaust.sh
> +++ b/test/blk-exhaust.sh
> @@ -23,17 +23,17 @@ trap 'err $LINENO' ERR
>
> # setup (reset nfit_test dimms)
> modprobe nfit_test
> -$NDCTL disable-region -b $NFIT_TEST_BUS0 all
> -$NDCTL zero-labels -b $NFIT_TEST_BUS0 all
> -$NDCTL enable-region -b $NFIT_TEST_BUS0 all
> +$NDCTL disable-region -b $TEST_BUS0 all
> +$NDCTL zero-labels -b $TEST_BUS0 all
> +$NDCTL enable-region -b $TEST_BUS0 all
>
> # if the kernel accounting is correct we should be able to create two
> # pmem and two blk namespaces on nfit_test.0
> rc=1
> -$NDCTL create-namespace -b $NFIT_TEST_BUS0 -t pmem
> -$NDCTL create-namespace -b $NFIT_TEST_BUS0 -t pmem
> -$NDCTL create-namespace -b $NFIT_TEST_BUS0 -t blk -m raw
> -$NDCTL create-namespace -b $NFIT_TEST_BUS0 -t blk -m raw
> +$NDCTL create-namespace -b $TEST_BUS0 -t pmem
> +$NDCTL create-namespace -b $TEST_BUS0 -t pmem
> +$NDCTL create-namespace -b $TEST_BUS0 -t blk -m raw
> +$NDCTL create-namespace -b $TEST_BUS0 -t blk -m raw
>
> # clearnup and exit
> _cleanup
> diff --git a/test/btt-check.sh b/test/btt-check.sh
> index ceabee5..c91a5ad 100755
> --- a/test/btt-check.sh
> +++ b/test/btt-check.sh
> @@ -37,7 +37,7 @@ check_min_kver "4.14" || do_skip "may not support badblocks clearing on pmem via
>
> create()
> {
> - json=$($NDCTL create-namespace -b $NFIT_TEST_BUS0 -t pmem -m sector)
> + json=$($NDCTL create-namespace -b $TEST_BUS0 -t pmem -m sector)
> rc=2
> eval "$(echo "$json" | json2var)"
> [ -n "$dev" ] || err "$LINENO"
> @@ -50,9 +50,9 @@ create()
>
> reset()
> {
> - $NDCTL disable-region -b $NFIT_TEST_BUS0 all
> - $NDCTL zero-labels -b $NFIT_TEST_BUS0 all
> - $NDCTL enable-region -b $NFIT_TEST_BUS0 all
> + $NDCTL disable-region -b $TEST_BUS0 all
> + $NDCTL zero-labels -b $TEST_BUS0 all
> + $NDCTL enable-region -b $TEST_BUS0 all
> }
>
> # re-enable the BTT namespace, and do IO to it in an attempt to
> diff --git a/test/btt-errors.sh b/test/btt-errors.sh
> index cb35865..65224b3 100755
> --- a/test/btt-errors.sh
> +++ b/test/btt-errors.sh
> @@ -54,15 +54,15 @@ trap 'err $LINENO cleanup' ERR
>
> # setup (reset nfit_test dimms)
> modprobe nfit_test
> -$NDCTL disable-region -b $NFIT_TEST_BUS0 all
> -$NDCTL zero-labels -b $NFIT_TEST_BUS0 all
> -$NDCTL enable-region -b $NFIT_TEST_BUS0 all
> +$NDCTL disable-region -b $TEST_BUS0 all
> +$NDCTL zero-labels -b $TEST_BUS0 all
> +$NDCTL enable-region -b $TEST_BUS0 all
>
> rc=1
>
> # create a btt namespace and clear errors (if any)
> dev="x"
> -json=$($NDCTL create-namespace -b $NFIT_TEST_BUS0 -t pmem -m sector)
> +json=$($NDCTL create-namespace -b $TEST_BUS0 -t pmem -m sector)
> eval "$(echo "$json" | json2var)"
> [ $dev = "x" ] && echo "fail: $LINENO" && exit 1
>
> @@ -135,11 +135,11 @@ dd if=$MNT/$FILE of=/dev/null iflag=direct bs=4096 count=1
>
> # reset everything to get a clean log
> if grep -q "$MNT" /proc/mounts; then umount $MNT; 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
> +$NDCTL disable-region -b $TEST_BUS0 all
> +$NDCTL zero-labels -b $TEST_BUS0 all
> +$NDCTL enable-region -b $TEST_BUS0 all
> dev="x"
> -json=$($NDCTL create-namespace -b $NFIT_TEST_BUS0 -t pmem -m sector)
> +json=$($NDCTL create-namespace -b $TEST_BUS0 -t pmem -m sector)
> eval "$(echo "$json" | json2var)"
> [ $dev = "x" ] && echo "fail: $LINENO" && exit 1
>
> @@ -157,8 +157,8 @@ force_raw 0
> dd if=/dev/$blockdev of=/dev/null iflag=direct bs=4096 count=1 && err $LINENO || true
>
> # done, exit
> -$NDCTL disable-region -b $NFIT_TEST_BUS0 all
> -$NDCTL zero-labels -b $NFIT_TEST_BUS0 all
> -$NDCTL enable-region -b $NFIT_TEST_BUS0 all
> +$NDCTL disable-region -b $TEST_BUS0 all
> +$NDCTL zero-labels -b $TEST_BUS0 all
> +$NDCTL enable-region -b $TEST_BUS0 all
> _cleanup
> exit 0
> diff --git a/test/btt-pad-compat.sh b/test/btt-pad-compat.sh
> index 2c1f271..a5fc796 100755
> --- a/test/btt-pad-compat.sh
> +++ b/test/btt-pad-compat.sh
> @@ -31,7 +31,7 @@ trap 'err $LINENO' ERR
>
> create()
> {
> - json=$($NDCTL create-namespace -b $NFIT_TEST_BUS0 -t pmem -m sector)
> + json=$($NDCTL create-namespace -b $TEST_BUS0 -t pmem -m sector)
> rc=2
> eval "$(echo "$json" | json2var)"
> [ -n "$dev" ] || err "$LINENO"
> @@ -47,9 +47,9 @@ create()
>
> reset()
> {
> - $NDCTL disable-region -b $NFIT_TEST_BUS0 all
> - $NDCTL zero-labels -b $NFIT_TEST_BUS0 all
> - $NDCTL enable-region -b $NFIT_TEST_BUS0 all
> + $NDCTL disable-region -b $TEST_BUS0 all
> + $NDCTL zero-labels -b $TEST_BUS0 all
> + $NDCTL enable-region -b $TEST_BUS0 all
> }
>
> verify_idx()
> @@ -120,7 +120,7 @@ create_oldfmt_ns()
> # that supports a raw namespace with a 4K sector size, prior to
> # v4.13 raw namespaces are limited to 512-byte sector size.
> rc=77
> - json=$($NDCTL create-namespace -b $NFIT_TEST_BUS0 -s 64M -t pmem -m raw -l 4096 -u 00000000-0000-0000-0000-000000000000)
> + json=$($NDCTL create-namespace -b $TEST_BUS0 -s 64M -t pmem -m raw -l 4096 -u 00000000-0000-0000-0000-000000000000)
> rc=2
> eval "$(echo "$json" | json2var)"
> [ -n "$dev" ] || err "$LINENO"
> @@ -128,7 +128,7 @@ create_oldfmt_ns()
> [ $size -gt 0 ] || err "$LINENO"
>
> # reconfig it to sector mode
> - json=$($NDCTL create-namespace -b $NFIT_TEST_BUS0 -e $dev -m sector --force)
> + json=$($NDCTL create-namespace -b $TEST_BUS0 -e $dev -m sector --force)
> eval "$(echo "$json" | json2var)"
> [ -n "$dev" ] || err "$LINENO"
> [ -n "$size" ] || err "$LINENO"
> diff --git a/test/clear.sh b/test/clear.sh
> index 17d5bed..f0b4a9b 100755
> --- a/test/clear.sh
> +++ b/test/clear.sh
> @@ -23,15 +23,15 @@ trap 'err $LINENO' ERR
>
> # setup (reset nfit_test dimms)
> modprobe nfit_test
> -$NDCTL disable-region -b $NFIT_TEST_BUS0 all
> -$NDCTL zero-labels -b $NFIT_TEST_BUS0 all
> -$NDCTL enable-region -b $NFIT_TEST_BUS0 all
> +$NDCTL disable-region -b $TEST_BUS0 all
> +$NDCTL zero-labels -b $TEST_BUS0 all
> +$NDCTL enable-region -b $TEST_BUS0 all
>
> rc=1
>
> # create pmem
> dev="x"
> -json=$($NDCTL create-namespace -b $NFIT_TEST_BUS0 -t pmem -m raw)
> +json=$($NDCTL create-namespace -b $TEST_BUS0 -t pmem -m raw)
> eval $(echo $json | json2var)
> [ $dev = "x" ] && echo "fail: $LINENO" && exit 1
> [ $mode != "raw" ] && echo "fail: $LINENO" && exit 1
> @@ -73,8 +73,8 @@ fi
>
> if check_min_kver "4.9"; then
> # check for re-appearance of stale badblocks from poison_list
> - $NDCTL disable-region -b $NFIT_TEST_BUS0 all
> - $NDCTL enable-region -b $NFIT_TEST_BUS0 all
> + $NDCTL disable-region -b $TEST_BUS0 all
> + $NDCTL enable-region -b $TEST_BUS0 all
>
> # since we have cleared the errors, a disable/reenable shouldn't bring them back
> if read sector len < /sys/block/$blockdev/badblocks; then
> diff --git a/test/common b/test/common
> index 1814a0c..54085ae 100644
> --- a/test/common
> +++ b/test/common
> @@ -27,10 +27,10 @@ else
> fi
>
>
> -# NFIT_TEST_BUS[01]
> +# TEST_BUS[01]
> #
> -NFIT_TEST_BUS0="nfit_test.0"
> -NFIT_TEST_BUS1="nfit_test.1"
> +TEST_BUS0="nfit_test.0"
> +TEST_BUS1="nfit_test.1"
> ACPI_BUS="ACPI.NFIT"
> E820_BUS="e820"
>
> @@ -82,8 +82,8 @@ check_prereq()
> #
> _cleanup()
> {
> - $NDCTL disable-region -b $NFIT_TEST_BUS0 all
> - $NDCTL disable-region -b $NFIT_TEST_BUS1 all
> + $NDCTL disable-region -b $TEST_BUS0 all
> + $NDCTL disable-region -b $TEST_BUS1 all
> modprobe -r nfit_test
> }
>
> diff --git a/test/create.sh b/test/create.sh
> index 8d78797..1398c79 100755
> --- a/test/create.sh
> +++ b/test/create.sh
> @@ -24,15 +24,15 @@ trap 'err $LINENO' ERR
>
> # setup (reset nfit_test dimms)
> modprobe nfit_test
> -$NDCTL disable-region -b $NFIT_TEST_BUS0 all
> -$NDCTL zero-labels -b $NFIT_TEST_BUS0 all
> -$NDCTL enable-region -b $NFIT_TEST_BUS0 all
> +$NDCTL disable-region -b $TEST_BUS0 all
> +$NDCTL zero-labels -b $TEST_BUS0 all
> +$NDCTL enable-region -b $TEST_BUS0 all
>
> rc=1
>
> # create pmem
> dev="x"
> -json=$($NDCTL create-namespace -b $NFIT_TEST_BUS0 -t pmem -m raw)
> +json=$($NDCTL create-namespace -b $TEST_BUS0 -t pmem -m raw)
> eval $(echo $json | json2var )
> [ $dev = "x" ] && echo "fail: $LINENO" && exit 1
> [ $mode != "raw" ] && echo "fail: $LINENO" && exit 1
> @@ -53,7 +53,7 @@ $NDCTL destroy-namespace -f $dev
>
> # create blk
> dev="x"
> -json=$($NDCTL create-namespace -b $NFIT_TEST_BUS0 -t blk -m raw -v)
> +json=$($NDCTL create-namespace -b $TEST_BUS0 -t blk -m raw -v)
> eval $(echo $json | json2var)
> [ $dev = "x" ] && echo "fail: $LINENO" && exit 1
> [ $mode != "raw" ] && echo "fail: $LINENO" && exit 1
> diff --git a/test/daxdev-errors.sh b/test/daxdev-errors.sh
> index c5adb72..c877874 100755
> --- a/test/daxdev-errors.sh
> +++ b/test/daxdev-errors.sh
> @@ -23,16 +23,16 @@ trap 'err $LINENO' ERR
>
> # setup (reset nfit_test dimms)
> modprobe nfit_test
> -$NDCTL disable-region -b $NFIT_TEST_BUS0 all
> -$NDCTL zero-labels -b $NFIT_TEST_BUS0 all
> -$NDCTL enable-region -b $NFIT_TEST_BUS0 all
> +$NDCTL disable-region -b $TEST_BUS0 all
> +$NDCTL zero-labels -b $TEST_BUS0 all
> +$NDCTL enable-region -b $TEST_BUS0 all
>
> rc=1
>
> query=". | sort_by(.available_size) | reverse | .[0].dev"
> -region=$($NDCTL list -b $NFIT_TEST_BUS0 -t pmem -Ri | jq -r "$query")
> +region=$($NDCTL list -b $TEST_BUS0 -t pmem -Ri | jq -r "$query")
>
> -json=$($NDCTL create-namespace -b $NFIT_TEST_BUS0 -r $region -t pmem -m devdax -a 4096)
> +json=$($NDCTL create-namespace -b $TEST_BUS0 -r $region -t pmem -m devdax -a 4096)
> chardev=$(echo $json | jq ". | select(.mode == \"devdax\") | .daxregion.devices[0].chardev")
>
> #{
> @@ -53,11 +53,11 @@ chardev=$(echo $json | jq ". | select(.mode == \"devdax\") | .daxregion.devices[
> # }
> #}
>
> -json1=$($NDCTL list -b $NFIT_TEST_BUS0 --mode=devdax --namespaces)
> +json1=$($NDCTL list -b $TEST_BUS0 --mode=devdax --namespaces)
> eval $(echo $json1 | json2var)
> nsdev=$dev
>
> -json1=$($NDCTL list -b $NFIT_TEST_BUS0)
> +json1=$($NDCTL list -b $TEST_BUS0)
> eval $(echo $json1 | json2var)
> busdev=$dev
>
> diff --git a/test/firmware-update.sh b/test/firmware-update.sh
> index 7852e58..dbd5c7f 100755
> --- a/test/firmware-update.sh
> +++ b/test/firmware-update.sh
> @@ -12,9 +12,9 @@ trap 'err $LINENO' ERR
>
> reset()
> {
> - $NDCTL disable-region -b $NFIT_TEST_BUS0 all
> - $NDCTL zero-labels -b $NFIT_TEST_BUS0 all
> - $NDCTL enable-region -b $NFIT_TEST_BUS0 all
> + $NDCTL disable-region -b $TEST_BUS0 all
> + $NDCTL zero-labels -b $TEST_BUS0 all
> + $NDCTL enable-region -b $TEST_BUS0 all
> if [ -f $image ]; then
> rm -f $image
> fi
> @@ -22,7 +22,7 @@ reset()
>
> detect()
> {
> - dev=$($NDCTL list -b $NFIT_TEST_BUS0 -D | jq .[0].dev | tr -d '"')
> + dev=$($NDCTL list -b $TEST_BUS0 -D | jq .[0].dev | tr -d '"')
> [ -n "$dev" ] || err "$LINENO"
> }
>
> diff --git a/test/inject-error.sh b/test/inject-error.sh
> index 49e68b3..3e33a1b 100755
> --- a/test/inject-error.sh
> +++ b/test/inject-error.sh
> @@ -35,7 +35,7 @@ check_min_kver "4.15" || do_skip "kernel $KVER may not support error injection"
>
> create()
> {
> - json=$($NDCTL create-namespace -b $NFIT_TEST_BUS0 -t pmem --align=4k)
> + json=$($NDCTL create-namespace -b $TEST_BUS0 -t pmem --align=4k)
> rc=2
> eval "$(echo "$json" | json2var)"
> [ -n "$dev" ] || err "$LINENO"
> @@ -46,9 +46,9 @@ create()
>
> reset()
> {
> - $NDCTL disable-region -b $NFIT_TEST_BUS0 all
> - $NDCTL zero-labels -b $NFIT_TEST_BUS0 all
> - $NDCTL enable-region -b $NFIT_TEST_BUS0 all
> + $NDCTL disable-region -b $TEST_BUS0 all
> + $NDCTL zero-labels -b $TEST_BUS0 all
> + $NDCTL enable-region -b $TEST_BUS0 all
> }
>
> check_status()
> diff --git a/test/inject-smart.sh b/test/inject-smart.sh
> index 18655ba..fa18a58 100755
> --- a/test/inject-smart.sh
> +++ b/test/inject-smart.sh
> @@ -4,7 +4,7 @@
>
> rc=77
> . ./common
> -bus="$NFIT_TEST_BUS0"
> +bus="$TEST_BUS0"
> inj_val="42"
>
> trap 'err $LINENO' ERR
> diff --git a/test/label-compat.sh b/test/label-compat.sh
> index dc6226d..a31bf4a 100755
> --- a/test/label-compat.sh
> +++ b/test/label-compat.sh
> @@ -23,12 +23,12 @@ trap 'err $LINENO' ERR
>
> # setup (reset nfit_test dimms)
> modprobe nfit_test
> -$NDCTL disable-region -b $NFIT_TEST_BUS0 all
> -$NDCTL zero-labels -b $NFIT_TEST_BUS0 all
> +$NDCTL disable-region -b $TEST_BUS0 all
> +$NDCTL zero-labels -b $TEST_BUS0 all
>
> -# grab the largest pmem region on -b $NFIT_TEST_BUS0
> +# grab the largest pmem region on -b $TEST_BUS0
> query=". | sort_by(.available_size) | reverse | .[0].dev"
> -region=$($NDCTL list -b $NFIT_TEST_BUS0 -t pmem -Ri | jq -r "$query")
> +region=$($NDCTL list -b $TEST_BUS0 -t pmem -Ri | jq -r "$query")
>
> # we assume that $region is comprised of 4 dimms
> query=". | .regions[0].mappings | sort_by(.dimm) | .[].dimm"
> @@ -40,7 +40,7 @@ do
> i=$((i+1))
> done
>
> -$NDCTL enable-region -b $NFIT_TEST_BUS0 all
> +$NDCTL enable-region -b $TEST_BUS0 all
>
> len=$($NDCTL list -r $region -N | jq -r "length")
>
> diff --git a/test/max_available_extent_ns.sh b/test/max_available_extent_ns.sh
> index 1c7e7bf..5701195 100755
> --- a/test/max_available_extent_ns.sh
> +++ b/test/max_available_extent_ns.sh
> @@ -13,14 +13,14 @@ check_min_kver "4.19" || do_skip "kernel $KVER may not support max_available_siz
>
> init()
> {
> - $NDCTL disable-region -b $NFIT_TEST_BUS0 all
> - $NDCTL zero-labels -b $NFIT_TEST_BUS0 all
> - $NDCTL enable-region -b $NFIT_TEST_BUS0 all
> + $NDCTL disable-region -b $TEST_BUS0 all
> + $NDCTL zero-labels -b $TEST_BUS0 all
> + $NDCTL enable-region -b $TEST_BUS0 all
> }
>
> do_test()
> {
> - region=$($NDCTL list -b $NFIT_TEST_BUS0 -R -t pmem | jq -r 'sort_by(-.size) | .[].dev' | head -1)
> + region=$($NDCTL list -b $TEST_BUS0 -R -t pmem | jq -r 'sort_by(-.size) | .[].dev' | head -1)
>
> available_sz=$($NDCTL list -r $region | jq -r .[].available_size)
> size=$(( available_sz/4 ))
> diff --git a/test/monitor.sh b/test/monitor.sh
> index 29d4ea1..c9f7224 100755
> --- a/test/monitor.sh
> +++ b/test/monitor.sh
> @@ -20,9 +20,9 @@ check_min_kver "4.15" || do_skip "kernel $KVER may not support monitor service"
>
> init()
> {
> - $NDCTL disable-region -b $NFIT_TEST_BUS0 all
> - $NDCTL zero-labels -b $NFIT_TEST_BUS0 all
> - $NDCTL enable-region -b $NFIT_TEST_BUS0 all
> + $NDCTL disable-region -b $TEST_BUS0 all
> + $NDCTL zero-labels -b $TEST_BUS0 all
> + $NDCTL enable-region -b $TEST_BUS0 all
> }
>
> start_monitor()
> @@ -36,10 +36,10 @@ start_monitor()
>
> set_smart_supported_bus()
> {
> - smart_supported_bus=$NFIT_TEST_BUS0
> + smart_supported_bus=$TEST_BUS0
> monitor_dimms=$(./list-smart-dimm -b $smart_supported_bus | jq -r .[0].dev)
> if [ -z $monitor_dimms ]; then
> - smart_supported_bus=$NFIT_TEST_BUS1
> + smart_supported_bus=$TEST_BUS1
> fi
> }
>
> diff --git a/test/multi-dax.sh b/test/multi-dax.sh
> index 0829bf2..1dca352 100755
> --- a/test/multi-dax.sh
> +++ b/test/multi-dax.sh
> @@ -23,17 +23,17 @@ trap 'err $LINENO' ERR
>
> # setup (reset nfit_test dimms)
> modprobe nfit_test
> -$NDCTL disable-region -b $NFIT_TEST_BUS0 all
> -$NDCTL zero-labels -b $NFIT_TEST_BUS0 all
> -$NDCTL enable-region -b $NFIT_TEST_BUS0 all
> +$NDCTL disable-region -b $TEST_BUS0 all
> +$NDCTL zero-labels -b $TEST_BUS0 all
> +$NDCTL enable-region -b $TEST_BUS0 all
> rc=1
>
> query=". | sort_by(.available_size) | reverse | .[0].dev"
> -region=$($NDCTL list -b $NFIT_TEST_BUS0 -t pmem -Ri | jq -r "$query")
> +region=$($NDCTL list -b $TEST_BUS0 -t pmem -Ri | jq -r "$query")
>
> -json=$($NDCTL create-namespace -b $NFIT_TEST_BUS0 -r $region -t pmem -m devdax -a 4096 -s 16M)
> +json=$($NDCTL create-namespace -b $TEST_BUS0 -r $region -t pmem -m devdax -a 4096 -s 16M)
> chardev1=$(echo $json | jq ". | select(.mode == \"devdax\") | .daxregion.devices[0].chardev")
> -json=$($NDCTL create-namespace -b $NFIT_TEST_BUS0 -r $region -t pmem -m devdax -a 4096 -s 16M)
> +json=$($NDCTL create-namespace -b $TEST_BUS0 -r $region -t pmem -m devdax -a 4096 -s 16M)
> chardev2=$(echo $json | jq ". | select(.mode == \"devdax\") | .daxregion.devices[0].chardev")
>
> _cleanup
> diff --git a/test/pfn-meta-errors.sh b/test/pfn-meta-errors.sh
> index 2b57f19..f930325 100755
> --- a/test/pfn-meta-errors.sh
> +++ b/test/pfn-meta-errors.sh
> @@ -30,15 +30,15 @@ trap 'err $LINENO' ERR
>
> # setup (reset nfit_test dimms)
> modprobe nfit_test
> -$NDCTL disable-region -b $NFIT_TEST_BUS0 all
> -$NDCTL zero-labels -b $NFIT_TEST_BUS0 all
> -$NDCTL enable-region -b $NFIT_TEST_BUS0 all
> +$NDCTL disable-region -b $TEST_BUS0 all
> +$NDCTL zero-labels -b $TEST_BUS0 all
> +$NDCTL enable-region -b $TEST_BUS0 all
>
> rc=1
>
> # create a fsdax namespace and clear errors (if any)
> dev="x"
> -json=$($NDCTL create-namespace -b $NFIT_TEST_BUS0 -t pmem -m fsdax)
> +json=$($NDCTL create-namespace -b $TEST_BUS0 -t pmem -m fsdax)
> eval "$(echo "$json" | json2var)"
> [ $dev = "x" ] && echo "fail: $LINENO" && exit 1
>
> diff --git a/test/pmem-errors.sh b/test/pmem-errors.sh
> index 9553a3f..8ce57c8 100755
> --- a/test/pmem-errors.sh
> +++ b/test/pmem-errors.sh
> @@ -28,15 +28,15 @@ trap 'err $LINENO cleanup' ERR
>
> # setup (reset nfit_test dimms)
> modprobe nfit_test
> -$NDCTL disable-region -b $NFIT_TEST_BUS0 all
> -$NDCTL zero-labels -b $NFIT_TEST_BUS0 all
> -$NDCTL enable-region -b $NFIT_TEST_BUS0 all
> +$NDCTL disable-region -b $TEST_BUS0 all
> +$NDCTL zero-labels -b $TEST_BUS0 all
> +$NDCTL enable-region -b $TEST_BUS0 all
>
> rc=1
>
> # create pmem
> dev="x"
> -json=$($NDCTL create-namespace -b $NFIT_TEST_BUS0 -t pmem -m raw)
> +json=$($NDCTL create-namespace -b $TEST_BUS0 -t pmem -m raw)
> eval $(echo $json | json2var)
> [ $dev = "x" ] && echo "fail: $LINENO" && false
> [ $mode != "raw" ] && echo "fail: $LINENO" && false
> diff --git a/test/rescan-partitions.sh b/test/rescan-partitions.sh
> index 9c7b7a0..5e01665 100755
> --- a/test/rescan-partitions.sh
> +++ b/test/rescan-partitions.sh
> @@ -27,9 +27,9 @@ check_prereq "blockdev"
>
> reset()
> {
> - $NDCTL disable-region -b $NFIT_TEST_BUS0 all
> - $NDCTL zero-labels -b $NFIT_TEST_BUS0 all
> - $NDCTL enable-region -b $NFIT_TEST_BUS0 all
> + $NDCTL disable-region -b $TEST_BUS0 all
> + $NDCTL zero-labels -b $TEST_BUS0 all
> + $NDCTL enable-region -b $TEST_BUS0 all
> }
>
> test_mode()
> @@ -37,7 +37,7 @@ test_mode()
> local mode="$1"
>
> # create namespace
> - json=$($NDCTL create-namespace -b $NFIT_TEST_BUS0 -t pmem -m "$mode")
> + json=$($NDCTL create-namespace -b $TEST_BUS0 -t pmem -m "$mode")
> rc=2
> eval "$(echo "$json" | json2var)"
> [ -n "$dev" ] || err "$LINENO"
> diff --git a/test/sector-mode.sh b/test/sector-mode.sh
> index 4b964c5..7f60452 100755
> --- a/test/sector-mode.sh
> +++ b/test/sector-mode.sh
> @@ -20,17 +20,17 @@ trap 'err $LINENO' ERR
>
> # setup (reset nfit_test dimms)
> modprobe nfit_test
> -$NDCTL disable-region -b $NFIT_TEST_BUS0 all
> -$NDCTL zero-labels -b $NFIT_TEST_BUS0 all
> -$NDCTL enable-region -b $NFIT_TEST_BUS0 all
> +$NDCTL disable-region -b $TEST_BUS0 all
> +$NDCTL zero-labels -b $TEST_BUS0 all
> +$NDCTL enable-region -b $TEST_BUS0 all
>
> -$NDCTL disable-region -b $NFIT_TEST_BUS1 all
> -$NDCTL zero-labels -b $NFIT_TEST_BUS1 all
> -$NDCTL enable-region -b $NFIT_TEST_BUS1 all
> +$NDCTL disable-region -b $TEST_BUS1 all
> +$NDCTL zero-labels -b $TEST_BUS1 all
> +$NDCTL enable-region -b $TEST_BUS1 all
>
> rc=1
> query=". | sort_by(.size) | reverse | .[0].dev"
> -NAMESPACE=$($NDCTL list -b $NFIT_TEST_BUS1 -N | jq -r "$query")
> +NAMESPACE=$($NDCTL list -b $TEST_BUS1 -N | jq -r "$query")
> REGION=$($NDCTL list -R --namespace=$NAMESPACE | jq -r "(.[]) | .dev")
> echo 0 > /sys/bus/nd/devices/$REGION/read_only
> $NDCTL create-namespace --no-autolabel -e $NAMESPACE -m sector -f -l 4K
> diff --git a/test/security.sh b/test/security.sh
> index c86d2c6..80d64df 100755
> --- a/test/security.sh
> +++ b/test/security.sh
> @@ -17,14 +17,14 @@ trap 'err $LINENO' ERR
>
> setup()
> {
> - $NDCTL disable-region -b "$NFIT_TEST_BUS0" all
> + $NDCTL disable-region -b "$TEST_BUS0" all
> }
>
> detect()
> {
> - dev="$($NDCTL list -b "$NFIT_TEST_BUS0" -D | jq -r .[0].dev)"
> + dev="$($NDCTL list -b "$TEST_BUS0" -D | jq -r .[0].dev)"
> [ -n "$dev" ] || err "$LINENO"
> - id="$($NDCTL list -b "$NFIT_TEST_BUS0" -D | jq -r .[0].id)"
> + id="$($NDCTL list -b "$TEST_BUS0" -D | jq -r .[0].id)"
> [ -n "$id" ] || err "$LINENO"
> }
>
> @@ -83,9 +83,9 @@ lock_dimm()
> # inline. Once a subsequent user arrives we can refactor this to a
> # helper in test/common:
> # get_test_dimm_path "nfit_test.0" "nmem3"
> - handle="$($NDCTL list -b "$NFIT_TEST_BUS0" -d "$dev" -i | jq -r .[].dimms[0].handle)"
> + handle="$($NDCTL list -b "$TEST_BUS0" -d "$dev" -i | jq -r .[].dimms[0].handle)"
> test_dimm_path=""
> - for test_dimm in /sys/devices/platform/"$NFIT_TEST_BUS0"/nfit_test_dimm/test_dimm*; do
> + for test_dimm in /sys/devices/platform/"$TEST_BUS0"/nfit_test_dimm/test_dimm*; do
> td_handle_file="$test_dimm/handle"
> test -e "$td_handle_file" || continue
> td_handle="$(cat "$td_handle_file")"
> @@ -107,7 +107,7 @@ lock_dimm()
>
> get_security_state()
> {
> - $NDCTL list -i -b "$NFIT_TEST_BUS0" -d "$dev" | jq -r .[].dimms[0].security
> + $NDCTL list -i -b "$TEST_BUS0" -d "$dev" | jq -r .[].dimms[0].security
> }
>
> setup_passphrase()
> @@ -184,7 +184,7 @@ test_4_security_unlock()
> echo "Incorrect security state: $sstate expected: unlocked"
> err "$LINENO"
> fi
> - $NDCTL disable-region -b "$NFIT_TEST_BUS0" all
> + $NDCTL disable-region -b "$TEST_BUS0" all
> remove_passphrase
> }
>
> --
> 2.21.0
_______________________________________________
Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org
To unsubscribe send an email to linux-nvdimm-leave@lists.01.org
^ permalink raw reply [flat|nested] 3+ messages in thread