From: Alison Schofield <alison.schofield@intel.com>
To: nvdimm@lists.linux.dev
Cc: Alison Schofield <alison.schofield@intel.com>,
Marc Herbert <marc.herbert@intel.com>
Subject: [ndctl PATCH] ndctl/test: fully reset nfit_test in pmem_ns unit test
Date: Tue, 21 Oct 2025 14:26:46 -0700 [thread overview]
Message-ID: <20251021212648.997901-1-alison.schofield@intel.com> (raw)
The pmem_ns unit test frequently fails when run as part of the full
suite, yet passes when executed alone.
The test first looks for an ACPI.NFIT bus with a usable region, and if
none is found, falls back to using the nfit_test bus. However, that
fallback consistently fails with errors such as:
path: /sys/devices/platform/nfit_test.0/ndbus2/region7/namespace7.0/uuid
libndctl: write_attr: failed to open /sys/devices/platform/nfit_test.0/ndbus2/region7/namespace7.0/uuid: No such file or directory
/root/ndctl/build/test/pmem-ns: failed to create PMEM namespace
This occurs because calling ndctl_test_init() with a NULL context only
unloads and reloads the nfit_test module, but does not invalidate and
reinitialize the libndctl context or sysfs view from previous runs.
The resulting stale state prevents the pmem_ns test from creating a
new namespace cleanly.
Replace the NULL context parameter when calling ndctl_test_init()
with the available ndctl_ctx to ensure pmem_ns can find usable PMEM
regions.
Reported-by: Marc Herbert <marc.herbert@intel.com>
Closes: https://github.com/pmem/ndctl/issues/290
Signed-off-by: Alison Schofield <alison.schofield@intel.com>
---
test/pmem_namespaces.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/pmem_namespaces.c b/test/pmem_namespaces.c
index 4bafff5164c8..7b8de9dcb61d 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 = ndctl_test_init(&kmod_ctx, &mod, NULL, log_level, test);
+ rc = ndctl_test_init(&kmod_ctx, &mod, ctx, log_level, test);
ndctl_invalidate(ctx);
bus = ndctl_bus_get_by_provider(ctx, "nfit_test.0");
if (rc < 0 || !bus) {
--
2.37.3
next reply other threads:[~2025-10-21 21:26 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-21 21:26 Alison Schofield [this message]
2025-10-22 15:04 ` [ndctl PATCH] ndctl/test: fully reset nfit_test in pmem_ns unit test Dave Jiang
2025-10-22 18:37 ` Marc Herbert
2025-10-23 5:15 ` Alison Schofield
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251021212648.997901-1-alison.schofield@intel.com \
--to=alison.schofield@intel.com \
--cc=marc.herbert@intel.com \
--cc=nvdimm@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox