Compare commits

..

No commits in common. "c8" and "c9s" have entirely different histories.
c8 ... c9s

39 changed files with 3495 additions and 4829 deletions

37
.gitignore vendored
View File

@ -1 +1,36 @@
SOURCES/ndctl-71.1.tar.gz /v52.tar.gz
/ndctl-53.tar.gz
/ndctl-53.1.tar.gz
/ndctl-54.tar.gz
/ndctl-55.tar.gz
/ndctl-56.tar.gz
/ndctl-57.tar.gz
/ndctl-57.1.tar.gz
/ndctl-58.1.tar.gz
/ndctl-58.2.tar.gz
/ndctl-58.4.tar.gz
/ndctl-59.tar.gz
/ndctl-59.1.tar.gz
/ndctl-59.2.tar.gz
/ndctl-59.3.tar.gz
/ndctl-60.tar.gz
/ndctl-60.1.tar.gz
/ndctl-60.3.tar.gz
/ndctl-61.tar.gz
/ndctl-61.1.tar.gz
/ndctl-61.2.tar.gz
/ndctl-62.tar.gz
/ndctl-63.tar.gz
/ndctl-64.tar.gz
/ndctl-64.1.tar.gz
/ndctl-65.tar.gz
/ndctl-66.tar.gz
/ndctl-67.tar.gz
/0001-ndctl-lib-fix-symbol-redefinitions-reported-by-GC.patch
/ndctl-68.tar.gz
/ndctl-69.tar.gz
/ndctl-70.tar.gz
/ndctl-70.1.tar.gz
/ndctl-71.tar.gz
/ndctl-71.1.tar.gz
/ndctl-78.tar.gz

View File

@ -0,0 +1,41 @@
From 95e837700d0229c2a75ca6b77e7ed0f74ae2f433 Mon Sep 17 00:00:00 2001
From: Jeff Moyer <jmoyer@redhat.com>
Date: Tue, 12 Dec 2023 16:59:54 -0500
Subject: [PATCH 1/3] test/daxctl-devices.sh: increase the namespace size
Memory hotplug requires the namespace to be aligned to a boundary that
depends on several factors. Upstream kernel commit fe124c95df9e
("x86/mm: use max memory block size on bare metal") increased the
typical size/alignment to 2GiB from 256MiB. As a result, this test no
longer passes on our bare metal test systems.
This patch fixes the test failure by bumping the namespace size to
4GiB, which leaves room for aligning the start and end to 2GiB.
Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
Related: RHEL-10382diff --git a/test/daxctl-devices.sh b/test/daxctl-devices.sh
index 56c9691..dfce74b 100755
---
test/daxctl-devices.sh | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/test/daxctl-devices.sh b/test/daxctl-devices.sh
index 56c9691..dfce74b 100755
--- a/test/daxctl-devices.sh
+++ b/test/daxctl-devices.sh
@@ -44,7 +44,10 @@ setup_dev()
test -n "$testdev"
"$NDCTL" destroy-namespace -f -b "$testbus" "$testdev"
- testdev=$("$NDCTL" create-namespace -b "$testbus" -m devdax -fe "$testdev" -s 256M | \
+ # x86_64 memory hotplug can require up to a 2GiB-aligned chunk
+ # of memory. Create a 4GiB namespace, so that we will still have
+ # enough room left after aligning the start and end.
+ testdev=$("$NDCTL" create-namespace -b "$testbus" -m devdax -fe "$testdev" -s 4G | \
jq -er '.dev')
test -n "$testdev"
}
--
2.39.3

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,70 @@
ndctl: check the old directory for monitor.conf
Scripts may still reference / install the monitor.conf file
in the old path. Check there first to avoid breaking backwards
compatibility.
Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
Related: RHEL-10382
diff --git a/config.h.meson b/config.h.meson
index 5441dff..32e7941 100644
--- a/config.h.meson
+++ b/config.h.meson
@@ -149,6 +149,7 @@
/* Locations to install configuration files, key config, man pages, etc.. */
#mesondefine NDCTL_CONF_FILE
#mesondefine NDCTL_CONF_DIR
+#mesondefine LEGACY_CONF_FILE
#mesondefine DAXCTL_CONF_DIR
#mesondefine NDCTL_KEYS_DIR
#mesondefine NDCTL_MAN_PATH
diff --git a/meson.build b/meson.build
index 2cb188f..96bc386 100644
--- a/meson.build
+++ b/meson.build
@@ -259,8 +259,11 @@ conf.set10('HAVE_JSON_U64',
ndctlconf_dir = sysconfdir / 'ndctl.conf.d'
ndctlconf = ndctlconf_dir / 'monitor.conf'
+legacyconf_dir = sysconfdir / 'ndctl'
+legacyconf = legacyconf_dir / 'monitor.conf'
conf.set_quoted('NDCTL_CONF_FILE', ndctlconf)
conf.set_quoted('NDCTL_CONF_DIR', ndctlconf_dir)
+conf.set_quoted('LEGACY_CONF_FILE', legacyconf)
ndctlkeys_dir = sysconfdir / 'ndctl' / 'keys'
conf.set_quoted('NDCTL_KEYS_DIR', ndctlkeys_dir)
diff --git a/ndctl/meson.build b/ndctl/meson.build
index 050d576..dd13a41 100644
--- a/ndctl/meson.build
+++ b/ndctl/meson.build
@@ -59,7 +59,7 @@ endif
if get_option('systemd').enabled()
install_data('ndctl-monitor.service', install_dir : systemdunitdir)
endif
-install_data('monitor.conf', install_dir : ndctlconf_dir)
+install_data('monitor.conf', install_dir : legacyconf_dir)
install_data('ndctl.conf', install_dir : ndctlconf_dir)
install_data('keys.readme', install_dir : ndctlkeys_dir)
diff --git a/ndctl/monitor.c b/ndctl/monitor.c
index bd8a748..07da7f5 100644
--- a/ndctl/monitor.c
+++ b/ndctl/monitor.c
@@ -591,6 +591,15 @@ int cmd_monitor(int argc, const char **argv, struct ndctl_ctx *ctx)
else
monitor.ctx.log_priority = LOG_INFO;
+ /*
+ * First, check the legacy path to see if a monitor.conf
+ * file exists there. If so, add a [monitor] header
+ * and use its contents.
+ */
+ if (!monitor.configs && (stat(LEGACY_CONF_FILE, &st) == 0) &&
+ S_ISREG(st.st_mode))
+ monitor.configs = LEGACY_CONF_FILE;
+
ndctl_configs = ndctl_get_config_path(ctx);
if (!monitor.configs && ndctl_configs) {
rc = asprintf(&path, "%s/monitor.conf", ndctl_configs);

View File

@ -1,81 +0,0 @@
ndctl/namespace: Suppress -ENXIO when processing all namespaces.
BZ:
Brew:
commit 07011a334fd1e4b641cdbfaf5de7500f7bdc941d
Author: Michal Suchanek <msuchanek@suse.de>
Date: Wed Jan 6 14:17:41 2021 +0100
ndctl/namespace: Suppress -ENXIO when processing all namespaces.
When processing all namespaces and no namespaces exist user gets the
default -ENXIO. Set default rc to 0 when processing all namespaces.
This avoids confusing error message printed in addition to the message
saying 0 namespaces were affected.
Before:
# ndctl check-namespace all
namespace0.0: namespace_check: namespace0.0: check aborted, namespace online
error checking namespaces: Device or resource busy
checked 0 namespaces
# ndctl disable-namespace all
disabled 1 namespace
# ndctl check-namespace all
namespace0.0: namespace_check: Unable to recover any BTT info blocks
error checking namespaces: No such device or address
checked 0 namespaces
# ndctl destroy-namespace all
destroyed 1 namespace
# ndctl check-namespace all
error checking namespaces: No such device or address
checked 0 namespaces
# ndctl destroy-namespace all
error destroying namespaces: No such device or address
destroyed 0 namespaces
After:
# ndctl check-namespace all
namespace0.0: namespace_check: namespace0.0: check aborted, namespace online
error checking namespaces: Device or resource busy
checked 0 namespaces
# ndctl disable-namespace namespace0.0
disabled 1 namespace
# ndctl check-namespace all
namespace0.0: namespace_check: Unable to recover any BTT info blocks
error checking namespaces: No such device or address
checked 0 namespaces
# ndctl destroy-namespace all
destroyed 1 namespace
# ndctl check-namespace all
checked 0 namespaces
# ndctl destroy-namespace all
destroyed 0 namespaces
# ndctl destroy-namespace all
destroyed 0 namespaces
Note: this does change the return value from -ENXIO to 0 in the cases
when no namespaces exist and processing all namespaces was requested.
Link: https://patchwork.kernel.org/patch/11681431/
Link: https://lore.kernel.org/r/32c8cd8d2716f5e52aebea4e4d303eeb4e0550f9.1609938610.git.msuchanek@suse.de
Reviewed-by: Santosh S <santosh@fossix.org>
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
diff --git a/ndctl/namespace.c b/ndctl/namespace.c
index 5e65ed5..cd822b3 100644
--- a/ndctl/namespace.c
+++ b/ndctl/namespace.c
@@ -2151,6 +2151,9 @@ static int do_xaction_namespace(const char *namespace,
if (!namespace && action != ACTION_CREATE)
return rc;
+ if (namespace && (strcmp(namespace, "all") == 0))
+ rc = 0;
+
if (verbose)
ndctl_set_log_priority(ctx, LOG_DEBUG);

View File

@ -1,201 +0,0 @@
test: Don't skip tests if nfit modules are missing
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2141031
commit 1649ad9c3e2c6e9c47870c8d3b54f10b24177bc7
Author: Santosh Sivaraj <santosh@fossix.org>
Date: Thu May 13 11:42:16 2021 +0530
test: Don't skip tests if nfit modules are missing
For NFIT to be available ACPI is a must, so don't fail when nfit modules
are missing on a platform that doesn't support ACPI.
Link: https://lore.kernel.org/r/20210513061218.760322-2-santosh@fossix.org
Signed-off-by: Santosh Sivaraj <santosh@fossix.org>
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
diff --git a/test.h b/test.h
index cba8d41..7de13fe 100644
--- a/test.h
+++ b/test.h
@@ -20,7 +20,7 @@ void builtin_xaction_namespace_reset(void);
struct kmod_ctx;
struct kmod_module;
-int nfit_test_init(struct kmod_ctx **ctx, struct kmod_module **mod,
+int ndctl_test_init(struct kmod_ctx **ctx, struct kmod_module **mod,
struct ndctl_ctx *nd_ctx, int log_level,
struct ndctl_test *test);
diff --git a/test/ack-shutdown-count-set.c b/test/ack-shutdown-count-set.c
index fb1d82b..c561ff3 100644
--- a/test/ack-shutdown-count-set.c
+++ b/test/ack-shutdown-count-set.c
@@ -99,7 +99,7 @@ static int test_ack_shutdown_count_set(int loglevel, struct ndctl_test *test,
int result = EXIT_FAILURE, err;
ndctl_set_log_priority(ctx, loglevel);
- err = nfit_test_init(&kmod_ctx, &mod, NULL, loglevel, test);
+ err = ndctl_test_init(&kmod_ctx, &mod, NULL, loglevel, test);
if (err < 0) {
result = 77;
ndctl_test_skip(test);
diff --git a/test/blk_namespaces.c b/test/blk_namespaces.c
index d7f00cb..f076e85 100644
--- a/test/blk_namespaces.c
+++ b/test/blk_namespaces.c
@@ -228,7 +228,7 @@ int test_blk_namespaces(int log_level, struct ndctl_test *test,
if (!bus) {
fprintf(stderr, "ACPI.NFIT unavailable falling back to nfit_test\n");
- rc = nfit_test_init(&kmod_ctx, &mod, NULL, log_level, test);
+ rc = ndctl_test_init(&kmod_ctx, &mod, NULL, log_level, test);
ndctl_invalidate(ctx);
bus = ndctl_bus_get_by_provider(ctx, "nfit_test.0");
if (rc < 0 || !bus) {
diff --git a/test/core.c b/test/core.c
index cc7d8d9..2b03aa9 100644
--- a/test/core.c
+++ b/test/core.c
@@ -11,6 +11,7 @@
#include <util/log.h>
#include <util/sysfs.h>
#include <ndctl/libndctl.h>
+#include <ndctl/ndctl.h>
#include <ccan/array_size/array_size.h>
#define KVER_STRLEN 20
@@ -106,11 +107,11 @@ int ndctl_test_get_skipped(struct ndctl_test *test)
return test->skip;
}
-int nfit_test_init(struct kmod_ctx **ctx, struct kmod_module **mod,
+int ndctl_test_init(struct kmod_ctx **ctx, struct kmod_module **mod,
struct ndctl_ctx *nd_ctx, int log_level,
struct ndctl_test *test)
{
- int rc;
+ int rc, family = -1;
unsigned int i;
const char *name;
struct ndctl_bus *bus;
@@ -127,10 +128,28 @@ int nfit_test_init(struct kmod_ctx **ctx, struct kmod_module **mod,
"nd_e820",
"nd_pmem",
};
+ char *test_env;
log_init(&log_ctx, "test/init", "NDCTL_TEST");
log_ctx.log_priority = log_level;
+ /*
+ * The following two checks determine the platform family. For
+ * Intel/platforms which support ACPI, check sysfs; for other platforms
+ * determine from the environment variable NVDIMM_TEST_FAMILY
+ */
+ if (access("/sys/bus/acpi", F_OK) == 0)
+ family = NVDIMM_FAMILY_INTEL;
+
+ test_env = getenv("NDCTL_TEST_FAMILY");
+ if (test_env && strcmp(test_env, "PAPR") == 0)
+ family = NVDIMM_FAMILY_PAPR;
+
+ if (family == -1) {
+ log_err(&log_ctx, "Cannot determine NVDIMM family\n");
+ return -ENOTSUP;
+ }
+
*ctx = kmod_new(NULL, NULL);
if (!*ctx)
return -ENXIO;
@@ -185,6 +204,11 @@ retry:
path = kmod_module_get_path(*mod);
if (!path) {
+ if (family != NVDIMM_FAMILY_INTEL &&
+ (strcmp(name, "nfit") == 0 ||
+ strcmp(name, "nd_e820") == 0))
+ continue;
+
log_err(&log_ctx, "%s.ko: failed to get path\n", name);
break;
}
diff --git a/test/dpa-alloc.c b/test/dpa-alloc.c
index e922009..0b3bb7a 100644
--- a/test/dpa-alloc.c
+++ b/test/dpa-alloc.c
@@ -289,7 +289,7 @@ int test_dpa_alloc(int loglevel, struct ndctl_test *test, struct ndctl_ctx *ctx)
return 77;
ndctl_set_log_priority(ctx, loglevel);
- err = nfit_test_init(&kmod_ctx, &mod, NULL, loglevel, test);
+ err = ndctl_test_init(&kmod_ctx, &mod, NULL, loglevel, test);
if (err < 0) {
ndctl_test_skip(test);
fprintf(stderr, "nfit_test unavailable skipping tests\n");
diff --git a/test/dsm-fail.c b/test/dsm-fail.c
index 9dfd8b0..0a6383d 100644
--- a/test/dsm-fail.c
+++ b/test/dsm-fail.c
@@ -346,7 +346,7 @@ int test_dsm_fail(int loglevel, struct ndctl_test *test, struct ndctl_ctx *ctx)
int result = EXIT_FAILURE, err;
ndctl_set_log_priority(ctx, loglevel);
- err = nfit_test_init(&kmod_ctx, &mod, NULL, loglevel, test);
+ err = ndctl_test_init(&kmod_ctx, &mod, NULL, loglevel, test);
if (err < 0) {
result = 77;
ndctl_test_skip(test);
diff --git a/test/libndctl.c b/test/libndctl.c
index c42f785..d9b50f4 100644
--- a/test/libndctl.c
+++ b/test/libndctl.c
@@ -2708,7 +2708,7 @@ int test_libndctl(int loglevel, struct ndctl_test *test, struct ndctl_ctx *ctx)
daxctl_set_log_priority(daxctl_ctx, loglevel);
ndctl_set_private_data(ctx, test);
- err = nfit_test_init(&kmod_ctx, &mod, ctx, loglevel, test);
+ err = ndctl_test_init(&kmod_ctx, &mod, ctx, loglevel, test);
if (err < 0) {
ndctl_test_skip(test);
fprintf(stderr, "nfit_test unavailable skipping tests\n");
diff --git a/test/multi-pmem.c b/test/multi-pmem.c
index 3d10952..3ea08cc 100644
--- a/test/multi-pmem.c
+++ b/test/multi-pmem.c
@@ -249,7 +249,7 @@ int test_multi_pmem(int loglevel, struct ndctl_test *test, struct ndctl_ctx *ctx
ndctl_set_log_priority(ctx, loglevel);
- err = nfit_test_init(&kmod_ctx, &mod, NULL, loglevel, test);
+ err = ndctl_test_init(&kmod_ctx, &mod, NULL, loglevel, test);
if (err < 0) {
result = 77;
ndctl_test_skip(test);
diff --git a/test/parent-uuid.c b/test/parent-uuid.c
index 6424e9f..bded33a 100644
--- a/test/parent-uuid.c
+++ b/test/parent-uuid.c
@@ -218,7 +218,7 @@ int test_parent_uuid(int loglevel, struct ndctl_test *test, struct ndctl_ctx *ct
return 77;
ndctl_set_log_priority(ctx, loglevel);
- err = nfit_test_init(&kmod_ctx, &mod, NULL, loglevel, test);
+ err = ndctl_test_init(&kmod_ctx, &mod, NULL, loglevel, test);
if (err < 0) {
ndctl_test_skip(test);
fprintf(stderr, "nfit_test unavailable skipping tests\n");
diff --git a/test/pmem_namespaces.c b/test/pmem_namespaces.c
index f0f2edd..a4db1ae 100644
--- a/test/pmem_namespaces.c
+++ b/test/pmem_namespaces.c
@@ -191,7 +191,7 @@ int test_pmem_namespaces(int log_level, struct ndctl_test *test,
if (!bus) {
fprintf(stderr, "ACPI.NFIT unavailable falling back to nfit_test\n");
- rc = nfit_test_init(&kmod_ctx, &mod, NULL, log_level, test);
+ rc = ndctl_test_init(&kmod_ctx, &mod, NULL, log_level, test);
ndctl_invalidate(ctx);
bus = ndctl_bus_get_by_provider(ctx, "nfit_test.0");
if (rc < 0 || !bus) {

File diff suppressed because it is too large Load Diff

View File

@ -1,72 +0,0 @@
test/libndctl: Use ndctl_region_set_ro() to change disk read-only state
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=
commit 43e48c0d2f271cba4237f6eefc3e4912a74c102b
Author: Dan Williams <dan.j.williams@intel.com>
Date: Tue Mar 9 22:09:49 2021 -0800
test/libndctl: Use ndctl_region_set_ro() to change disk read-only state
Kernel commit 52f019d43c22 ("block: add a hard-readonly flag to struct
gendisk") broke the read-only management test, by fixing the broken
behavior that BLKROSET could make a block device read-write even when the
disk is read-only. The fix [1] propagates changes of the region
read-only state to the underlying disk. Add ndctl_region_set_ro() ahead of
BLKROSET so that BLKROSET does not conflict the block_device state with the
disk state.
[1]: http://lore.kernel.org/r/161534060720.528671.2341213328968989192.stgit@dwillia2-desk3.amr.corp.intel.com
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Vishal Verma <vishal.l.verma@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
Link: https://lore.kernel.org/r/161535658913.530219.12194565167385663385.stgit@dwillia2-desk3.amr.corp.intel.com
Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
diff --git a/test/libndctl.c b/test/libndctl.c
index fc65149..c42f785 100644
--- a/test/libndctl.c
+++ b/test/libndctl.c
@@ -1541,6 +1541,7 @@ static int validate_bdev(const char *devname, struct ndctl_btt *btt,
struct ndctl_pfn *pfn, struct ndctl_namespace *ndns,
struct namespace *namespace, void *buf)
{
+ struct ndctl_region *region = ndctl_namespace_get_region(ndns);
char bdevpath[50];
int fd, rc, ro;
@@ -1578,6 +1579,13 @@ static int validate_bdev(const char *devname, struct ndctl_btt *btt,
}
ro = 0;
+ rc = ndctl_region_set_ro(region, ro);
+ if (rc < 0) {
+ fprintf(stderr, "%s: ndctl_region_set_ro failed\n", devname);
+ rc = -errno;
+ goto out;
+ }
+
rc = ioctl(fd, BLKROSET, &ro);
if (rc < 0) {
fprintf(stderr, "%s: BLKROSET failed\n",
@@ -1605,8 +1613,16 @@ static int validate_bdev(const char *devname, struct ndctl_btt *btt,
rc = -ENXIO;
goto out;
}
+
+ rc = ndctl_region_set_ro(region, namespace->ro);
+ if (rc < 0) {
+ fprintf(stderr, "%s: ndctl_region_set_ro reset failed\n", devname);
+ rc = -errno;
+ goto out;
+ }
+
rc = 0;
- out:
+out:
close(fd);
return rc;
}

View File

@ -1,46 +0,0 @@
ndctl/test: make inject-smart.sh more tolerant of decimal fields
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=
commit 4921c0c2040ffbe10facd320f6a718a3d42ad815
Author: Vishal Verma <vishal.l.verma@intel.com>
Date: Thu Feb 17 22:42:29 2022 -0700
ndctl/test: make inject-smart.sh more tolerant of decimal fields
Some combinations of json-c/jq/other libraries seem to produce differing
outputs for the final jq-filtered smart fields, in that some have a
decimal "42.0" numeric field, where as in other combinations it is a
simple "42" (still a numeric field, not string).
This shouldn't matter in practice, but for this contrived test case, we
need to make sure that "42" is treated the same as "42.0"
Normalize all fields before comparing them to "%0.0f" so that the
comparison doesn't result in superfluous failures.
Reported-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
diff --git a/test/inject-smart.sh b/test/inject-smart.sh
index 8b91360..046322b 100755
--- a/test/inject-smart.sh
+++ b/test/inject-smart.sh
@@ -105,13 +105,13 @@ get_field()
json="$($NDCTL list -b $bus -d $dimm -H)"
val="$(jq -r ".[].dimms[].health.$smart_listing" <<< $json)"
val="$(translate_val $val)"
- echo $val
+ printf "%0.0f\n" "$val"
}
verify()
{
local field="$1"
- local val="$2"
+ local val="$(printf "%0.0f\n" "$2")"
[[ "$val" == "$(get_field $field)" ]]
}

View File

@ -1,48 +0,0 @@
ndctl/scrub: Reread scrub-engine status at start
BZ:
Brew:
commit 4e646fa490ba4b782afa188dd8818b94c419924e
Author: Dan Williams <dan.j.williams@intel.com>
Date: Wed May 26 16:33:10 2021 -0700
ndctl/scrub: Reread scrub-engine status at start
Given that the kernel has exponential backoff to cover the lack of
interrupts for scrub completion status there is a reasonable likelihood
that 'ndctl start-scrub' is issued while the hardware/platform scrub-state
is idle, but the kernel engine poll timer has not fired.
Trigger at least one poll cycle for the kernel to re-read the scrub-state
before reporting that ARS is busy.
Link: https://lore.kernel.org/r/162207199057.3715490.2469820075085914776.stgit@dwillia2-desk3.amr.corp.intel.com
Reported-by: Krzysztof Rusocki <krzysztof.rusocki@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
diff --git a/ndctl/lib/libndctl.c b/ndctl/lib/libndctl.c
index e5641fe..536e142 100644
--- a/ndctl/lib/libndctl.c
+++ b/ndctl/lib/libndctl.c
@@ -1354,8 +1354,18 @@ static int __ndctl_bus_get_scrub_state(struct ndctl_bus *bus,
NDCTL_EXPORT int ndctl_bus_start_scrub(struct ndctl_bus *bus)
{
struct ndctl_ctx *ctx = ndctl_bus_get_ctx(bus);
+ int rc;
+
+ rc = sysfs_write_attr(ctx, bus->scrub_path, "1\n");
- return sysfs_write_attr(ctx, bus->scrub_path, "1\n");
+ /*
+ * Try at least 1 poll cycle before reporting busy in case this
+ * request hits the kernel's exponential backoff while the
+ * hardware/platform scrub state is idle.
+ */
+ if (rc == -EBUSY && ndctl_bus_poll_scrub_completion(bus, 1, 1) == 0)
+ return sysfs_write_attr(ctx, bus->scrub_path, "1\n");
+ return rc;
}
NDCTL_EXPORT int ndctl_bus_get_scrub_state(struct ndctl_bus *bus)

View File

@ -1,409 +0,0 @@
ndctl/test: Move 'reset()' to function in 'common'
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2141031
commit 6538529be5738f06543a0d7178f97e0b0e6b63c2
Author: Dan Williams <dan.j.williams@intel.com>
Date: Wed Jan 5 13:31:55 2022 -0800
ndctl/test: Move 'reset()' to function in 'common'
When BLK mode is removed, tests that expect the nfit_test region to allow
pmem namespace creation will need to 'init' rather than 'zero' labels. In
preparation, take the time opportunity to move reset() to a common
function. So that 'ndctl zero-labels' can be replaced with 'ndctl
init-labels' in one central location.
Link: https://lore.kernel.org/r/164141831509.3990253.14783946910211635678.stgit@dwillia2-desk3.amr.corp.intel.com
Tested-by: Alison Schofield <alison.schofield@intel.com>
Tested-by: Vaibhav Jain <vaibhav@linux.ibm.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
diff --git a/test/blk-exhaust.sh b/test/blk-exhaust.sh
index 09c4aae..b6d3808 100755
--- a/test/blk-exhaust.sh
+++ b/test/blk-exhaust.sh
@@ -14,9 +14,7 @@ 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
+reset
# if the kernel accounting is correct we should be able to create two
# pmem and two blk namespaces on nfit_test.0
diff --git a/test/btt-check.sh b/test/btt-check.sh
index 8e0b489..65b5c58 100755
--- a/test/btt-check.sh
+++ b/test/btt-check.sh
@@ -39,13 +39,6 @@ create()
[ $size -gt 0 ] || err "$LINENO"
}
-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
-}
-
# re-enable the BTT namespace, and do IO to it in an attempt to
# verify it still comes up ok, and functions as expected
post_repair_test()
diff --git a/test/btt-errors.sh b/test/btt-errors.sh
index 4e59f57..5a20d26 100755
--- a/test/btt-errors.sh
+++ b/test/btt-errors.sh
@@ -45,9 +45,7 @@ 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
+reset
rc=1
@@ -126,9 +124,7 @@ 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
+reset
dev="x"
json=$($NDCTL create-namespace -b $NFIT_TEST_BUS0 -t pmem -m sector)
eval "$(echo "$json" | json2var)"
@@ -148,9 +144,7 @@ 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
+reset
cleanup
_cleanup
exit 0
diff --git a/test/btt-pad-compat.sh b/test/btt-pad-compat.sh
index bf1ea54..be538b7 100755
--- a/test/btt-pad-compat.sh
+++ b/test/btt-pad-compat.sh
@@ -37,13 +37,6 @@ create()
fi
}
-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
-}
-
verify_idx()
{
idx0="$1"
diff --git a/test/clear.sh b/test/clear.sh
index fb9d52c..c4d02d5 100755
--- a/test/clear.sh
+++ b/test/clear.sh
@@ -14,9 +14,7 @@ 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
+reset
rc=1
diff --git a/test/common b/test/common
index 6bcefca..3c54d63 100644
--- a/test/common
+++ b/test/common
@@ -46,6 +46,21 @@ err()
exit $rc
}
+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
+}
+
+reset1()
+{
+ $NDCTL disable-region -b $NFIT_TEST_BUS1 all
+ $NDCTL zero-labels -b $NFIT_TEST_BUS1 all
+ $NDCTL enable-region -b $NFIT_TEST_BUS1 all
+}
+
+
# check_min_kver
# $1: Supported kernel version. format: X.Y
#
diff --git a/test/create.sh b/test/create.sh
index b0fd99f..e9baaa0 100755
--- a/test/create.sh
+++ b/test/create.sh
@@ -15,9 +15,7 @@ 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
+reset
rc=1
diff --git a/test/daxctl-create.sh b/test/daxctl-create.sh
index 198779a..d319a39 100755
--- a/test/daxctl-create.sh
+++ b/test/daxctl-create.sh
@@ -10,7 +10,7 @@ trap 'cleanup $LINENO' ERR
cleanup()
{
printf "Error at line %d\n" "$1"
- [[ $testdev ]] && reset
+ [[ $testdev ]] && reset_dax
exit $rc
}
@@ -70,7 +70,7 @@ reset_dev()
"$DAXCTL" enable-device "$testdev"
}
-reset()
+reset_dax()
{
test -n "$testdev"
diff --git a/test/daxdev-errors.sh b/test/daxdev-errors.sh
index 9547d78..e13453d 100755
--- a/test/daxdev-errors.sh
+++ b/test/daxdev-errors.sh
@@ -15,9 +15,7 @@ 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
+reset
rc=1
diff --git a/test/firmware-update.sh b/test/firmware-update.sh
index 8cc9c41..93ce166 100755
--- a/test/firmware-update.sh
+++ b/test/firmware-update.sh
@@ -10,11 +10,9 @@ image="update-fw.img"
trap 'err $LINENO' ERR
-reset()
+fwupd_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
+ reset
if [ -f $image ]; then
rm -f $image
fi
@@ -73,7 +71,7 @@ do_tests()
check_min_kver "4.16" || do_skip "may lack firmware update test handling"
modprobe nfit_test
-reset
+fwupd_reset
detect
rc=1
do_tests
diff --git a/test/inject-error.sh b/test/inject-error.sh
index 7d0b826..fd823b6 100755
--- a/test/inject-error.sh
+++ b/test/inject-error.sh
@@ -37,13 +37,6 @@ create()
[ $size -gt 0 ] || err "$LINENO"
}
-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
-}
-
check_status()
{
local sector="$1"
diff --git a/test/max_available_extent_ns.sh b/test/max_available_extent_ns.sh
index 343f3c9..47a921f 100755
--- a/test/max_available_extent_ns.sh
+++ b/test/max_available_extent_ns.sh
@@ -11,13 +11,6 @@ trap 'err $LINENO' ERR
check_min_kver "4.19" || do_skip "kernel $KVER may not support max_available_size"
check_prereq "jq"
-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
-}
-
do_test()
{
region=$($NDCTL list -b $NFIT_TEST_BUS0 -R -t pmem | jq -r 'sort_by(-.size) | .[].dev' | head -1)
@@ -40,7 +33,7 @@ do_test()
modprobe nfit_test
rc=1
-init
+reset
do_test
_cleanup
exit 0
diff --git a/test/monitor.sh b/test/monitor.sh
index c015c11..6aa4196 100755
--- a/test/monitor.sh
+++ b/test/monitor.sh
@@ -19,13 +19,6 @@ trap 'err $LINENO' ERR
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
-}
-
start_monitor()
{
logfile=$(mktemp)
@@ -112,7 +105,7 @@ test_filter_region()
test_filter_namespace()
{
- init
+ reset
monitor_namespace=$($NDCTL create-namespace -b $smart_supported_bus | jq -r .dev)
monitor_dimms=$(get_monitor_dimm "-n $monitor_namespace")
start_monitor "-n $monitor_namespace"
@@ -170,7 +163,7 @@ do_tests()
modprobe nfit_test
rc=1
-init
+reset
set_smart_supported_bus
do_tests
_cleanup
diff --git a/test/multi-dax.sh b/test/multi-dax.sh
index b343a38..04070ad 100755
--- a/test/multi-dax.sh
+++ b/test/multi-dax.sh
@@ -17,9 +17,7 @@ ALIGN_SIZE=`getconf PAGESIZE`
# 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
+reset
rc=1
query=". | sort_by(.available_size) | reverse | .[0].dev"
diff --git a/test/pfn-meta-errors.sh b/test/pfn-meta-errors.sh
index 0ade2e5..6314897 100755
--- a/test/pfn-meta-errors.sh
+++ b/test/pfn-meta-errors.sh
@@ -29,9 +29,7 @@ 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
+reset
rc=1
diff --git a/test/pmem-errors.sh b/test/pmem-errors.sh
index 4225c3b..2065780 100755
--- a/test/pmem-errors.sh
+++ b/test/pmem-errors.sh
@@ -28,9 +28,7 @@ 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
+reset
rc=1
diff --git a/test/rescan-partitions.sh b/test/rescan-partitions.sh
index 1686de3..51bbd73 100755
--- a/test/rescan-partitions.sh
+++ b/test/rescan-partitions.sh
@@ -25,13 +25,6 @@ check_min_kver "4.16" || do_skip "may not contain fixes for partition rescanning
check_prereq "parted"
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
-}
-
test_mode()
{
local mode="$1"
diff --git a/test/sector-mode.sh b/test/sector-mode.sh
index 7a2faea..439ef33 100755
--- a/test/sector-mode.sh
+++ b/test/sector-mode.sh
@@ -15,13 +15,8 @@ ALIGN_SIZE=`getconf PAGESIZE`
# 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 $NFIT_TEST_BUS1 all
-$NDCTL zero-labels -b $NFIT_TEST_BUS1 all
-$NDCTL enable-region -b $NFIT_TEST_BUS1 all
+reset
+reset1
rc=1
query=". | sort_by(.size) | reverse | .[0].dev"
diff --git a/test/track-uuid.sh b/test/track-uuid.sh
index be3cf9c..3bacd2c 100755
--- a/test/track-uuid.sh
+++ b/test/track-uuid.sh
@@ -12,9 +12,7 @@ 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
+reset
rc=1

View File

@ -1,41 +0,0 @@
ndtest/ack-shutdown-count: Skip the test on ndtest
BZ:
Brew:
commit 6e85cac1958f920f231b94ff570ac0e434595b7d
Author: Shivaprasad G Bhat <sbhat@linux.ibm.com>
Date: Tue Jan 25 02:34:25 2022 +0530
ndtest/ack-shutdown-count: Skip the test on ndtest
The PAPR has non-latched dirty shutdown implementation.
The test is enabling/disabling the LSS latch which is
irrelavent from PAPR pov. Skip the test.
Link: https://lore.kernel.org/r/20220124210425.1493410-1-vaibhav@linux.ibm.com
Signed-off-by: Shivaprasad G Bhat <sbhat@linux.ibm.com>
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
diff --git a/test/ack-shutdown-count-set.c b/test/ack-shutdown-count-set.c
index a9e95c6..f091a40 100644
--- a/test/ack-shutdown-count-set.c
+++ b/test/ack-shutdown-count-set.c
@@ -117,6 +117,7 @@ static int test_ack_shutdown_count_set(int loglevel, struct ndctl_test *test,
int main(int argc, char *argv[])
{
+ char *test_env = getenv("NDCTL_TEST_FAMILY");
struct ndctl_test *test = ndctl_test_new(0);
struct ndctl_ctx *ctx;
int rc;
@@ -126,6 +127,9 @@ int main(int argc, char *argv[])
return EXIT_FAILURE;
}
+ if (test_env && strcmp(test_env, "PAPR") == 0)
+ return ndctl_test_result(test, 77);
+
rc = ndctl_new(&ctx);
if (rc)
return ndctl_test_result(test, rc);

View File

@ -1,42 +0,0 @@
ndctl/test: Skip BLK flags checks
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2141031
commit 756a6598a0fa6cebdd0e98564af089ca6b463fb1
Author: Dan Williams <dan.j.williams@intel.com>
Date: Wed Jan 5 13:32:05 2022 -0800
ndctl/test: Skip BLK flags checks
With the removal of BLK-mode support, test/libndctl will fail to detect the
JEDEC format on the nfit_test bus. Report + skip that check rather than
fail the test when that happens.
Link: https://lore.kernel.org/r/164141832529.3990253.16538298357542644310.stgit@dwillia2-desk3.amr.corp.intel.com
Tested-by: Alison Schofield <alison.schofield@intel.com>
Tested-by: Vaibhav Jain <vaibhav@linux.ibm.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
diff --git a/test/libndctl.c b/test/libndctl.c
index c0e4b4c..1e97926 100644
--- a/test/libndctl.c
+++ b/test/libndctl.c
@@ -2535,7 +2535,7 @@ static int check_dimms(struct ndctl_bus *bus, struct dimm *dimms, int n,
fprintf(stderr, "dimm%d expected formats: %d got: %d\n",
i, dimms[i].formats,
ndctl_dimm_get_formats(dimm));
- return -ENXIO;
+ fprintf(stderr, "continuing...\n");
}
for (j = 0; j < dimms[i].formats; j++) {
if (ndctl_dimm_get_formatN(dimm, j) != dimms[i].format[j]) {
@@ -2543,7 +2543,7 @@ static int check_dimms(struct ndctl_bus *bus, struct dimm *dimms, int n,
"dimm%d expected format[%d]: %d got: %d\n",
i, j, dimms[i].format[j],
ndctl_dimm_get_formatN(dimm, j));
- return -ENXIO;
+ fprintf(stderr, "continuing...\n");
}
}
}

View File

@ -1,118 +0,0 @@
ndctl/test: add checking the presence of jq command ahead
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2141031
commit 7ce2fddfa3f108036a2d81de4d2e66ac29e4631e
Author: QI Fuli <qi.fuli@fujitsu.com>
Date: Wed Feb 3 22:21:08 2021 +0900
ndctl/test: add checking the presence of jq command ahead
Due to the lack of jq command, the result of the test will be 'fail'.
This patch adds checking the presence of jq commmand ahead.
If there is no jq command in the system, the test will be marked as 'skip'.
Signed-off-by: QI Fuli <qi.fuli@fujitsu.com>
Link: https://github.com/pmem/ndctl/issues/141
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
Link: https://lore.kernel.org/r/20210203132108.6246-1-qi.fuli@fujitsu.com
diff --git a/test/daxdev-errors.sh b/test/daxdev-errors.sh
index 6281f32..9547d78 100755
--- a/test/daxdev-errors.sh
+++ b/test/daxdev-errors.sh
@@ -9,6 +9,7 @@ rc=77
. $(dirname $0)/common
check_min_kver "4.12" || do_skip "lacks dax dev error handling"
+check_prereq "jq"
trap 'err $LINENO' ERR
diff --git a/test/inject-error.sh b/test/inject-error.sh
index c636033..7d0b826 100755
--- a/test/inject-error.sh
+++ b/test/inject-error.sh
@@ -11,6 +11,8 @@ err_count=8
. $(dirname $0)/common
+check_prereq "jq"
+
trap 'err $LINENO' ERR
# sample json:
diff --git a/test/inject-smart.sh b/test/inject-smart.sh
index 94705df..4ca83b8 100755
--- a/test/inject-smart.sh
+++ b/test/inject-smart.sh
@@ -166,6 +166,7 @@ do_tests()
}
check_min_kver "4.19" || do_skip "kernel $KVER may not support smart (un)injection"
+check_prereq "jq"
modprobe nfit_test
rc=1
diff --git a/test/label-compat.sh b/test/label-compat.sh
index 340b93d..8ab2858 100755
--- a/test/label-compat.sh
+++ b/test/label-compat.sh
@@ -10,6 +10,7 @@ BASE=$(dirname $0)
. $BASE/common
check_min_kver "4.11" || do_skip "may not provide reliable isetcookie values"
+check_prereq "jq"
trap 'err $LINENO' ERR
diff --git a/test/max_available_extent_ns.sh b/test/max_available_extent_ns.sh
index 14d741d..343f3c9 100755
--- a/test/max_available_extent_ns.sh
+++ b/test/max_available_extent_ns.sh
@@ -9,6 +9,7 @@ rc=77
trap 'err $LINENO' ERR
check_min_kver "4.19" || do_skip "kernel $KVER may not support max_available_size"
+check_prereq "jq"
init()
{
diff --git a/test/monitor.sh b/test/monitor.sh
index cdab5e1..28c5541 100755
--- a/test/monitor.sh
+++ b/test/monitor.sh
@@ -13,6 +13,8 @@ smart_supported_bus=""
. $(dirname $0)/common
+check_prereq "jq"
+
trap 'err $LINENO' ERR
check_min_kver "4.15" || do_skip "kernel $KVER may not support monitor service"
diff --git a/test/multi-dax.sh b/test/multi-dax.sh
index e932569..8496619 100755
--- a/test/multi-dax.sh
+++ b/test/multi-dax.sh
@@ -9,6 +9,7 @@ rc=77
. $(dirname $0)/common
check_min_kver "4.13" || do_skip "may lack multi-dax support"
+check_prereq "jq"
trap 'err $LINENO' ERR
diff --git a/test/sector-mode.sh b/test/sector-mode.sh
index dd7013e..54fa806 100755
--- a/test/sector-mode.sh
+++ b/test/sector-mode.sh
@@ -6,6 +6,8 @@ rc=77
. $(dirname $0)/common
+check_prereq "jq"
+
set -e
trap 'err $LINENO' ERR

View File

@ -1,84 +0,0 @@
namespace-action: Drop zero namespace checks.
BZ:
Brew:
commit 80e0d88c3098bd419e26146a8cb3b693fdd06417
Author: Santosh Sivaraj <santosh@fossix.org>
Date: Wed Jan 6 14:17:42 2021 +0100
namespace-action: Drop zero namespace checks.
With seed namespaces catched early on these checks for sizes in enable
and destroy namespace code path are not needed.
Reverts commit b9cb03f6d5a8 ("ndctl/namespace: Fix enable-namespace
error for seed namespaces")
Reverts commit e01045e58ad5 ("ndctl/namespace: Fix destroy-namespace
accounting relative to seed devices")
Link: https://patchwork.kernel.org/patch/11739975/
Link: https://lore.kernel.org/r/eb4bc7885708fa13e3d37286bc4a4219b1e4e5b6.1609938610.git.msuchanek@suse.de
Fixes: b9cb03f6d5a8 ("ndctl/namespace: Fix enable-namespace error for seed namespaces")
Fixes: e01045e58ad5 ("ndctl/namespace: Fix destroy-namespace accounting relative to seed devices")
Signed-off-by: Santosh Sivaraj <santosh@fossix.org>
[rebased on top of the previous patches]
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
diff --git a/ndctl/lib/libndctl.c b/ndctl/lib/libndctl.c
index 536e142..87f60b9 100644
--- a/ndctl/lib/libndctl.c
+++ b/ndctl/lib/libndctl.c
@@ -4531,16 +4531,11 @@ NDCTL_EXPORT int ndctl_namespace_enable(struct ndctl_namespace *ndns)
const char *devname = ndctl_namespace_get_devname(ndns);
struct ndctl_ctx *ctx = ndctl_namespace_get_ctx(ndns);
struct ndctl_region *region = ndns->region;
- unsigned long long size = ndctl_namespace_get_size(ndns);
int rc;
if (ndctl_namespace_is_enabled(ndns))
return 0;
- /* Don't try to enable idle namespace (no capacity allocated) */
- if (size == 0)
- return -ENXIO;
-
rc = ndctl_bind(ctx, ndns->module, devname);
/*
diff --git a/ndctl/namespace.c b/ndctl/namespace.c
index cd822b3..c67c086 100644
--- a/ndctl/namespace.c
+++ b/ndctl/namespace.c
@@ -1164,15 +1164,12 @@ static int namespace_destroy(struct ndctl_region *region,
struct ndctl_namespace *ndns)
{
const char *devname = ndctl_namespace_get_devname(ndns);
- unsigned long long size;
int rc;
rc = namespace_prep_reconfig(region, ndns);
if (rc < 0)
return rc;
- size = ndctl_namespace_get_size(ndns);
-
/* Labeled namespace, destroy label / allocation */
if (rc == 2) {
rc = ndctl_namespace_delete(ndns);
@@ -1180,13 +1177,6 @@ static int namespace_destroy(struct ndctl_region *region,
debug("%s: failed to reclaim\n", devname);
}
- /*
- * Don't report a destroyed namespace when no capacity was
- * allocated.
- */
- if (size == 0 && rc == 0)
- rc = 1;
-
return rc;
}

View File

@ -1,57 +0,0 @@
ndctl/namespace: Skip seed namespaces when processing all namespaces.
BZ:
Brew:
commit 9bd2994f91bb77604521cbe09a76a51d092c2cfd
Author: Michal Suchanek <msuchanek@suse.de>
Date: Wed Jan 6 14:17:40 2021 +0100
ndctl/namespace: Skip seed namespaces when processing all namespaces.
The seed namespaces are exposed by the kernel but most operations are
not valid on seed namespaces.
When processing all namespaces the user gets confusing errors from ndctl
trying to process seed namespaces. The kernel does not provide any way
to tell that a namspace is seed namespace but skipping namespaces with
zero size and UUID is a good heuristic.
The user can still specify the namespace by name directly in case
processing it is desirable.
Link: https://patchwork.kernel.org/patch/11473645/
Link: https://lore.kernel.org/r/e55ae2c17b8b9c3288491efe6214338118e8c5ae.1609938610.git.msuchanek@suse.de
Fixes: #41
Tested-by: Harish Sriram <harish@linux.ibm.com>
Reviewed-by: Santosh S <santosh@fossix.org>
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
diff --git a/ndctl/namespace.c b/ndctl/namespace.c
index 1e8a2cd..5e65ed5 100644
--- a/ndctl/namespace.c
+++ b/ndctl/namespace.c
@@ -2210,9 +2210,19 @@ static int do_xaction_namespace(const char *namespace,
ndctl_namespace_foreach_safe(region, ndns, _n) {
ndns_name = ndctl_namespace_get_devname(ndns);
- if (strcmp(namespace, "all") != 0
- && strcmp(namespace, ndns_name) != 0)
- continue;
+ if (strcmp(namespace, "all") == 0) {
+ static const uuid_t zero_uuid;
+ uuid_t uuid;
+
+ ndctl_namespace_get_uuid(ndns, uuid);
+ if (!ndctl_namespace_get_size(ndns) &&
+ !memcmp(uuid, zero_uuid, sizeof(uuid_t)))
+ continue;
+ } else {
+ if (strcmp(namespace, ndns_name) != 0)
+ continue;
+ }
+
switch (action) {
case ACTION_DISABLE:
rc = ndctl_namespace_disable_safe(ndns);

View File

@ -1,179 +0,0 @@
libndctl/papr: Add limited support for inject-smart
BZ:
Brew:
commit 9ef460eb7fd1b1f286955b18db8c18cd1a640e77
Author: Vaibhav Jain <vaibhav@linux.ibm.com>
Date: Tue Jan 25 02:08:04 2022 +0530
libndctl/papr: Add limited support for inject-smart
Implements support for ndctl inject-smart command by providing an
implementation of 'smart_inject*' dimm-ops callbacks. Presently only
support for injecting unsafe-shutdown and fatal-health states is
available.
The patch also introduce various PAPR PDSM structures that are used to
communicate the inject-smart errors to the papr_scm kernel
module. This is done via SMART_INJECT PDSM which sends a payload of
type 'struct nd_papr_pdsm_smart_inject'.
With the patch following output from ndctl inject-smart command is
expected for PAPR NVDIMMs:
$ sudo ndctl inject-smart -fU nmem0
[
{
"dev":"nmem0",
"flag_failed_flush":true,
"flag_smart_event":true,
"health":{
"health_state":"fatal",
"shutdown_state":"dirty",
"shutdown_count":0
}
}
]
$ sudo ndctl inject-smart -N nmem0
[
{
"dev":"nmem0",
"health":{
"health_state":"ok",
"shutdown_state":"clean",
"shutdown_count":0
}
}
]
The patch depends on the kernel PAPR PDSM implementation for
PDSM_SMART_INJECT posted at [1].
[1] : https://lore.kernel.org/nvdimm/20220124202204.1488346-1-vaibhav@linux.ibm.com/
Link: https://lore.kernel.org/r/20220124203804.1490254-1-vaibhav@linux.ibm.com
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Shivaprasad G Bhat <sbhat@linux.ibm.com>
Signed-off-by: Vaibhav Jain <vaibhav@linux.ibm.com>
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
diff --git a/ndctl/lib/papr.c b/ndctl/lib/papr.c
index 46cf9c1..7a1d559 100644
--- a/ndctl/lib/papr.c
+++ b/ndctl/lib/papr.c
@@ -221,6 +221,41 @@ static unsigned int papr_smart_get_shutdown_state(struct ndctl_cmd *cmd)
return health.dimm_bad_shutdown;
}
+static int papr_smart_inject_supported(struct ndctl_dimm *dimm)
+{
+ if (!ndctl_dimm_is_cmd_supported(dimm, ND_CMD_CALL))
+ return -EOPNOTSUPP;
+
+ if (!test_dimm_dsm(dimm, PAPR_PDSM_SMART_INJECT))
+ return -EIO;
+
+ return ND_SMART_INJECT_HEALTH_STATE | ND_SMART_INJECT_UNCLEAN_SHUTDOWN;
+}
+
+static int papr_smart_inject_valid(struct ndctl_cmd *cmd)
+{
+ if (cmd->type != ND_CMD_CALL ||
+ to_pdsm(cmd)->cmd_status != 0 ||
+ to_pdsm_cmd(cmd) != PAPR_PDSM_SMART_INJECT)
+ return -EINVAL;
+
+ return 0;
+}
+
+static struct ndctl_cmd *papr_new_smart_inject(struct ndctl_dimm *dimm)
+{
+ struct ndctl_cmd *cmd;
+
+ cmd = allocate_cmd(dimm, PAPR_PDSM_SMART_INJECT,
+ sizeof(struct nd_papr_pdsm_smart_inject));
+ if (!cmd)
+ return NULL;
+ /* Set the input payload size */
+ to_ndcmd(cmd)->nd_size_in = ND_PDSM_HDR_SIZE +
+ sizeof(struct nd_papr_pdsm_smart_inject);
+ return cmd;
+}
+
static unsigned int papr_smart_get_life_used(struct ndctl_cmd *cmd)
{
struct nd_papr_pdsm_health health;
@@ -255,11 +290,37 @@ static unsigned int papr_smart_get_shutdown_count(struct ndctl_cmd *cmd)
return (health.extension_flags & PDSM_DIMM_DSC_VALID) ?
(health.dimm_dsc) : 0;
+}
+
+static int papr_cmd_smart_inject_fatal(struct ndctl_cmd *cmd, bool enable)
+{
+ if (papr_smart_inject_valid(cmd) < 0)
+ return -EINVAL;
+
+ to_payload(cmd)->inject.flags |= PDSM_SMART_INJECT_HEALTH_FATAL;
+ to_payload(cmd)->inject.fatal_enable = enable;
+ return 0;
+}
+
+static int papr_cmd_smart_inject_unsafe_shutdown(struct ndctl_cmd *cmd,
+ bool enable)
+{
+ if (papr_smart_inject_valid(cmd) < 0)
+ return -EINVAL;
+
+ to_payload(cmd)->inject.flags |= PDSM_SMART_INJECT_BAD_SHUTDOWN;
+ to_payload(cmd)->inject.unsafe_shutdown_enable = enable;
+
+ return 0;
}
struct ndctl_dimm_ops * const papr_dimm_ops = &(struct ndctl_dimm_ops) {
.cmd_is_supported = papr_cmd_is_supported,
+ .new_smart_inject = papr_new_smart_inject,
+ .smart_inject_supported = papr_smart_inject_supported,
+ .smart_inject_fatal = papr_cmd_smart_inject_fatal,
+ .smart_inject_unsafe_shutdown = papr_cmd_smart_inject_unsafe_shutdown,
.smart_get_flags = papr_smart_get_flags,
.get_firmware_status = papr_get_firmware_status,
.xlat_firmware_status = papr_xlat_firmware_status,
diff --git a/ndctl/lib/papr_pdsm.h b/ndctl/lib/papr_pdsm.h
index f45b1e4..20ac20f 100644
--- a/ndctl/lib/papr_pdsm.h
+++ b/ndctl/lib/papr_pdsm.h
@@ -121,12 +121,29 @@ struct nd_papr_pdsm_health {
enum papr_pdsm {
PAPR_PDSM_MIN = 0x0,
PAPR_PDSM_HEALTH,
+ PAPR_PDSM_SMART_INJECT,
PAPR_PDSM_MAX,
};
+/* Flags for injecting specific smart errors */
+#define PDSM_SMART_INJECT_HEALTH_FATAL (1 << 0)
+#define PDSM_SMART_INJECT_BAD_SHUTDOWN (1 << 1)
+
+struct nd_papr_pdsm_smart_inject {
+ union {
+ struct {
+ /* One or more of PDSM_SMART_INJECT_ */
+ __u32 flags;
+ __u8 fatal_enable;
+ __u8 unsafe_shutdown_enable;
+ };
+ __u8 buf[ND_PDSM_PAYLOAD_MAX_SIZE];
+ };
+};
/* Maximal union that can hold all possible payload types */
union nd_pdsm_payload {
struct nd_papr_pdsm_health health;
+ struct nd_papr_pdsm_smart_inject inject;
__u8 buf[ND_PDSM_PAYLOAD_MAX_SIZE];
} __attribute__((packed));

View File

@ -1,133 +0,0 @@
libndctl/papr: Add support for reporting shutdown-count
BZ:
Brew:
commit aa990008f48f21121474a411d829f24e832c89a2
Author: Vaibhav Jain <vaibhav@linux.ibm.com>
Date: Tue Jan 25 00:26:05 2022 +0530
libndctl/papr: Add support for reporting shutdown-count
Add support for reporting dirty-shutdown-count (DSC) for PAPR based
NVDIMMs. The sysfs attribute exposing this value is located at
nmemX/papr/dirty_shutdown.
This counter is also returned in payload for PAPR_PDSM_HEALTH as newly
introduced member 'dimm_dsc' in 'struct nd_papr_pdsm_health'. Presence
of 'DSC' is indicated by the PDSM_DIMM_DSC_VALID extension flag.
The patch implements 'ndctl_dimm_ops.smart_get_shutdown_count'
callback in implemented as papr_smart_get_shutdown_count().
Kernel side changes to support reporting DSC have been merged to linux kernel
via patch proposed at [1]. With updated kernel 'ndctl list -DH' reports
following output on PPC64:
$ sudo ndctl list -DH
[
{
"dev":"nmem0",
"health":{
"health_state":"ok",
"life_used_percentage":50,
"shutdown_state":"clean",
"shutdown_count":10
}
}
]
[1] http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20210624080621.252038-1-vaibhav@linux.ibm.com
Link: https://lore.kernel.org/r/20220124185605.1465681-1-vaibhav@linux.ibm.com
Signed-off-by: Vaibhav Jain <vaibhav@linux.ibm.com>
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
diff --git a/ndctl/lib/libndctl.c b/ndctl/lib/libndctl.c
index 47a234c..5979a92 100644
--- a/ndctl/lib/libndctl.c
+++ b/ndctl/lib/libndctl.c
@@ -1819,8 +1819,12 @@ static int add_papr_dimm(struct ndctl_dimm *dimm, const char *dimm_base)
/* Allocate monitor mode fd */
dimm->health_eventfd = open(path, O_RDONLY|O_CLOEXEC);
- rc = 0;
+ /* Get the dirty shutdown counter value */
+ sprintf(path, "%s/papr/dirty_shutdown", dimm_base);
+ if (sysfs_read_attr(ctx, path, buf) == 0)
+ dimm->dirty_shutdown = strtoll(buf, NULL, 0);
+ rc = 0;
} else if (strcmp(buf, "nvdimm_test") == 0) {
/* probe via common populate_dimm_attributes() */
rc = populate_dimm_attributes(dimm, dimm_base, "papr");
diff --git a/ndctl/lib/papr.c b/ndctl/lib/papr.c
index 43b8412..46cf9c1 100644
--- a/ndctl/lib/papr.c
+++ b/ndctl/lib/papr.c
@@ -165,6 +165,9 @@ static unsigned int papr_smart_get_flags(struct ndctl_cmd *cmd)
if (health.extension_flags & PDSM_DIMM_HEALTH_RUN_GAUGE_VALID)
flags |= ND_SMART_USED_VALID;
+ if (health.extension_flags & PDSM_DIMM_DSC_VALID)
+ flags |= ND_SMART_SHUTDOWN_COUNT_VALID;
+
return flags;
}
@@ -236,6 +239,25 @@ static unsigned int papr_smart_get_life_used(struct ndctl_cmd *cmd)
(100 - health.dimm_fuel_gauge) : 0;
}
+static unsigned int papr_smart_get_shutdown_count(struct ndctl_cmd *cmd)
+{
+
+ struct nd_papr_pdsm_health health;
+
+ /* Ignore in case of error or invalid pdsm */
+ if (!cmd_is_valid(cmd) ||
+ to_pdsm(cmd)->cmd_status != 0 ||
+ to_pdsm_cmd(cmd) != PAPR_PDSM_HEALTH)
+ return 0;
+
+ /* get the payload from command */
+ health = to_payload(cmd)->health;
+
+ return (health.extension_flags & PDSM_DIMM_DSC_VALID) ?
+ (health.dimm_dsc) : 0;
+
+}
+
struct ndctl_dimm_ops * const papr_dimm_ops = &(struct ndctl_dimm_ops) {
.cmd_is_supported = papr_cmd_is_supported,
.smart_get_flags = papr_smart_get_flags,
@@ -245,4 +267,5 @@ struct ndctl_dimm_ops * const papr_dimm_ops = &(struct ndctl_dimm_ops) {
.smart_get_health = papr_smart_get_health,
.smart_get_shutdown_state = papr_smart_get_shutdown_state,
.smart_get_life_used = papr_smart_get_life_used,
+ .smart_get_shutdown_count = papr_smart_get_shutdown_count,
};
diff --git a/ndctl/lib/papr_pdsm.h b/ndctl/lib/papr_pdsm.h
index 1bac8a7..f45b1e4 100644
--- a/ndctl/lib/papr_pdsm.h
+++ b/ndctl/lib/papr_pdsm.h
@@ -75,6 +75,9 @@
/* Indicate that the 'dimm_fuel_gauge' field is valid */
#define PDSM_DIMM_HEALTH_RUN_GAUGE_VALID 1
+/* Indicate that the 'dimm_dsc' field is valid */
+#define PDSM_DIMM_DSC_VALID 2
+
/*
* Struct exchanged between kernel & ndctl in for PAPR_PDSM_HEALTH
* Various flags indicate the health status of the dimm.
@@ -103,6 +106,9 @@ struct nd_papr_pdsm_health {
/* Extension flag PDSM_DIMM_HEALTH_RUN_GAUGE_VALID */
__u16 dimm_fuel_gauge;
+
+ /* Extension flag PDSM_DIMM_DSC_VALID */
+ __u64 dimm_dsc;
};
__u8 buf[ND_PDSM_PAYLOAD_MAX_SIZE];
};

View File

@ -1,42 +0,0 @@
ndctl/test: Move sector-mode to a different region
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2143636
commit b787320498508192f1e04ac38d39da4eb3ca26e9
Author: Dan Williams <dan.j.williams@intel.com>
Date: Wed Jan 5 13:32:10 2022 -0800
ndctl/test: Move sector-mode to a different region
Previously the largest region on the nfit_test.1 bus belonged to a BLK-mode
region. With the removal of BLK-mode support update the test to instead
find a suitable PMEM region to perform the checkout.
Link: https://lore.kernel.org/r/164141833068.3990253.15694496866707006837.stgit@dwillia2-desk3.amr.corp.intel.com
Tested-by: Alison Schofield <alison.schofield@intel.com>
Tested-by: Vaibhav Jain <vaibhav@linux.ibm.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
diff --git a/test/sector-mode.sh b/test/sector-mode.sh
index 439ef33..f70b0f1 100755
--- a/test/sector-mode.sh
+++ b/test/sector-mode.sh
@@ -19,11 +19,11 @@ reset
reset1
rc=1
-query=". | sort_by(.size) | reverse | .[0].dev"
-NAMESPACE=$($NDCTL list -b $NFIT_TEST_BUS1 -N | jq -r "$query")
-REGION=$($NDCTL list -R --namespace=$NAMESPACE | jq -r "(.[]) | .dev")
+query=". | sort_by(.available_size) | reverse | .[0].dev"
+REGION=$($NDCTL list -R -b $NFIT_TEST_BUS1 | jq -r "$query")
echo 0 > /sys/bus/nd/devices/$REGION/read_only
-$NDCTL create-namespace --no-autolabel -e $NAMESPACE -m sector -f -l 4K
+echo $ALIGN_SIZE > /sys/bus/nd/devices/$REGION/align
+NAMESPACE=$($NDCTL create-namespace --no-autolabel -r $REGION -m sector -f -l 4K | jq -r ".dev")
$NDCTL create-namespace --no-autolabel -e $NAMESPACE -m dax -f -a $ALIGN_SIZE
$NDCTL create-namespace --no-autolabel -e $NAMESPACE -m sector -f -l 4K

View File

@ -1,38 +0,0 @@
ndctl/scrub: Stop translating return values
BZ:
Brew:
commit c52109355b715bbe21e284090435bee7563863cc
Author: Dan Williams <dan.j.williams@intel.com>
Date: Wed May 26 16:33:04 2021 -0700
ndctl/scrub: Stop translating return values
In preparation for triggering a poll loop within ndctl_bus_start_scrub(),
stop translating return values into -EOPNOTSUPP.
Link: https://lore.kernel.org/r/162207198482.3715490.5994844104395495686.stgit@dwillia2-desk3.amr.corp.intel.com
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
diff --git a/ndctl/lib/libndctl.c b/ndctl/lib/libndctl.c
index aa36a3c..e5641fe 100644
--- a/ndctl/lib/libndctl.c
+++ b/ndctl/lib/libndctl.c
@@ -1354,14 +1354,8 @@ static int __ndctl_bus_get_scrub_state(struct ndctl_bus *bus,
NDCTL_EXPORT int ndctl_bus_start_scrub(struct ndctl_bus *bus)
{
struct ndctl_ctx *ctx = ndctl_bus_get_ctx(bus);
- int rc;
- rc = sysfs_write_attr(ctx, bus->scrub_path, "1\n");
- if (rc == -EBUSY)
- return rc;
- else if (rc < 0)
- return -EOPNOTSUPP;
- return 0;
+ return sysfs_write_attr(ctx, bus->scrub_path, "1\n");
}
NDCTL_EXPORT int ndctl_bus_get_scrub_state(struct ndctl_bus *bus)

View File

@ -1,219 +0,0 @@
libndctl: Unify adding dimms for papr and nfit families
BZ:
Brew:
commit daef3a386a9c45105a2c045ddee46600e265939f
Author: Santosh Sivaraj <santosh@fossix.org>
Date: Thu May 13 11:42:15 2021 +0530
libndctl: Unify adding dimms for papr and nfit families
In preparation for enabling tests on non-nfit devices, unify both, already very
similar, functions into one. This will help in adding all attributes needed for
the unit tests. Since the function doesn't fail if some of the dimm attributes
are missing, this will work fine on PAPR platforms though only part of the DIMM
attributes are provided (This doesn't mean that all of the DIMM attributes can
be missing).
Link: https://lore.kernel.org/r/20210513061218.760322-1-santosh@fossix.org
Signed-off-by: Santosh Sivaraj <santosh@fossix.org>
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
diff --git a/ndctl/lib/libndctl.c b/ndctl/lib/libndctl.c
index 2f6d806..e45353f 100644
--- a/ndctl/lib/libndctl.c
+++ b/ndctl/lib/libndctl.c
@@ -1646,41 +1646,9 @@ static int ndctl_bind(struct ndctl_ctx *ctx, struct kmod_module *module,
static int ndctl_unbind(struct ndctl_ctx *ctx, const char *devpath);
static struct kmod_module *to_module(struct ndctl_ctx *ctx, const char *alias);
-static int add_papr_dimm(struct ndctl_dimm *dimm, const char *dimm_base)
-{
- int rc = -ENODEV;
- char buf[SYSFS_ATTR_SIZE];
- struct ndctl_ctx *ctx = dimm->bus->ctx;
- char *path = calloc(1, strlen(dimm_base) + 100);
- const char * const devname = ndctl_dimm_get_devname(dimm);
-
- dbg(ctx, "%s: Probing of_pmem dimm at %s\n", devname, dimm_base);
-
- if (!path)
- return -ENOMEM;
-
- /* construct path to the papr compatible dimm flags file */
- sprintf(path, "%s/papr/flags", dimm_base);
-
- if (ndctl_bus_is_papr_scm(dimm->bus) &&
- sysfs_read_attr(ctx, path, buf) == 0) {
-
- dbg(ctx, "%s: Adding papr-scm dimm flags:\"%s\"\n", devname, buf);
- dimm->cmd_family = NVDIMM_FAMILY_PAPR;
-
- /* Parse dimm flags */
- parse_papr_flags(dimm, buf);
-
- /* Allocate monitor mode fd */
- dimm->health_eventfd = open(path, O_RDONLY|O_CLOEXEC);
- rc = 0;
- }
-
- free(path);
- return rc;
-}
-
-static int add_nfit_dimm(struct ndctl_dimm *dimm, const char *dimm_base)
+static int populate_dimm_attributes(struct ndctl_dimm *dimm,
+ const char *dimm_base,
+ const char *bus_prefix)
{
int i, rc = -1;
char buf[SYSFS_ATTR_SIZE];
@@ -1694,7 +1662,7 @@ static int add_nfit_dimm(struct ndctl_dimm *dimm, const char *dimm_base)
* 'unique_id' may not be available on older kernels, so don't
* fail if the read fails.
*/
- sprintf(path, "%s/nfit/id", dimm_base);
+ sprintf(path, "%s/%s/id", dimm_base, bus_prefix);
if (sysfs_read_attr(ctx, path, buf) == 0) {
unsigned int b[9];
@@ -1709,68 +1677,74 @@ static int add_nfit_dimm(struct ndctl_dimm *dimm, const char *dimm_base)
}
}
- sprintf(path, "%s/nfit/handle", dimm_base);
+ sprintf(path, "%s/%s/handle", dimm_base, bus_prefix);
if (sysfs_read_attr(ctx, path, buf) < 0)
goto err_read;
dimm->handle = strtoul(buf, NULL, 0);
- sprintf(path, "%s/nfit/phys_id", dimm_base);
+ sprintf(path, "%s/%s/phys_id", dimm_base, bus_prefix);
if (sysfs_read_attr(ctx, path, buf) < 0)
goto err_read;
dimm->phys_id = strtoul(buf, NULL, 0);
- sprintf(path, "%s/nfit/serial", dimm_base);
+ sprintf(path, "%s/%s/serial", dimm_base, bus_prefix);
if (sysfs_read_attr(ctx, path, buf) == 0)
dimm->serial = strtoul(buf, NULL, 0);
- sprintf(path, "%s/nfit/vendor", dimm_base);
+ sprintf(path, "%s/%s/vendor", dimm_base, bus_prefix);
if (sysfs_read_attr(ctx, path, buf) == 0)
dimm->vendor_id = strtoul(buf, NULL, 0);
- sprintf(path, "%s/nfit/device", dimm_base);
+ sprintf(path, "%s/%s/device", dimm_base, bus_prefix);
if (sysfs_read_attr(ctx, path, buf) == 0)
dimm->device_id = strtoul(buf, NULL, 0);
- sprintf(path, "%s/nfit/rev_id", dimm_base);
+ sprintf(path, "%s/%s/rev_id", dimm_base, bus_prefix);
if (sysfs_read_attr(ctx, path, buf) == 0)
dimm->revision_id = strtoul(buf, NULL, 0);
- sprintf(path, "%s/nfit/dirty_shutdown", dimm_base);
+ sprintf(path, "%s/%s/dirty_shutdown", dimm_base, bus_prefix);
if (sysfs_read_attr(ctx, path, buf) == 0)
dimm->dirty_shutdown = strtoll(buf, NULL, 0);
- sprintf(path, "%s/nfit/subsystem_vendor", dimm_base);
+ sprintf(path, "%s/%s/subsystem_vendor", dimm_base, bus_prefix);
if (sysfs_read_attr(ctx, path, buf) == 0)
dimm->subsystem_vendor_id = strtoul(buf, NULL, 0);
- sprintf(path, "%s/nfit/subsystem_device", dimm_base);
+ sprintf(path, "%s/%s/subsystem_device", dimm_base, bus_prefix);
if (sysfs_read_attr(ctx, path, buf) == 0)
dimm->subsystem_device_id = strtoul(buf, NULL, 0);
- sprintf(path, "%s/nfit/subsystem_rev_id", dimm_base);
+ sprintf(path, "%s/%s/subsystem_rev_id", dimm_base, bus_prefix);
if (sysfs_read_attr(ctx, path, buf) == 0)
dimm->subsystem_revision_id = strtoul(buf, NULL, 0);
- sprintf(path, "%s/nfit/family", dimm_base);
+ sprintf(path, "%s/%s/family", dimm_base, bus_prefix);
if (sysfs_read_attr(ctx, path, buf) == 0)
dimm->cmd_family = strtoul(buf, NULL, 0);
- sprintf(path, "%s/nfit/dsm_mask", dimm_base);
+ sprintf(path, "%s/%s/dsm_mask", dimm_base, bus_prefix);
if (sysfs_read_attr(ctx, path, buf) == 0)
dimm->nfit_dsm_mask = strtoul(buf, NULL, 0);
- sprintf(path, "%s/nfit/format", dimm_base);
+ sprintf(path, "%s/%s/format", dimm_base, bus_prefix);
if (sysfs_read_attr(ctx, path, buf) == 0)
dimm->format[0] = strtoul(buf, NULL, 0);
for (i = 1; i < dimm->formats; i++) {
- sprintf(path, "%s/nfit/format%d", dimm_base, i);
+ sprintf(path, "%s/%s/format%d", dimm_base, bus_prefix, i);
if (sysfs_read_attr(ctx, path, buf) == 0)
dimm->format[i] = strtoul(buf, NULL, 0);
}
- sprintf(path, "%s/nfit/flags", dimm_base);
- if (sysfs_read_attr(ctx, path, buf) == 0)
- parse_nfit_mem_flags(dimm, buf);
+ sprintf(path, "%s/%s/flags", dimm_base, bus_prefix);
+ if (sysfs_read_attr(ctx, path, buf) == 0) {
+ if (ndctl_bus_has_nfit(dimm->bus))
+ parse_nfit_mem_flags(dimm, buf);
+ else if (ndctl_bus_is_papr_scm(dimm->bus)) {
+ dimm->cmd_family = NVDIMM_FAMILY_PAPR;
+ parse_papr_flags(dimm, buf);
+ }
+ }
dimm->health_eventfd = open(path, O_RDONLY|O_CLOEXEC);
rc = 0;
@@ -1792,7 +1766,8 @@ static void *add_dimm(void *parent, int id, const char *dimm_base)
if (!path)
return NULL;
- sprintf(path, "%s/nfit/formats", dimm_base);
+ sprintf(path, "%s/%s/formats", dimm_base,
+ ndctl_bus_has_nfit(bus) ? "nfit" : "papr");
if (sysfs_read_attr(ctx, path, buf) < 0)
formats = 1;
else
@@ -1866,13 +1841,12 @@ static void *add_dimm(void *parent, int id, const char *dimm_base)
else
dimm->fwa_result = fwa_result_to_result(buf);
+ dimm->formats = formats;
/* Check if the given dimm supports nfit */
if (ndctl_bus_has_nfit(bus)) {
- dimm->formats = formats;
- rc = add_nfit_dimm(dimm, dimm_base);
- } else if (ndctl_bus_has_of_node(bus)) {
- rc = add_papr_dimm(dimm, dimm_base);
- }
+ rc = populate_dimm_attributes(dimm, dimm_base, "nfit");
+ } else if (ndctl_bus_has_of_node(bus))
+ rc = populate_dimm_attributes(dimm, dimm_base, "papr");
if (rc == -ENODEV) {
/* Unprobed dimm with no family */
@@ -2531,13 +2505,12 @@ static void *add_region(void *parent, int id, const char *region_base)
goto err_read;
region->num_mappings = strtoul(buf, NULL, 0);
- sprintf(path, "%s/nfit/range_index", region_base);
- if (ndctl_bus_has_nfit(bus)) {
- if (sysfs_read_attr(ctx, path, buf) < 0)
- goto err_read;
- region->range_index = strtoul(buf, NULL, 0);
- } else
+ sprintf(path, "%s/%s/range_index", region_base,
+ ndctl_bus_has_nfit(bus) ? "nfit": "papr");
+ if (sysfs_read_attr(ctx, path, buf) < 0)
region->range_index = -1;
+ else
+ region->range_index = strtoul(buf, NULL, 0);
sprintf(path, "%s/read_only", region_base);
if (sysfs_read_attr(ctx, path, buf) < 0)

View File

@ -1,120 +0,0 @@
libndctl/papr: Fix probe for papr-scm compatible nvdimms
BZ:
Brew:
commit e086106b4d81a2079141c848db7695451c04e877
Author: Vaibhav Jain <vaibhav@linux.ibm.com>
Date: Mon May 17 21:18:24 2021 +0530
libndctl/papr: Fix probe for papr-scm compatible nvdimms
With recent changes introduced for unification of PAPR and NFIT
families the probe for papr-scm nvdimms is broken since they don't
expose 'handle' or 'phys_id' sysfs attributes. These attributes are
only exposed by NFIT and 'nvdimm_test' nvdimms. Since 'unable to read'
these sysfs attributes is a non-recoverable error hence this prevents
probing of 'PAPR-SCM' nvdimms and ndctl reports following error:
$ sudo NDCTL_LOG=debug ndctl list -DH
libndctl: ndctl_new: ctx 0x10015342c70 created
libndctl: add_dimm: nmem1: probe failed: Operation not permitted
libndctl: __sysfs_device_parse: nmem1: add_dev() failed
libndctl: add_dimm: nmem0: probe failed: Operation not permitted
libndctl: __sysfs_device_parse: nmem0: add_dev() failed
Fixing this bug is complicated by the fact these attributes are needed
for by the 'nvdimm_test' nvdimms which also uses the
NVDIMM_FAMILY_PAPR. Adding a two way comparison for these two
attributes in populate_dimm_attributes() to distinguish between
'nvdimm_test' and papr-scm nvdimms will be clunky and make future
updates to populate_dimm_attributes() error prone.
So, this patch proposes to fix the issue by re-introducing
add_papr_dimm() to probe both papr-scm and 'nvdimm_test' nvdimms. The
'compatible' sysfs attribute associated with the PAPR device is used
to distinguish between the two nvdimm types and in case an
'nvdimm_test' device is detected then forward its probe to
populate_dimm_attributes().
families")
Link: https://lore.kernel.org/r/20210517154824.142237-1-vaibhav@linux.ibm.com
Fixes: daef3a386a9c("libndctl: Unify adding dimms for papr and nfit
Signed-off-by: Vaibhav Jain <vaibhav@linux.ibm.com>
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
diff -up ndctl-71.1/ndctl/lib/libndctl.c.orig ndctl-71.1/ndctl/lib/libndctl.c
--- ndctl-71.1/ndctl/lib/libndctl.c.orig 2022-06-06 17:16:20.703762581 -0400
+++ ndctl-71.1/ndctl/lib/libndctl.c 2022-06-06 17:17:34.932019990 -0400
@@ -1757,6 +1757,58 @@ static int populate_dimm_attributes(stru
return rc;
}
+static int add_papr_dimm(struct ndctl_dimm *dimm, const char *dimm_base)
+{
+ int rc = -ENODEV;
+ char buf[SYSFS_ATTR_SIZE];
+ struct ndctl_ctx *ctx = dimm->bus->ctx;
+ char *path = calloc(1, strlen(dimm_base) + 100);
+ const char * const devname = ndctl_dimm_get_devname(dimm);
+
+ dbg(ctx, "%s: Probing of_pmem dimm at %s\n", devname, dimm_base);
+
+ if (!path)
+ return -ENOMEM;
+
+ /* Check the compatibility of the probed nvdimm */
+ sprintf(path, "%s/../of_node/compatible", dimm_base);
+ if (sysfs_read_attr(ctx, path, buf) < 0) {
+ dbg(ctx, "%s: Unable to read compatible field\n", devname);
+ rc = -ENODEV;
+ goto out;
+ }
+
+ dbg(ctx, "%s:Compatible of_pmem = '%s'\n", devname, buf);
+
+ /* Probe for papr-scm memory */
+ if (strcmp(buf, "ibm,pmemory") == 0) {
+ /* Read the dimm flags file */
+ sprintf(path, "%s/papr/flags", dimm_base);
+ if (sysfs_read_attr(ctx, path, buf) < 0) {
+ rc = -errno;
+ err(ctx, "%s: Unable to read dimm-flags\n", devname);
+ goto out;
+ }
+
+ dbg(ctx, "%s: Adding papr-scm dimm flags:\"%s\"\n", devname, buf);
+ dimm->cmd_family = NVDIMM_FAMILY_PAPR;
+
+ /* Parse dimm flags */
+ parse_papr_flags(dimm, buf);
+
+ /* Allocate monitor mode fd */
+ dimm->health_eventfd = open(path, O_RDONLY|O_CLOEXEC);
+ rc = 0;
+
+ } else if (strcmp(buf, "nvdimm_test") == 0) {
+ /* probe via common populate_dimm_attributes() */
+ rc = populate_dimm_attributes(dimm, dimm_base, "papr");
+ }
+out:
+ free(path);
+ return rc;
+}
+
static void *add_dimm(void *parent, int id, const char *dimm_base)
{
int formats, i, rc = -ENODEV;
@@ -1848,8 +1900,9 @@ static void *add_dimm(void *parent, int
/* Check if the given dimm supports nfit */
if (ndctl_bus_has_nfit(bus)) {
rc = populate_dimm_attributes(dimm, dimm_base, "nfit");
- } else if (ndctl_bus_has_of_node(bus))
- rc = populate_dimm_attributes(dimm, dimm_base, "papr");
+ } else if (ndctl_bus_has_of_node(bus)) {
+ rc = add_papr_dimm(dimm, dimm_base);
+ }
if (rc == -ENODEV) {
/* Unprobed dimm with no family */

View File

@ -1,169 +0,0 @@
ndctl/test: Prepare for BLK-aperture support removal
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2141031
commit e423b467e10e3405e6e09260b7669e7022b5f5f7
Author: Dan Williams <dan.j.williams@intel.com>
Date: Wed Jan 5 13:31:50 2022 -0800
ndctl/test: Prepare for BLK-aperture support removal
The kernel is dropping its support for the BLK-aperture access method. The
primary side effect of this for nfit_test is that NVDIMM namespace labeling
will not be enabled by default. Update the unit tests to initialize the
label index area in this scenario.
Link: https://lore.kernel.org/r/164141830999.3990253.5021445352398348657.stgit@dwillia2-desk3.amr.corp.intel.com
Tested-by: Alison Schofield <alison.schofield@intel.com>
Tested-by: Vaibhav Jain <vaibhav@linux.ibm.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
diff --git a/test/core.c b/test/core.c
index 2b03aa9..93e1dae 100644
--- a/test/core.c
+++ b/test/core.c
@@ -261,8 +261,8 @@ retry:
ndctl_bus_foreach(nd_ctx, bus) {
struct ndctl_region *region;
- if (strncmp(ndctl_bus_get_provider(bus),
- "nfit_test", 9) != 0)
+ if (strcmp(ndctl_bus_get_provider(bus),
+ "nfit_test.0") != 0)
continue;
ndctl_region_foreach(bus, region)
ndctl_region_disable_invalidate(region);
@@ -280,5 +280,30 @@ retry:
NULL, NULL, NULL, NULL);
if (rc)
kmod_unref(*ctx);
- return rc;
+
+ if (!nd_ctx)
+ return rc;
+
+ ndctl_bus_foreach (nd_ctx, bus) {
+ struct ndctl_region *region;
+ struct ndctl_dimm *dimm;
+
+ if (strcmp(ndctl_bus_get_provider(bus), "nfit_test.0") != 0)
+ continue;
+
+ ndctl_region_foreach (bus, region)
+ ndctl_region_disable_invalidate(region);
+
+ ndctl_dimm_foreach (bus, dimm) {
+ ndctl_dimm_read_label_index(dimm);
+ ndctl_dimm_init_labels(dimm, NDCTL_NS_VERSION_1_2);
+ ndctl_dimm_disable(dimm);
+ ndctl_dimm_enable(dimm);
+ }
+
+ ndctl_region_foreach (bus, region)
+ ndctl_region_enable(region);
+ }
+
+ return 0;
}
diff --git a/test/libndctl.c b/test/libndctl.c
index d9b50f4..c0e4b4c 100644
--- a/test/libndctl.c
+++ b/test/libndctl.c
@@ -2587,17 +2587,41 @@ static int check_dimms(struct ndctl_bus *bus, struct dimm *dimms, int n,
return 0;
}
-static void reset_bus(struct ndctl_bus *bus)
+enum dimm_reset {
+ DIMM_INIT,
+ DIMM_ZERO,
+};
+
+static int reset_dimms(struct ndctl_bus *bus, enum dimm_reset reset)
{
- struct ndctl_region *region;
struct ndctl_dimm *dimm;
+ int rc = 0;
+
+ ndctl_dimm_foreach(bus, dimm) {
+ if (reset == DIMM_ZERO)
+ ndctl_dimm_zero_labels(dimm);
+ else {
+ ndctl_dimm_read_label_index(dimm);
+ ndctl_dimm_init_labels(dimm, NDCTL_NS_VERSION_1_2);
+ }
+ ndctl_dimm_disable(dimm);
+ rc = ndctl_dimm_enable(dimm);
+ if (rc)
+ break;
+ }
+
+ return rc;
+}
+
+static void reset_bus(struct ndctl_bus *bus, enum dimm_reset reset)
+{
+ struct ndctl_region *region;
/* disable all regions so that set_config_data commands are permitted */
ndctl_region_foreach(bus, region)
ndctl_region_disable_invalidate(region);
- ndctl_dimm_foreach(bus, dimm)
- ndctl_dimm_zero_labels(dimm);
+ reset_dimms(bus, reset);
/* set regions back to their default state */
ndctl_region_foreach(bus, region)
@@ -2608,7 +2632,6 @@ 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_region *region;
- struct ndctl_dimm *dimm;
int rc;
if (!bus)
@@ -2625,13 +2648,10 @@ static int do_test0(struct ndctl_ctx *ctx, struct ndctl_test *test)
if (rc)
return rc;
- ndctl_dimm_foreach(bus, dimm) {
- rc = ndctl_dimm_zero_labels(dimm);
- if (rc < 0) {
- fprintf(stderr, "failed to zero %s\n",
- ndctl_dimm_get_devname(dimm));
- return rc;
- }
+ rc = reset_dimms(bus, DIMM_INIT);
+ if (rc < 0) {
+ fprintf(stderr, "failed to reset dimms\n");
+ return rc;
}
/*
@@ -2649,14 +2669,14 @@ static int do_test0(struct ndctl_ctx *ctx, struct ndctl_test *test)
rc = check_regions(bus, regions0, ARRAY_SIZE(regions0), DAX);
if (rc)
return rc;
- reset_bus(bus);
+ reset_bus(bus, DIMM_INIT);
}
if (ndctl_test_attempt(test, KERNEL_VERSION(4, 8, 0))) {
rc = check_regions(bus, regions0, ARRAY_SIZE(regions0), PFN);
if (rc)
return rc;
- reset_bus(bus);
+ reset_bus(bus, DIMM_INIT);
}
return check_regions(bus, regions0, ARRAY_SIZE(regions0), BTT);
@@ -2671,6 +2691,7 @@ static int do_test1(struct ndctl_ctx *ctx, struct ndctl_test *test)
return -ENXIO;
ndctl_bus_wait_probe(bus);
+ reset_bus(bus, DIMM_ZERO);
/*
* Starting with v4.10 the dimm on nfit_test.1 gets a unique

View File

@ -1,158 +0,0 @@
libndctl, intel: Indicate supported smart-inject types
BZ:
Brew:
commit edcd9b7e10b3b33a9660e412a2db1beab30936d3
Author: Vaibhav Jain <vaibhav@linux.ibm.com>
Date: Tue Jan 25 02:07:35 2022 +0530
libndctl, intel: Indicate supported smart-inject types
Presently the inject-smart code assumes support for injecting all
smart-errors namely media-temperature, controller-temperature,
spares-remaining, fatal-health and unsafe-shutdown. This assumption
may break in case of other non-Intel NVDIMM types namely PAPR NVDIMMs
which presently only have support for injecting unsafe-shutdown and
fatal health events.
Trying to inject-smart errors on PAPR NVDIMMs causes problems as
smart_inject() prematurely exits when trying to inject
media-temperature smart-error errors out.
To fix this issue the patch proposes extending the definition of
dimm_op 'smart_inject_supported' to return bitmap of flags indicating
the type of smart-error injections supported by an NVDIMM. These types
are indicated by the newly introduced defines ND_SMART_INJECT_* . A
dimm-ops provide can return an bitmap composed of these flags back
from its implementation of 'smart_inject_supported' to indicate to
dimm_inject_smart() which type of smart-error injection it
supports. In case of an error the dimm-op is still expected to return
a negative error code back to the caller.
The patch updates intel_dimm_smart_inject_supported() to return a
bitmap composed of all ND_SMART_INJECT_* flags to indicate support for
all smart-error types.
Finally the patch also updates smart_inject() to test for specific
ND_START_INJECT_* flags before sending a smart-inject command via
dimm-provider.
Link: https://lore.kernel.org/r/20220124203735.1490186-1-vaibhav@linux.ibm.com
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Vaibhav Jain <vaibhav@linux.ibm.com>
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
diff --git a/ndctl/inject-smart.c b/ndctl/inject-smart.c
index 2b9d7e8..bd8c01e 100644
--- a/ndctl/inject-smart.c
+++ b/ndctl/inject-smart.c
@@ -395,18 +395,26 @@ out:
} \
}
-static int smart_inject(struct ndctl_dimm *dimm)
+static int smart_inject(struct ndctl_dimm *dimm, unsigned int inject_types)
{
const char *name = ndctl_dimm_get_devname(dimm);
struct ndctl_cmd *si_cmd = NULL;
int rc = -EOPNOTSUPP;
- send_inject_val(media_temperature)
- send_inject_val(ctrl_temperature)
- send_inject_val(spares)
- send_inject_bool(fatal)
- send_inject_bool(unsafe_shutdown)
+ if (inject_types & ND_SMART_INJECT_MEDIA_TEMPERATURE)
+ send_inject_val(media_temperature);
+ if (inject_types & ND_SMART_INJECT_CTRL_TEMPERATURE)
+ send_inject_val(ctrl_temperature);
+
+ if (inject_types & ND_SMART_INJECT_SPARES_REMAINING)
+ send_inject_val(spares);
+
+ if (inject_types & ND_SMART_INJECT_HEALTH_STATE)
+ send_inject_bool(fatal);
+
+ if (inject_types & ND_SMART_INJECT_UNCLEAN_SHUTDOWN)
+ send_inject_bool(unsafe_shutdown);
out:
ndctl_cmd_unref(si_cmd);
return rc;
@@ -417,6 +425,7 @@ static int dimm_inject_smart(struct ndctl_dimm *dimm)
struct json_object *jhealth;
struct json_object *jdimms;
struct json_object *jdimm;
+ unsigned int supported_types;
int rc;
rc = ndctl_dimm_smart_inject_supported(dimm);
@@ -433,6 +442,14 @@ static int dimm_inject_smart(struct ndctl_dimm *dimm)
error("%s: smart injection not supported by either platform firmware or the kernel.",
ndctl_dimm_get_devname(dimm));
return rc;
+ default:
+ if (rc < 0) {
+ error("%s: Unknown error %d while checking for smart injection support",
+ ndctl_dimm_get_devname(dimm), rc);
+ return rc;
+ }
+ supported_types = rc;
+ break;
}
if (sctx.op_mask & (1 << OP_SET)) {
@@ -441,7 +458,7 @@ static int dimm_inject_smart(struct ndctl_dimm *dimm)
goto out;
}
if (sctx.op_mask & (1 << OP_INJECT)) {
- rc = smart_inject(dimm);
+ rc = smart_inject(dimm, supported_types);
if (rc)
goto out;
}
diff --git a/ndctl/lib/intel.c b/ndctl/lib/intel.c
index a3df26e..1314854 100644
--- a/ndctl/lib/intel.c
+++ b/ndctl/lib/intel.c
@@ -455,7 +455,12 @@ static int intel_dimm_smart_inject_supported(struct ndctl_dimm *dimm)
return -EIO;
}
- return 0;
+ /* Indicate all smart injection types are supported */
+ return ND_SMART_INJECT_SPARES_REMAINING |
+ ND_SMART_INJECT_MEDIA_TEMPERATURE |
+ ND_SMART_INJECT_CTRL_TEMPERATURE |
+ ND_SMART_INJECT_HEALTH_STATE |
+ ND_SMART_INJECT_UNCLEAN_SHUTDOWN;
}
static const char *intel_cmd_desc(int fn)
diff --git a/ndctl/libndctl.h b/ndctl/libndctl.h
index b59026c..4d5cdbf 100644
--- a/ndctl/libndctl.h
+++ b/ndctl/libndctl.h
@@ -69,6 +69,13 @@ extern "C" {
#define ND_EVENT_HEALTH_STATE (1 << 3)
#define ND_EVENT_UNCLEAN_SHUTDOWN (1 << 4)
+/* Flags indicating support for various smart injection types */
+#define ND_SMART_INJECT_SPARES_REMAINING (1 << 0)
+#define ND_SMART_INJECT_MEDIA_TEMPERATURE (1 << 1)
+#define ND_SMART_INJECT_CTRL_TEMPERATURE (1 << 2)
+#define ND_SMART_INJECT_HEALTH_STATE (1 << 3)
+#define ND_SMART_INJECT_UNCLEAN_SHUTDOWN (1 << 4)
+
size_t ndctl_min_namespace_size(void);
size_t ndctl_sizeof_namespace_index(void);
size_t ndctl_sizeof_namespace_label(void);
@@ -311,6 +318,7 @@ int ndctl_cmd_smart_inject_spares(struct ndctl_cmd *cmd, bool enable,
unsigned int spares);
int ndctl_cmd_smart_inject_fatal(struct ndctl_cmd *cmd, bool enable);
int ndctl_cmd_smart_inject_unsafe_shutdown(struct ndctl_cmd *cmd, bool enable);
+/* Returns a bitmap of ND_SMART_INJECT_* supported */
int ndctl_dimm_smart_inject_supported(struct ndctl_dimm *dimm);
struct ndctl_cmd *ndctl_dimm_cmd_new_vendor_specific(struct ndctl_dimm *dimm,

View File

@ -1,41 +0,0 @@
papr: Add support to parse save_fail flag for dimm
BZ:
Brew:
commit f081f302505209430df46908775a3cffb875a5c7
Author: Santosh Sivaraj <santosh@fossix.org>
Date: Thu May 13 11:42:17 2021 +0530
papr: Add support to parse save_fail flag for dimm
This will help in getting the dimm fail tests to run on papr family too.
Also add nvdimm_test compatibility string for recognizing the test module.
Link: https://lore.kernel.org/r/20210513061218.760322-3-santosh@fossix.org
Signed-off-by: Santosh Sivaraj <santosh@fossix.org>
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
diff --git a/ndctl/lib/libndctl.c b/ndctl/lib/libndctl.c
index e45353f..a8b99ea 100644
--- a/ndctl/lib/libndctl.c
+++ b/ndctl/lib/libndctl.c
@@ -805,6 +805,8 @@ static void parse_papr_flags(struct ndctl_dimm *dimm, char *flags)
dimm->flags.f_restore = 1;
else if (strcmp(start, "smart_notify") == 0)
dimm->flags.f_smart = 1;
+ else if (strcmp(start, "save_fail") == 0)
+ dimm->flags.f_save = 1;
start = end + 1;
}
if (end != start)
@@ -1035,7 +1037,8 @@ NDCTL_EXPORT int ndctl_bus_is_papr_scm(struct ndctl_bus *bus)
if (sysfs_read_attr(bus->ctx, bus->bus_buf, buf) < 0)
return 0;
- return (strcmp(buf, "ibm,pmemory") == 0);
+ return (strcmp(buf, "ibm,pmemory") == 0 ||
+ strcmp(buf, "nvdimm_test") == 0);
}
/**

View File

@ -1,50 +0,0 @@
zero_info_block: skip seed devices
BZ:
Brew:
commit fb13dfb8d84c4f0a749665c8f07179450b199f3e
Author: Jeff Moyer <jmoyer@redhat.com>
Date: Tue Feb 9 16:51:53 2021 -0500
zero_info_block: skip seed devices
Currently, ndctl destroy-namespace -f all will output errors of the
form:
Error: destroy namespace: namespace0.0 failed to enable for zeroing, continuing
for any zero-sized namespace. That particular namespace looks like this:
{
"dev":"namespace0.0",
"mode":"raw",
"size":0,
"uuid":"00000000-0000-0000-0000-000000000000",
"sector_size":512,
"state":"disabled"
}
This patch skips over namespaces with size=0 when zeroing out info
blocks.
Fixes: 46654c2d60b70 ("ndctl/namespace: Always zero info-blocks")
Reported-by: Zhang Yi <yizhan@redhat.com>
Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
Link: https://lore.kernel.org/r/x49r1lohpty.fsf@segfault.boston.devel.redhat.com
diff --git a/ndctl/namespace.c b/ndctl/namespace.c
index 1feb74d..1e8a2cd 100644
--- a/ndctl/namespace.c
+++ b/ndctl/namespace.c
@@ -1052,6 +1052,9 @@ static int zero_info_block(struct ndctl_namespace *ndns)
void *buf = NULL, *read_buf = NULL;
char path[50];
+ if (ndctl_namespace_get_size(ndns) == 0)
+ return 1;
+
ndctl_namespace_set_raw_mode(ndns, 1);
rc = ndctl_namespace_enable(ndns);
if (rc < 0) {

View File

@ -1,102 +0,0 @@
ndctl/test: Initialize the label area by default
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2143636
commit fe37c85f1ffb0b2d04ef60e8ece6a9a44a145cc5
Author: Dan Williams <dan.j.williams@intel.com>
Date: Wed Jan 5 13:32:00 2022 -0800
ndctl/test: Initialize the label area by default
The removal of BLK-mode support causes nfit_test regions to not be
'aliased' by default, which means that the only way to enable labels is to
initialize the namespace label index block. In support of that the common
'reset()' helper is updated to initialize v1.1 labels instead of zero them.
Additionally, it highlighted that some btt tests have silent assumptions of
v1.1 vs v1.2 label support. Add a 'resetV()' alternative to the common
'reset()' function that initializes the label area to v1.2.
Link: https://lore.kernel.org/r/164141832017.3990253.10383328274835531066.stgit@dwillia2-desk3.amr.corp.intel.com
Tested-by: Alison Schofield <alison.schofield@intel.com>
Tested-by: Vaibhav Jain <vaibhav@linux.ibm.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
diff --git a/test/btt-errors.sh b/test/btt-errors.sh
index 5a20d26..6e69178 100755
--- a/test/btt-errors.sh
+++ b/test/btt-errors.sh
@@ -45,7 +45,7 @@ trap 'err $LINENO cleanup' ERR
# setup (reset nfit_test dimms)
modprobe nfit_test
-reset
+resetV
rc=1
@@ -124,7 +124,7 @@ 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
-reset
+resetV
dev="x"
json=$($NDCTL create-namespace -b $NFIT_TEST_BUS0 -t pmem -m sector)
eval "$(echo "$json" | json2var)"
diff --git a/test/btt-pad-compat.sh b/test/btt-pad-compat.sh
index be538b7..005316a 100755
--- a/test/btt-pad-compat.sh
+++ b/test/btt-pad-compat.sh
@@ -148,7 +148,7 @@ do_tests()
verify_idx 0 1
# do the same with an old format namespace
- reset
+ resetV
create_oldfmt_ns
verify_idx 0 2
diff --git a/test/common b/test/common
index 3c54d63..b6d4712 100644
--- a/test/common
+++ b/test/common
@@ -49,14 +49,21 @@ err()
reset()
{
$NDCTL disable-region -b $NFIT_TEST_BUS0 all
- $NDCTL zero-labels -b $NFIT_TEST_BUS0 all
+ $NDCTL init-labels -f -b $NFIT_TEST_BUS0 all
+ $NDCTL enable-region -b $NFIT_TEST_BUS0 all
+}
+
+resetV()
+{
+ $NDCTL disable-region -b $NFIT_TEST_BUS0 all
+ $NDCTL init-labels -f -V 1.2 -b $NFIT_TEST_BUS0 all
$NDCTL enable-region -b $NFIT_TEST_BUS0 all
}
reset1()
{
$NDCTL disable-region -b $NFIT_TEST_BUS1 all
- $NDCTL zero-labels -b $NFIT_TEST_BUS1 all
+ $NDCTL init-labels -f -b $NFIT_TEST_BUS1 all
$NDCTL enable-region -b $NFIT_TEST_BUS1 all
}
diff --git a/test/label-compat.sh b/test/label-compat.sh
index 8ab2858..7ae4d5e 100755
--- a/test/label-compat.sh
+++ b/test/label-compat.sh
@@ -17,7 +17,7 @@ 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 init-labels -f -b $NFIT_TEST_BUS0 all
# grab the largest pmem region on -b $NFIT_TEST_BUS0
query=". | sort_by(.available_size) | reverse | .[0].dev"

View File

@ -1,124 +0,0 @@
Use page size as alignment value
BZ:
Brew:
commit fe831b526b88f6ca7a27fdb149b8a7d2ecddbc55
Author: Santosh Sivaraj <santosh@fossix.org>
Date: Thu May 13 11:42:18 2021 +0530
Use page size as alignment value
The alignment sizes passed to ndctl in the tests are all hardcoded to 4k,
the default page size on x86. Change those to the default page size on that
architecture (sysconf/getconf). No functional changes otherwise.
Link: https://lore.kernel.org/r/20210513061218.760322-4-santosh@fossix.org
Signed-off-by: Santosh Sivaraj <santosh@fossix.org>
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
diff -up ndctl-71.1/test/dpa-alloc.c.orig ndctl-71.1/test/dpa-alloc.c
--- ndctl-71.1/test/dpa-alloc.c.orig 2020-12-22 16:44:57.000000000 -0500
+++ ndctl-71.1/test/dpa-alloc.c 2022-06-06 17:13:12.045108349 -0400
@@ -38,12 +38,13 @@ static int do_test(struct ndctl_ctx *ctx
struct ndctl_region *region, *blk_region = NULL;
struct ndctl_namespace *ndns;
struct ndctl_dimm *dimm;
- unsigned long size;
+ unsigned long size, page_size;
struct ndctl_bus *bus;
char uuid_str[40];
int round;
int rc;
+ page_size = sysconf(_SC_PAGESIZE);
/* disable nfit_test.1, not used in this test */
bus = ndctl_bus_get_by_provider(ctx, NFIT_PROVIDER1);
if (!bus)
@@ -124,11 +125,11 @@ static int do_test(struct ndctl_ctx *ctx
return rc;
}
ndctl_namespace_disable_invalidate(ndns);
- rc = ndctl_namespace_set_size(ndns, SZ_4K);
+ rc = ndctl_namespace_set_size(ndns, page_size);
if (rc) {
- fprintf(stderr, "failed to init %s to size: %d\n",
+ fprintf(stderr, "failed to init %s to size: %lu\n",
ndctl_namespace_get_devname(ndns),
- SZ_4K);
+ page_size);
return rc;
}
namespaces[i].ndns = ndns;
@@ -150,7 +151,7 @@ static int do_test(struct ndctl_ctx *ctx
ndns = namespaces[i % ARRAY_SIZE(namespaces)].ndns;
if (i % ARRAY_SIZE(namespaces) == 0)
round++;
- size = SZ_4K * round;
+ size = page_size * round;
rc = ndctl_namespace_set_size(ndns, size);
if (rc) {
fprintf(stderr, "%s: set_size: %lx failed: %d\n",
@@ -166,7 +167,7 @@ static int do_test(struct ndctl_ctx *ctx
i--;
round++;
ndns = namespaces[i % ARRAY_SIZE(namespaces)].ndns;
- size = SZ_4K * round;
+ size = page_size * round;
rc = ndctl_namespace_set_size(ndns, size);
if (rc) {
fprintf(stderr, "%s failed to update while labels full\n",
@@ -175,7 +176,7 @@ static int do_test(struct ndctl_ctx *ctx
}
round--;
- size = SZ_4K * round;
+ size = page_size * round;
rc = ndctl_namespace_set_size(ndns, size);
if (rc) {
fprintf(stderr, "%s failed to reduce size while labels full\n",
diff -up ndctl-71.1/test/multi-dax.sh.orig ndctl-71.1/test/multi-dax.sh
--- ndctl-71.1/test/multi-dax.sh.orig 2020-12-22 16:44:57.000000000 -0500
+++ ndctl-71.1/test/multi-dax.sh 2022-06-06 17:13:12.046108353 -0400
@@ -12,6 +12,8 @@ check_min_kver "4.13" || do_skip "may la
trap 'err $LINENO' ERR
+ALIGN_SIZE=`getconf PAGESIZE`
+
# setup (reset nfit_test dimms)
modprobe nfit_test
$NDCTL disable-region -b $NFIT_TEST_BUS0 all
@@ -22,9 +24,9 @@ rc=1
query=". | sort_by(.available_size) | reverse | .[0].dev"
region=$($NDCTL list -b $NFIT_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 $NFIT_TEST_BUS0 -r $region -t pmem -m devdax -a $ALIGN_SIZE -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 $NFIT_TEST_BUS0 -r $region -t pmem -m devdax -a $ALIGN_SIZE -s 16M)
chardev2=$(echo $json | jq ". | select(.mode == \"devdax\") | .daxregion.devices[0].chardev")
_cleanup
diff -up ndctl-71.1/test/sector-mode.sh.orig ndctl-71.1/test/sector-mode.sh
--- ndctl-71.1/test/sector-mode.sh.orig 2020-12-22 16:44:57.000000000 -0500
+++ ndctl-71.1/test/sector-mode.sh 2022-06-06 17:13:12.046108353 -0400
@@ -9,6 +9,8 @@ rc=77
set -e
trap 'err $LINENO' ERR
+ALIGN_SIZE=`getconf PAGESIZE`
+
# setup (reset nfit_test dimms)
modprobe nfit_test
$NDCTL disable-region -b $NFIT_TEST_BUS0 all
@@ -25,7 +27,7 @@ NAMESPACE=$($NDCTL list -b $NFIT_TEST_BU
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
-$NDCTL create-namespace --no-autolabel -e $NAMESPACE -m dax -f -a 4K
+$NDCTL create-namespace --no-autolabel -e $NAMESPACE -m dax -f -a $ALIGN_SIZE
$NDCTL create-namespace --no-autolabel -e $NAMESPACE -m sector -f -l 4K
_cleanup

View File

@ -1,6 +0,0 @@
diff -up ndctl-67/contrib/nvdimm-security.conf.orig ndctl-67/contrib/nvdimm-security.conf
--- ndctl-67/contrib/nvdimm-security.conf.orig 2019-11-01 13:21:04.669374133 -0400
+++ ndctl-67/contrib/nvdimm-security.conf 2019-11-01 13:21:04.669374133 -0400
@@ -1 +1 @@
-install libnvdimm /usr/bin/ndctl load-keys ; /sbin/modprobe --ignore-install libnvdimm $CMDLINE_OPTS
+install libnvdimm keyctl link @u @s; /usr/bin/ndctl load-keys; /sbin/modprobe --ignore-install libnvdimm $CMDLINE_OPTS

View File

@ -1,308 +0,0 @@
Name: ndctl
Version: 71.1
Release: 7%{?dist}
Summary: Manage "libnvdimm" subsystem devices (Non-volatile Memory)
License: GPLv2
Group: System Environment/Base
Url: https://github.com/pmem/ndctl
Source0: https://github.com/pmem/%{name}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
Patch0: modprobe-link-user-keyring-before-loadkeys.patch
Patch1: fb13dfb-zero_info_block-skip-seed-devices.patch
Patch2: daef3a3-libndctl-Unify-adding-dimms-for-papr-and-nfit-families.patch
Patch3: f081f30-papr-Add-support-to-parse-save_fail-flag-for-dimm.patch
Patch4: fe831b5-Use-page-size-as-alignment-value.patch
Patch5: e086106-libndctl-papr-Fix-probe-for-papr-scm-compatible-nvdimms.patch
Patch6: c521093-ndctl-scrub-Stop-translating-return-values.patch
Patch7: 4e646fa-ndctl-scrub-Reread-scrub-engine-status-at-start.patch
Patch8: 9bd2994-ndctl-namespace-Skip-seed-namespaces-when-processing-all-namespaces.patch
Patch9: 07011a3-ndctl-namespace-Suppress-ENXIO-when-processing-all-namespaces.patch
Patch10: 80e0d88-namespace-action-Drop-zero-namespace-checks.patch
Patch11: aa99000-libndctl-papr-Add-support-for-reporting-shutdown-count.patch
Patch12: edcd9b7-libndctl-intel-Indicate-supported-smart-inject-types.patch
Patch13: 9ef460e-libndctl-papr-Add-limited-support-for-inject-smart.patch
Patch14: 6e85cac-ndtest-ack-shutdown-count-Skip-the-test-on-ndtest.patch
Patch15: 7ce2fdd-ndctl-test-add-checking-the-presence-of-jq-command-ahead.patch
Patch16: 43e48c0-test-libndctl-Use-ndctl_region_set_ro-to-change-disk-read-only-state.patch
Patch17: 1649ad9-test-Don-t-skip-tests-if-nfit-modules-are-missing.patch
Patch18: e423b46-ndctl-test-Prepare-for-BLK-aperture-support-removal.patch
Patch19: 6538529-ndctl-test-Move-reset-to-function-in-common.patch
Patch20: fe37c85-ndctl-test-Initialize-the-label-area-by-default.patch
Patch21: 756a659-ndctl-test-Skip-BLK-flags-checks.patch
Patch22: b787320-ndctl-test-Move-sector-mode-to-a-different-region.patch
Patch23: 2e05cd6-ndctl-Deprecate-BLK-aperture-support.patch
Patch24: 4921c0c-ndctl-test-make-inject-smart.sh-more-tolerant-of-decimal-fields.patch
Requires: ndctl-libs%{?_isa} = %{version}-%{release}
Requires: daxctl-libs%{?_isa} = %{version}-%{release}
BuildRequires: autoconf
BuildRequires: asciidoc
BuildRequires: xmlto
BuildRequires: automake
BuildRequires: libtool
BuildRequires: pkgconfig
BuildRequires: pkgconfig(libkmod)
BuildRequires: pkgconfig(libudev)
BuildRequires: pkgconfig(uuid)
BuildRequires: pkgconfig(json-c)
BuildRequires: pkgconfig(bash-completion)
BuildRequires: systemd
BuildRequires: keyutils-libs-devel
%description
Utility library for managing the "libnvdimm" subsystem. The "libnvdimm"
subsystem defines a kernel device model and control message interface for
platform NVDIMM resources like those defined by the ACPI 6+ NFIT (NVDIMM
Firmware Interface Table).
%package -n ndctl-devel
Summary: Development files for libndctl
License: LGPLv2
Group: Development/Libraries
Requires: ndctl-libs%{?_isa} = %{version}-%{release}
%description -n ndctl-devel
The %{name}-devel package contains libraries and header files for
developing applications that use %{name}.
%package -n daxctl
Summary: Manage Device-DAX instances
License: GPLv2
Group: System Environment/Base
Requires: daxctl-libs%{?_isa} = %{version}-%{release}
%description -n daxctl
The daxctl utility provides enumeration and provisioning commands for
the Linux kernel Device-DAX facility. This facility enables DAX mappings
of performance / feature differentiated memory without need of a
filesystem.
%package -n daxctl-devel
Summary: Development files for libdaxctl
License: LGPLv2
Group: Development/Libraries
Requires: daxctl-libs%{?_isa} = %{version}-%{release}
%description -n daxctl-devel
The %{name}-devel package contains libraries and header files for
developing applications that use %{name}, a library for enumerating
"Device DAX" devices. Device DAX is a facility for establishing DAX
mappings of performance / feature-differentiated memory.
%package -n ndctl-libs
Summary: Management library for "libnvdimm" subsystem devices (Non-volatile Memory)
License: LGPLv2
Group: System Environment/Libraries
Requires: daxctl-libs%{?_isa} = %{version}-%{release}
%description -n ndctl-libs
Libraries for %{name}.
%package -n daxctl-libs
Summary: Management library for "Device DAX" devices
License: LGPLv2
Group: System Environment/Libraries
%description -n daxctl-libs
Device DAX is a facility for establishing DAX mappings of performance /
feature-differentiated memory. daxctl-libs provides an enumeration /
control API for these devices.
%prep
%autosetup -p1 ndctl-%{version}
%build
echo %{version} > version
./autogen.sh
%configure --disable-static --disable-silent-rules --disable-asciidoctor
make %{?_smp_mflags}
%install
%make_install
find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';'
%check
make check
%post -n ndctl-libs -p /sbin/ldconfig
%postun -n ndctl-libs -p /sbin/ldconfig
%post -n daxctl-libs -p /sbin/ldconfig
%postun -n daxctl-libs -p /sbin/ldconfig
%define bashcompdir %(pkg-config --variable=completionsdir bash-completion)
%files
%license LICENSES/preferred/GPL-2.0 LICENSES/other/MIT LICENSES/other/CC0-1.0
%{_bindir}/ndctl
%{_mandir}/man1/ndctl*
%{bashcompdir}/
%{_unitdir}/ndctl-monitor.service
%{_sysconfdir}/ndctl/keys/keys.readme
%{_sysconfdir}/modprobe.d/nvdimm-security.conf
%config(noreplace) %{_sysconfdir}/ndctl/monitor.conf
%files -n daxctl
%license LICENSES/preferred/GPL-2.0 LICENSES/other/MIT LICENSES/other/CC0-1.0
%{_bindir}/daxctl
%{_mandir}/man1/daxctl*
%{_datadir}/daxctl/daxctl.conf
%files -n ndctl-libs
%doc README.md
%license LICENSES/preferred/LGPL-2.1 LICENSES/other/MIT LICENSES/other/CC0-1.0
%{_libdir}/libndctl.so.*
%files -n daxctl-libs
%doc README.md
%license LICENSES/preferred/LGPL-2.1 LICENSES/other/MIT LICENSES/other/CC0-1.0
%{_libdir}/libdaxctl.so.*
%files -n ndctl-devel
%license LICENSES/preferred/LGPL-2.1
%{_includedir}/ndctl/
%{_libdir}/libndctl.so
%{_libdir}/pkgconfig/libndctl.pc
%files -n daxctl-devel
%license LICENSES/preferred/LGPL-2.1
%{_includedir}/daxctl/
%{_libdir}/libdaxctl.so
%{_libdir}/pkgconfig/libdaxctl.pc
%changelog
* Mon Jun 05 2023 Jeff Moyer <jmoyer@redhat.com> - 71.1-7.el8
- Another bump to fix gating tests
- Resolves: rhbz#2141031
* Mon Jun 05 2023 Jeff Moyer <jmoyer@redhat.com> - 71.1-6.el8
- Bump release for a rebuild
- Resolves: rhbz#2141031
* Fri Jun 02 2023 Jeff Moyer <jmoyer@redhat.com> - 71.1-5.el8
- Sync test harness with kernel updates. (Jeff Moyer)
- Resolves: rhbz#2141031
* Tue Jun 14 2022 Jeff Moyer <jmoyer@redhat.com> - 71.1-4.el8
- Pull in fixes from upstream v72 and v73 (Jeff Moyer)
- Fix enable-namespace all reporting errors incorrectly
- Add support for inject-smart on papr scm
- Related: bz#2090190 bz#1986185 bz#2040074
* Mon Nov 29 2021 Bryan Gurney <bgurney@redhat.com> - 71.1-3.el8
- Rebuild with latest json-c version
- Related: bz#2021816
* Thu Feb 11 2021 Jeff Moyer <jmoyer@redhat.com> - 71.1-2.el8
- Get rid of confusing message when deleting all namespaces
- Related: bz#1782182
* Fri Feb 5 2021 Jeff Moyer <jmoyer@redhat.com> - 71.1-1.el8
- Update to v71.1 to pull in ppc support.
- Related: bz#1782182
* Fri Nov 1 2019 Jeff Moyer <jmoyer@redhat.com> - 67-2.el8
- Fix up botched change to nvdimm-security.conf (Jeff Moyer)
- Related: bz#1724531
* Mon Oct 28 2019 Jeff Moyer <jmoyer@redhat.com> - 67-1.el8
- Rebase to v67. This brings in the following features:
- support for the 'security frozen' sysfs attribute
- support for using pmem as system ram
- various cleanup and bug fixes
- Fix load-keys failure in initramfs (Jeff Moyer)
- Resolves: bz#1724531 bz#1730673 bz#1741164 bz#1741165 bz#1749888 bz#1749889
* Mon Jun 3 2019 Jeff Moyer <jmoyer@redhat.com> - 65-1.el8
- Rebase to v65.
- Resolves: bz#1665407 bz#1634349
* Tue Oct 09 2018 Jeff Moyer <jmoyer@redhat.com - 62-2.el8
- Remove faulty udev rule
- Resolves: bz#1637624
* Thu Aug 23 2018 Jeff Moyer <jmoyer@redhat.com> - 62-1
- rebase to v62
- Resolves: bz#1567756 bz#1497651 bz#1610650 bz#1511774 bz#1570548
* Mon Apr 23 2018 Dan Williams <dan.j.williams@intel.com> - 60.1-1
- release v60.1
* Thu Apr 19 2018 Dan Williams <dan.j.williams@intel.com> - 60-1
- release v60
* Tue Mar 27 2018 Dan Williams <dan.j.williams@intel.com> - 59.3-1
- release v59.3
* Tue Mar 06 2018 Björn Esser <besser82@fedoraproject.org> - 59.2-2
- Rebuilt for libjson-c.so.4 (json-c v0.13.1)
* Fri Feb 09 2018 Dan Williams <dan.j.williams@intel.com> - 59.2-1
- release v59.2
* Fri Feb 09 2018 Dan Williams <dan.j.williams@intel.com> - 59.1-1
- release v59.1
* Fri Feb 09 2018 Dan Williams <dan.j.williams@intel.com> - 59-1
- release v59
* Thu Feb 08 2018 Fedora Release Engineering <releng@fedoraproject.org> - 58.4-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Sun Dec 10 2017 Björn Esser <besser82@fedoraproject.org> - 58.4-2
- Rebuilt for libjson-c.so.3
* Thu Nov 16 2017 Dan Williams <dan.j.williams@intel.com> - 58.4-1
- release v58.4
* Thu Sep 21 2017 Dan Williams <dan.j.williams@intel.com> - 58.2-1
- release v58.2
* Fri Sep 08 2017 Dan Williams <dan.j.williams@intel.com> - 58.1-2
- gate libpmem dependency on x86_64
* Fri Sep 08 2017 Dan Williams <dan.j.williams@intel.com> - 58.1-1
- add libpmem dependency
- release v58.1
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 57.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 57.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Fri Jun 30 2017 Dan Williams <dan.j.williams@intel.com> - 57.1-1
- Release v57.1
* Sat May 27 2017 Dan Williams <dan.j.williams@intel.com> - 57-1
- Release v57
* Fri Feb 10 2017 Dan Williams <dan.j.williams@intel.com> - 56-1
- Release v56
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 55-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
* Fri Oct 21 2016 Dan Williams <dan.j.williams@intel.com> - 55-1
- release v55
* Fri Aug 05 2016 Dan Williams <dan.j.williams@intel.com> - 54-1
- add explicit lib version dependencies
* Sat May 28 2016 Dan Williams <dan.j.williams@intel.com> - 53.1-1
- Fix up tag format vs source url confusion
* Fri May 27 2016 Dan Williams <dan.j.williams@intel.com> - 53-1
- add daxctl-libs + daxctl-devel packages
- add bash completion
* Mon Apr 04 2016 Dan Williams <dan.j.williams@intel.com> - 52-1
- Initial rpm submission to Fedora

6
gating.yaml Normal file
View File

@ -0,0 +1,6 @@
--- !Policy
product_versions:
- rhel-9
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional}

405
ndctl.spec Normal file
View File

@ -0,0 +1,405 @@
Name: ndctl
Version: 78
Release: 2%{?dist}
Summary: Manage "libnvdimm" subsystem devices (Non-volatile Memory)
License: GPLv2
Url: https://github.com/pmem/ndctl
Source0: https://github.com/pmem/%{name}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
Patch0: 0001-test-daxctl-devices.sh-increase-the-namespace-size.patch
Patch1: 0002-ndctl-vendor-iniparser.patch
Patch2: 0003-ndctl-check-the-old-directory-for-monitor.conf.patch
Requires: ndctl-libs%{?_isa} = %{version}-%{release}
Requires: daxctl-libs%{?_isa} = %{version}-%{release}
Requires: cxl-libs%{?_isa} = %{version}-%{release}
BuildRequires: make
BuildRequires: autoconf
%if 0%{?rhel} < 9
BuildRequires: asciidoc
%define asciidoc -Dasciidoctor=disabled
%else
BuildRequires: rubygem-asciidoctor
BuildRequires: libtraceevent-devel
BuildRequires: libtracefs-devel
%define asciidoc -Dasciidoctor=enabled
%define libtracefs -Dlibtracefs=enabled
%endif
BuildRequires: xmlto
BuildRequires: meson
BuildRequires: ninja-build
BuildRequires: libtool
BuildRequires: pkgconfig
BuildRequires: pkgconfig(libkmod)
BuildRequires: pkgconfig(libudev)
BuildRequires: pkgconfig(uuid)
BuildRequires: pkgconfig(json-c)
BuildRequires: pkgconfig(bash-completion)
BuildRequires: pkgconfig(systemd)
BuildRequires: keyutils-libs-devel
%description
Utility library for managing the "libnvdimm" subsystem. The "libnvdimm"
subsystem defines a kernel device model and control message interface for
platform NVDIMM resources like those defined by the ACPI 6+ NFIT (NVDIMM
Firmware Interface Table).
%package -n ndctl-devel
Summary: Development files for libndctl
License: LGPLv2
Requires: ndctl-libs%{?_isa} = %{version}-%{release}
%description -n ndctl-devel
The %{name}-devel package contains libraries and header files for
developing applications that use %{name}.
%package -n daxctl
Summary: Manage Device-DAX instances
License: GPLv2
Requires: daxctl-libs%{?_isa} = %{version}-%{release}
%description -n daxctl
The daxctl utility provides enumeration and provisioning commands for
the Linux kernel Device-DAX facility. This facility enables DAX mappings
of performance / feature differentiated memory without need of a
filesystem.
%package -n daxctl-devel
Summary: Development files for libdaxctl
License: LGPLv2
Requires: daxctl-libs%{?_isa} = %{version}-%{release}
%description -n daxctl-devel
The %{name}-devel package contains libraries and header files for
developing applications that use %{name}, a library for enumerating
"Device DAX" devices. Device DAX is a facility for establishing DAX
mappings of performance / feature-differentiated memory.
%package -n cxl-cli
Summary: Manage CXL devices
License: GPLv2
Requires: cxl-libs%{?_isa} = %{version}-%{release}
%description -n cxl-cli
The cxl utility provides enumeration and provisioning commands for
the Linux kernel CXL devices.
%package -n cxl-devel
Summary: Development files for libcxl
License: LGPLv2
Requires: cxl-libs%{?_isa} = %{version}-%{release}
%description -n cxl-devel
This package contains libraries and header files for developing applications
that use libcxl, a library for enumerating and communicating with CXL devices.
%package -n ndctl-libs
Summary: Management library for "libnvdimm" subsystem devices (Non-volatile Memory)
License: LGPLv2
Requires: daxctl-libs%{?_isa} = %{version}-%{release}
%description -n ndctl-libs
Libraries for %{name}.
%package -n daxctl-libs
Summary: Management library for "Device DAX" devices
License: LGPLv2
Requires: ndctl-libs%{?_isa} = %{version}-%{release}
%description -n daxctl-libs
Device DAX is a facility for establishing DAX mappings of performance /
feature-differentiated memory. daxctl-libs provides an enumeration /
control API for these devices.
%package -n cxl-libs
Summary: Management library for CXL devices
License: LGPLv2
Requires: daxctl-libs%{?_isa} = %{version}-%{release}
%description -n cxl-libs
libcxl is a library for enumerating and communicating with CXL devices.
%prep
%autosetup -p1 ndctl-%{version}
%build
%meson %{?asciidoc} %{?libtracefs} -Dversion-tag=%{version}
%meson_build
%install
%meson_install
%ldconfig_scriptlets -n ndctl-libs
%ldconfig_scriptlets -n daxctl-libs
%ldconfig_scriptlets -n cxl-libs
%define bashcompdir %(pkg-config --variable=completionsdir bash-completion)
%files
%license LICENSES/preferred/GPL-2.0 LICENSES/other/MIT LICENSES/other/CC0-1.0 LICENSES/other/iniparser-MIT
%{_bindir}/ndctl
%{_mandir}/man1/ndctl*
%{bashcompdir}/ndctl
%{_unitdir}/ndctl-monitor.service
%dir %{_sysconfdir}/ndctl
%dir %{_sysconfdir}/ndctl/keys
%{_sysconfdir}/ndctl/keys/keys.readme
%{_sysconfdir}/modprobe.d/nvdimm-security.conf
%dir %{_sysconfdir}/ndctl.conf.d
%config(noreplace) %{_sysconfdir}/ndctl/monitor.conf
%config(noreplace) %{_sysconfdir}/ndctl.conf.d/ndctl.conf
%files -n daxctl
%license LICENSES/preferred/GPL-2.0 LICENSES/other/MIT LICENSES/other/CC0-1.0 LICENSES/other/iniparser-MIT
%{_bindir}/daxctl
%{_mandir}/man1/daxctl*
%{_datadir}/daxctl
%{bashcompdir}/daxctl
%{_unitdir}/daxdev-reconfigure@.service
%config %{_udevrulesdir}/90-daxctl-device.rules
%dir %{_sysconfdir}/daxctl.conf.d/
%config(noreplace) %{_sysconfdir}/daxctl.conf.d/daxctl.example.conf
%files -n cxl-cli
%license LICENSES/preferred/GPL-2.0 LICENSES/other/MIT LICENSES/other/CC0-1.0 LICENSES/other/iniparser-MIT
%{_bindir}/cxl
%{_mandir}/man1/cxl*
%{bashcompdir}/cxl
%{_unitdir}/cxl-monitor.service
%files -n ndctl-libs
%doc README.md
%license LICENSES/preferred/LGPL-2.1 LICENSES/other/MIT LICENSES/other/CC0-1.0 LICENSES/other/iniparser-MIT
%{_libdir}/libndctl.so.*
%files -n daxctl-libs
%doc README.md
%license LICENSES/preferred/LGPL-2.1 LICENSES/other/MIT LICENSES/other/CC0-1.0 LICENSES/other/iniparser-MIT
%{_libdir}/libdaxctl.so.*
%files -n cxl-libs
%doc README.md
%license LICENSES/preferred/LGPL-2.1 LICENSES/other/MIT LICENSES/other/CC0-1.0 LICENSES/other/iniparser-MIT
%{_libdir}/libcxl.so.*
%files -n ndctl-devel
%license LICENSES/preferred/LGPL-2.1
%{_includedir}/ndctl/
%{_libdir}/libndctl.so
%{_libdir}/pkgconfig/libndctl.pc
%files -n daxctl-devel
%license LICENSES/preferred/LGPL-2.1
%{_includedir}/daxctl/
%{_libdir}/libdaxctl.so
%{_libdir}/pkgconfig/libdaxctl.pc
%files -n cxl-devel
%license LICENSES/preferred/LGPL-2.1
%{_includedir}/cxl/
%{_libdir}/libcxl.so
%{_libdir}/pkgconfig/libcxl.pc
%{_mandir}/man3/cxl*
%{_mandir}/man3/libcxl.3*
%changelog
* Fri Jul 26 2024 Jeff Moyer <jmoyer@redhat.com> - 78-2
- Add explicit package version requirements. (Jeff Moyer)
- Related: RHEL-29151
* Wed Nov 15 2023 Jeff Moyer <jmoyer@redhat.com> - 78-1
- Rebase to v78
- Add support for legacy monitor.conf file location
- Fix a test failure.
- Resolves: RHEL-10382
- Resolves: RHEL-8204
- Resolves: RHEL-29151
* Thu Oct 13 2022 Jeff Moyer <jmoyer@redhat.com> - 71.1-8
- Backport changes up to v74, excluding the config file changes. (Jeff Moyer)
This includes support for the CXL commands, and adds the following
packages: cxl-cli, cxl-devel, cxl-libs
- Resolves: rhbz#2132167
* Tue Jun 14 2022 Bryan Gurney <bgurney@redhat.com> - 71.1-7
- Pull in fixes from upstream v72 and v73 (Jeff Moyer)
- Fix enable-namespace all reporting errors incorrectly
- Add support for inject-smart on papr scm
- Related: rhbz#2040075
- Related: rhbz#1873851
- Related: rhbz#1880578
- Related: rhbz#1922538
- Related: rhbz#2087707
* Wed Dec 1 2021 Bryan Gurney <bgurney@redhat.com> - 71.1-6
- Add gating test
- Related: rhbz#2028152
* Mon Nov 29 2021 Bryan Gurney <bgurney@redhat.com> - 71.1-5
- Rebuild with latest json-c version
- Related: rhbz#2023317
* Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com> - 71.1-4
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688
* Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com> - 71.1-3
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 71.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Tue Dec 22 2020 Vishal Verma <vishal.l.verma@intel.com> - 71.1-1
- release v71.1
* Sat Dec 19 2020 Vishal Verma <vishal.l.verma@intel.com> - 71-1
- release v71
* Sat Oct 10 2020 Vishal Verma <vishal.l.verma@intel.com> - 70.1-1
- release v70.1
* Tue Oct 06 2020 Vishal Verma <vishal@stellar.sh> - 70-1
- release v70
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 69-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Thu Jul 23 2020 Vishal Verma <vishal.l.verma@intel.com> - 69-1
- release v69
* Tue Apr 21 2020 Björn Esser <besser82@fedoraproject.org> - 68-2
- Rebuild (json-c)
* Tue Mar 24 2020 Vishal Verma <vishal@stellar.sh> - 68-1
- release v68
* Fri Jan 31 2020 Vishal Verma <vishal.l.verma@intel.com> - 67-3
- Add fix for GCC10 builds
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 67-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Mon Oct 28 2019 Vishal Verma <vishal.l.verma@intel.com> - 67-1
- release v67
* Wed Aug 07 2019 Vishal Verma <vishal.l.verma@intel.com> - 66-1
- release v66
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 65-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Sat May 11 2019 Vishal Verma <vishal.l.verma@intel.com> - 65-1
- release v65
* Wed Feb 06 2019 Vishal Verma <vishal.l.verma@intel.com> - 64.1-1
- release v64.1
* Mon Feb 04 2019 Vishal Verma <vishal.l.verma@intel.com> - 64-1
- release v64
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 63-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Fri Oct 05 2018 Vishal Verma <vishal.l.verma@intel.com> - 63-1
- release v63
- remove ndctl-udev and related files
* Tue Aug 14 2018 Vishal Verma <vishal@stellar.sh> - 62-1
- release v62
- Add files for udev and ndctl-monitor
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 61.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Wed Jul 11 2018 Vishal Verma <vishal.l.verma@intel.com> - 61.2-1
- release v61.2
* Tue Jun 26 2018 Vishal Verma <vishal@stellar.sh> - 61.1-1
- release v61.1
* Tue Jun 26 2018 Vishal Verma <vishal@stellar.sh> - 61-1
- new version
* Thu May 17 2018 Dan Williams <dan.j.williams@intel.com> - 60.3-1
- release v60.3
* Mon Apr 23 2018 Dan Williams <dan.j.williams@intel.com> - 60.1-1
- release v60.1
* Thu Apr 19 2018 Dan Williams <dan.j.williams@intel.com> - 60-1
- release v60
* Tue Mar 27 2018 Dan Williams <dan.j.williams@intel.com> - 59.3-1
- release v59.3
* Tue Mar 06 2018 Björn Esser <besser82@fedoraproject.org> - 59.2-2
- Rebuilt for libjson-c.so.4 (json-c v0.13.1)
* Fri Feb 09 2018 Dan Williams <dan.j.williams@intel.com> - 59.2-1
- release v59.2
* Fri Feb 09 2018 Dan Williams <dan.j.williams@intel.com> - 59.1-1
- release v59.1
* Fri Feb 09 2018 Dan Williams <dan.j.williams@intel.com> - 59-1
- release v59
* Thu Feb 08 2018 Fedora Release Engineering <releng@fedoraproject.org> - 58.4-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Sun Dec 10 2017 Björn Esser <besser82@fedoraproject.org> - 58.4-2
- Rebuilt for libjson-c.so.3
* Thu Nov 16 2017 Dan Williams <dan.j.williams@intel.com> - 58.4-1
- release v58.4
* Thu Sep 21 2017 Dan Williams <dan.j.williams@intel.com> - 58.2-1
- release v58.2
* Fri Sep 08 2017 Dan Williams <dan.j.williams@intel.com> - 58.1-2
- gate libpmem dependency on x86_64
* Fri Sep 08 2017 Dan Williams <dan.j.williams@intel.com> - 58.1-1
- add libpmem dependency
- release v58.1
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 57.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 57.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Fri Jun 30 2017 Dan Williams <dan.j.williams@intel.com> - 57.1-1
- Release v57.1
* Sat May 27 2017 Dan Williams <dan.j.williams@intel.com> - 57-1
- Release v57
* Fri Feb 10 2017 Dan Williams <dan.j.williams@intel.com> - 56-1
- Release v56
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 55-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
* Fri Oct 21 2016 Dan Williams <dan.j.williams@intel.com> - 55-1
- release v55
* Fri Aug 05 2016 Dan Williams <dan.j.williams@intel.com> - 54-1
- add explicit lib version dependencies
* Sat May 28 2016 Dan Williams <dan.j.williams@intel.com> - 53.1-1
- Fix up tag format vs source url confusion
* Fri May 27 2016 Dan Williams <dan.j.williams@intel.com> - 53-1
- add daxctl-libs + daxctl-devel packages
- add bash completion
* Mon Apr 04 2016 Dan Williams <dan.j.williams@intel.com> - 52-1
- Initial rpm submission to Fedora

1
sources Normal file
View File

@ -0,0 +1 @@
SHA512 (ndctl-78.tar.gz) = ad217dd45c8d6bbd0089a88c46e1e04813b65e97c8817aaddeca967b20ce948e76c4b7ede5517c45d0b645b5c3dc61aac95cc944e8e5fc60100e45b41f13f2a0

272
tests/include/tc.sh Normal file
View File

@ -0,0 +1,272 @@
#!/bin/bash
# Copyright (c) 2016 Red Hat, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Author: Yi Zhang <yizhan@redhat.com>
# filename: function
# USAGE
test x$LXT_TC = x || return
LXT_TC=1
#
# print the current date
# usage: d=$(tdate)
#
tdate ()
{
date '+%T' 2>/dev/null
}
#
# print the log information
# usage: tlog "hello world" "WARNING"
#
tlog ()
{
local msg=$1
local log_level=${2:-INFO}
local cur_date=$(tdate)
echo "[$log_level][$cur_date]$msg"
return 0
}
#
# run the cmd and format the log. return the exitint status of cmd
# use the global variables: tSTDOUT and tSTDERR to return the stdout and stderr
# usage: trun "ls"
# trun "ls"; echo $?
# stdout=$tSTDOUT
# stderr=$tSTDERR
#
trun ()
{
local cmd="$*"
_trun_ "$cmd"
}
#
# verify the execution of command
# if the cmd return 0, mark this checkpoint failed and return 1
# if not, mark it passed and return 0
# usage: tnot "ls /not_existing"
#
tnot () {
local cmd="$*"
_trun_ "$cmd" 1
if test $? -eq 0; then
tfail_ "$cmd" ;
else
tpass_ "$cmd" ;
fi
}
#
# verify the execution of command
# if the cmd return 0, mark this checkpoint passed and return 0
# if not, mark it failed and return 1
# usage: tok "ls /"
#
tok ()
{
local cmd="$*"
_trun_ "$cmd" 0
if test $? -eq 0; then
tpass_ "$cmd" ;
else
tfail_ "$cmd" ;
fi
}
#
# verify the execution of command
# if the cmd return 0, mark this checkpoint passed and return 0
# if not, mark it failes and exit
# usage: terr "ls"
#
#terr ()
#{
# tok "$*" || tend
#}
#
# verify the execution of command
# if the cmd return 0, will continue to run the script
# if not, mark it failes and exit
# usage: terr "ls"
#
terr ()
{
local cmd="$*"
_trun_ "$cmd" 0
if test $? -ne 0; then
tfail_ "$cmd" ;
tend ;
fi
}
#
# exit the program and print the log message
# usage: texit "error message" 100
# similar to the exception
#
texit ()
{
msg=$1
err=$2
is_null $err && err=1
test $err -lt 1 || err=1
tlog "$msg" "ERROR"
exit $2
}
#
# print the test report, cleanup the testing bed and close the testing.
# usage: tend
#
tend ()
{
local pcount=$(wc -l $tPASS_FILE | awk '{print $1}')
local fcount=$(wc -l $tFAIL_FILE | awk '{print $1}')
local total=$(( $pcount + $fcount ))
echo "#################################Test Report###############################"
echo "TOTAL : $total"
echo "PASSED : $pcount"
echo "FAILED : $fcount"
cat $tPASS_FILE $tFAIL_FILE
echo "###########################End of running $0########################"
#cleanup
rm -f $tPASS_FILE $tFAIL_FILE $tRETURN_FILE $tSTDERR_FILE
# rm -rf $LXT_TMP_DIR
if [[ $pcount -eq 0 ]] && [[ $total -eq 0 ]];then
exit 0
fi
test $pcount -eq 0 && exit 1
test $pcount -eq $total && exit 0
exit 1
}
#
# private function
#
#
# print the error message and call stack. return 1
#
tfail_ ()
{
local msg=$*
tlog "$msg" "ERROR" >>$tFAIL_FILE
return 1
}
#
# print the sucessful message. return 0
#
tpass_ ()
{
local msg=$*
tlog "$msg" "PASS" >> $tPASS_FILE
return 0
}
_trun_ ()
{
local cmd="$1"
local chk="$2"
local cur_date=$(tdate)
local stdout=$(eval "$cmd" 2>$tSTDERR_FILE; echo $? >$tRETURN_FILE 2>/dev/null)
#timeout -- how to set timeout?
local exit_status=$(< $tRETURN_FILE)
local stderr=$(< $tSTDERR_FILE)
local msg=CMD
#tnot
if test x$chk = x1; then
test $exit_status -eq 0 || msg=PASS
test $exit_status -eq 0 && msg=FAIL
#should let the tester know this is the negative testing
#if cmd return 0 we will return 1 and vice versa
cmd="[NOT] $cmd"
fi
#tok
if test x$chk = x0; then
test $exit_status -eq 0 && msg=PASS
test $exit_status -eq 0 || msg=FAIL
fi
tSTDOUT=$stdout
tSTDERR=$stderr
test $tIGNORE_STDOUT -eq 1 && stdout='redirect the stdout to /dev/null'
test $tIGNORE_STDERR -eq 1 && stderr='redirect the stderr to /dev/null'
echo "[$msg][$cur_date][$HOSTNAME]$cmd"
echo "STDOUT:"
test "x$stdout" = x || echo "$stdout"
echo "STDERR:$stderr"
echo "RETURN:$exit_status"
echo
return $exit_status
}
#
# setup the testing environment
#
_tsetup_ ()
{
LXT_TMP_DIR="/mnt/testarea/lxt";
test -z "$HOSTNAME" && HOSTNAME=$(hostname)
test -d "$LXT_TMP_DIR" || mkdir -p "$LXT_TMP_DIR" >& /dev/null || exit 1
tSTDERR_FILE="$LXT_TMP_DIR/stderr.$$"
test -e "$tSTDERR_FILE" || > "$tSTDERR_FILE" || exit 1
tRETURN_FILE="$LXT_TMP_DIR/return.$$"
test -e "$tRETURN_FILE" || > "$tRETURN_FILE" || exit 1
tPASS_FILE="$LXT_TMP_DIR/tc.pass.$$"
test -e "$tPASS_FILE" || > "$tPASS_FILE" || exit 1
tFAIL_FILE="$LXT_TMP_DIR/tc.fail.$$"
test -e "$tFAIL_FILE" || > "$tFAIL_FILE" || exit 1
}
#
# main
#
# global variables
tIGNORE_STDOUT=0
tIGNORE_STDERR=0
tSTDOUT=
tSTDERR=
#LXT_TMP_DIR
# only used in this file
tPASS_FILE=
tFAIL_FILE=
_tsetup_

675
tests/sanity/LICENSE Normal file
View File

@ -0,0 +1,675 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

47
tests/sanity/Makefile Normal file
View File

@ -0,0 +1,47 @@
#!/bin/bash
# Copyright (c) 2016 Red Hat, Inc.
# #
# # This program is free software: you can redistribute it and/or modify
# # it under the terms of the GNU General Public License as published by
# # the Free Software Foundation, either version 3 of the License, or
# # (at your option) any later version.
# #
# # This program is distributed in the hope that it will be useful,
# # but WITHOUT ANY WARRANTY; without even the implied warranty of
# # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# # GNU General Public License for more details.
# #
# # You should have received a copy of the GNU General Public License
# # along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# # Author: Yi Zhang <yizhan@redhat.com>
.PHONY: all install download clean LICENSE
BUILT_FILES=
FILES=$(METADATA) Makefile PURPOSE main.sh
run: $(FILES) build
./main.sh
build: $(BUILT_FILES)
chmod a+x ./main.sh
clean:
rm -f *~ *.rpm $(BUILT_FILES)
$(METADATA): Makefile
@touch $(METADATA)
@echo "Owner: Yi Zhang <yizhan@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "License: GPLv3" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Description: ndctl sanity test" >> $(METADATA)
@echo "TestTime: 15m" >> $(METADATA)
@echo "RunFor: ndctl" >> $(METADATA)
@echo "Requires: ndctl" >> $(METADATA)
rhts-lint $(METADATA)

1
tests/sanity/PURPOSE Normal file
View File

@ -0,0 +1 @@
Sanity test for ndctl package

32
tests/sanity/main.sh Normal file
View File

@ -0,0 +1,32 @@
#!/bin/bash
# Copyright (c) 2016 Red Hat, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Author: Yi Zhang <yizhan@redhat.com>
#set -x
source ../include/tc.sh || exit 200
tlog "running $0"
tok "yum -y reinstall ndctl"
tok "yum -y remove ndctl"
tok "yum -y install ndctl"
tok "which ndctl"
tok "yum info ndctl"
tok "[[ -f "/usr/bin/ndctl" ]]"
tok "ndctl --list-cmds"
tok "ndctl version"

15
tests/tests.yml Normal file
View File

@ -0,0 +1,15 @@
---
# No tests suitable for atomic environment
# No tests suitable for container environment
# Tests suitable for classic environment
- hosts: localhost
roles:
- role: standard-test-beakerlib
tags:
- classic
tests:
- sanity
required_packages:
- fio
- which