Skip to contentSkip to conversation

ndctl: Add missing test dependencies and other fixups

PATCH In review Dan Williams 4 participants 16 messages Jun 18, 2025 – Jun 20, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover ndctl: Add missing test dependencies and other fixups

Recently I stood up a new test system from scratch and discovered some gaps in the documentation and the tests.

Fix those up to get all tests passing with v6.16-rc2 and latest version of all test dependencies currently available in Fedora Rawhide.

Dan Williams (5):
build: Fix meson feature deprecation warnings
test: Fix 'ndctl' dependency in test/sub-section.sh
test: Fix dax.sh expectations
test: Update documentation with required packages to install
test: Fixup fwctl dependency

 README.md           | 5 +++++
 contrib/meson.build | 2 +-
 meson.build         | 5 +++--
 test/dax.sh         | 3 ++-
 test/meson.build    | 1 +
 test/sub-section.sh | 2 +-
 6 files changed, 13 insertions(+), 5 deletions(-)

base-commit: 74b9e411bf13e87df39a517d10143fafa7e2ea92

Signature · 1 line
2.49.0
#1 lore raw

PATCH 1/5 build: Fix meson feature deprecation warnings

There are a few instances of the warning:

"meson.build: WARNING: Project does not target a minimum version but uses feature deprecated since '0.56.0': dependency.get_pkgconfig_variable. use dependency.get_variable(pkgconfig : ...) instead"

Move to the new style and mark the project as needing at least that minimum version.

---
 contrib/meson.build | 2 +-
 meson.build         | 5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)
contrib/meson.build +1 -1
index 48aa7c071f92..33a409a2d7d0 100644
@@ -2,7 +2,7 @@ bashcompletiondir = get_option('bashcompletiondir')
 if bashcompletiondir == ''
   bash_completion = dependency('bash-completion', required : false)
   if bash_completion.found()
-      bashcompletiondir = bash_completion.get_pkgconfig_variable('completionsdir')
+      bashcompletiondir = bash_completion.get_variable(pkgconfig : 'completionsdir')
   else
     bashcompletiondir = datadir / 'bash-completion/completions'
   endif
meson.build +3 -2
index 19808bb21db8..300eddb99235 100644
@@ -1,5 +1,6 @@
 project('ndctl', 'c',
   version : '82',
+  meson_version: '>= 0.56.0',
   license : [
     'GPL-2.0',
     'LGPL-2.1',
@@ -159,9 +160,9 @@ endif
 
 if get_option('systemd').enabled()
   systemd = dependency('systemd', required : true)
-  systemdunitdir = systemd.get_pkgconfig_variable('systemdsystemunitdir')
+  systemdunitdir = systemd.get_variable(pkgconfig : 'systemdsystemunitdir')
   udev = dependency('udev', required : true)
-  udevdir = udev.get_pkgconfig_variable('udevdir')
+  udevdir = udev.get_variable(pkgconfig : 'udevdir')
   udevrulesdir = udevdir / 'rules.d'
 endif
 
Signature · 1 line
2.49.0
maintainer Reviewed-by on v1 1/5
#2 lore raw

Re: [ndctl PATCH 1/5] build: Fix meson feature deprecation warnings

Quoted 10 lines · Dan Williams

There are a few instances of the warning:

"meson.build: WARNING: Project does not target a minimum version but uses feature deprecated since '0.56.0': dependency.get_pkgconfig_variable. use dependency.get_variable(pkgconfig : ...) instead"

Move to the new style and mark the project as needing at least that minimum version.

Quoted 41 lines
---
 contrib/meson.build | 2 +-
 meson.build         | 5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)
contrib/meson.build +1 -1
index 48aa7c071f92..33a409a2d7d0 100644
@@ -2,7 +2,7 @@ bashcompletiondir = get_option('bashcompletiondir')
 if bashcompletiondir == ''
   bash_completion = dependency('bash-completion', required : false)
   if bash_completion.found()
-      bashcompletiondir = bash_completion.get_pkgconfig_variable('completionsdir')
+      bashcompletiondir = bash_completion.get_variable(pkgconfig : 'completionsdir')
   else
     bashcompletiondir = datadir / 'bash-completion/completions'
   endif
meson.build +3 -2
index 19808bb21db8..300eddb99235 100644
@@ -1,5 +1,6 @@
 project('ndctl', 'c',
   version : '82',
+  meson_version: '>= 0.56.0',
   license : [
     'GPL-2.0',
     'LGPL-2.1',
@@ -159,9 +160,9 @@ endif
 
 if get_option('systemd').enabled()
   systemd = dependency('systemd', required : true)
-  systemdunitdir = systemd.get_pkgconfig_variable('systemdsystemunitdir')
+  systemdunitdir = systemd.get_variable(pkgconfig : 'systemdsystemunitdir')
   udev = dependency('udev', required : true)
-  udevdir = udev.get_pkgconfig_variable('udevdir')
+  udevdir = udev.get_variable(pkgconfig : 'udevdir')
   udevrulesdir = udevdir / 'rules.d'
 endif
 
#3 lore raw

PATCH 2/5 test: Fix 'ndctl' dependency in test/sub-section.sh

In reply to Dan Williams

The test fails with:

"sub-section.sh: line 23: ndctl: command not found"

...it should be using the built ndctl program, not the one installed in the filesystem.

---
 test/sub-section.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
test/sub-section.sh +1 -1
index 77b963355c8f..5acc25eefe87 100755
@@ -20,7 +20,7 @@ MIN_AVAIL=$((TEST_SIZE*4))
 MAX_NS=10
 NAME="subsection-test"
 
-ndctl list -N | jq -r ".[] | select(.name==\"subsection-test\") | .dev"
+$NDCTL list -N | jq -r ".[] | select(.name==\"subsection-test\") | .dev"
 
 rc=$FAIL
 cleanup() {
Signature · 1 line
2.49.0
maintainer Reviewed-by on v1 2/5
#4 lore raw

Re: [ndctl PATCH 2/5] test: Fix 'ndctl' dependency in test/sub-section.sh

Quoted 8 lines · Dan Williams

The test fails with:

"sub-section.sh: line 23: ndctl: command not found"

...it should be using the built ndctl program, not the one installed in the filesystem.

Quoted 17 lines
---
 test/sub-section.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
test/sub-section.sh +1 -1
index 77b963355c8f..5acc25eefe87 100755
@@ -20,7 +20,7 @@ MIN_AVAIL=$((TEST_SIZE*4))
 MAX_NS=10
 NAME="subsection-test"
 
-ndctl list -N | jq -r ".[] | select(.name==\"subsection-test\") | .dev"
+$NDCTL list -N | jq -r ".[] | select(.name==\"subsection-test\") | .dev"
 
 rc=$FAIL
 cleanup() {
#5 lore raw

PATCH 3/5 test: Fix dax.sh expectations

In reply to Dan Williams

With current kernel+tracecmd combinations stdout is no longer purely trace records and column "21" is no longer the vmfault_t result.

Drop, if present, the diagnostic print of how many CPUs are in the trace and use the more universally compatible assumption that the fault result is the last column rather than a specific column.

---
 test/dax.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
test/dax.sh +2 -1
index 3ffbc8079eba..98faaf0eb9b2 100755
@@ -37,13 +37,14 @@ run_test() {
 	rc=1
 	while read -r p; do
 		[[ $p ]] || continue
+		[[ $p == cpus=* ]] && continue
 		if [ "$count" -lt 10 ]; then
 			if [ "$p" != "0x100" ] && [ "$p" != "NOPAGE" ]; then
 				cleanup "$1"
 			fi
 		fi
 		count=$((count + 1))
-	done < <(trace-cmd report | awk '{ print $21 }')
+	done < <(trace-cmd report | awk '{ print $NF }')
 
 	if [ $count -lt 10 ]; then
 		cleanup "$1"
Signature · 1 line
2.49.0
maintainer Reviewed-by on v1 3/5
#6 lore raw

Re: [ndctl PATCH 3/5] test: Fix dax.sh expectations

Quoted 8 lines · Dan Williams

With current kernel+tracecmd combinations stdout is no longer purely trace records and column "21" is no longer the vmfault_t result.

Drop, if present, the diagnostic print of how many CPUs are in the trace and use the more universally compatible assumption that the fault result is the last column rather than a specific column.

Quoted 24 lines
---
 test/dax.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
test/dax.sh +2 -1
index 3ffbc8079eba..98faaf0eb9b2 100755
@@ -37,13 +37,14 @@ run_test() {
 	rc=1
 	while read -r p; do
 		[[ $p ]] || continue
+		[[ $p == cpus=* ]] && continue
 		if [ "$count" -lt 10 ]; then
 			if [ "$p" != "0x100" ] && [ "$p" != "NOPAGE" ]; then
 				cleanup "$1"
 			fi
 		fi
 		count=$((count + 1))
-	done < <(trace-cmd report | awk '{ print $21 }')
+	done < <(trace-cmd report | awk '{ print $NF }')
 
 	if [ $count -lt 10 ]; then
 		cleanup "$1"
maintainer
#7 lore raw

Re: [ndctl PATCH 3/5] test: Fix dax.sh expectations

In reply to Dan Williams
Quoted 17 lines · Dan Williams

With current kernel+tracecmd combinations stdout is no longer purely trace records and column "21" is no longer the vmfault_t result.

Drop, if present, the diagnostic print of how many CPUs are in the trace and use the more universally compatible assumption that the fault result is the last column rather than a specific column.

---
 test/dax.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
test/dax.sh +0 -0
index 3ffbc8079eba..98faaf0eb9b2 100755

test/dax.sh run_test() { · line 40

Quoted 4 lines
test/dax.sh +1 -0
@@ -37,13 +37,14 @@ run_test() {
 	rc=1
 	while read -r p; do
 		[[ $p ]] || continue
+		[[ $p == cpus=* ]] && continue

remove above line

test/dax.sh run_test() { · line 47

Quoted 8 lines
test/dax.sh +1 -1
 		if [ "$count" -lt 10 ]; then
 			if [ "$p" != "0x100" ] && [ "$p" != "NOPAGE" ]; then
 				cleanup "$1"
 			fi
 		fi
 		count=$((count + 1))
-	done < <(trace-cmd report | awk '{ print $21 }')
+	done < <(trace-cmd report | awk '{ print $NF }')

replace above line w
done < <(trace-cmd report | grep dax_pmd_fault_done | awk '{ print $NF }')

Thanks for all of these Dan!

For this one, I ran into more metadata in the trace file, other than 'cpu=' causing the test to fail. I've tested what I'm showing above, which makes it immune to other things in the trace file.

Tell me you are OK w this and I'll apply this set to pending.

FYI the more metadata was:
version = 7
CPU 0 is empty
cpus=8

Quoted 6 lines
test/dax.sh +0 -0
 	if [ $count -lt 10 ]; then
 		cleanup "$1"
Signature · 1 line
2.49.0
#8 lore raw

Re: [ndctl PATCH 3/5] test: Fix dax.sh expectations

Quoted 35 lines · Alison Schofield
Quoted 17 lines · Dan Williams

With current kernel+tracecmd combinations stdout is no longer purely trace records and column "21" is no longer the vmfault_t result.

Drop, if present, the diagnostic print of how many CPUs are in the trace and use the more universally compatible assumption that the fault result is the last column rather than a specific column.

---
 test/dax.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
test/dax.sh +0 -0
index 3ffbc8079eba..98faaf0eb9b2 100755

test/dax.sh run_test() { · line 40

Quoted 4 lines
test/dax.sh +1 -0
@@ -37,13 +37,14 @@ run_test() {
 	rc=1
 	while read -r p; do
 		[[ $p ]] || continue
+		[[ $p == cpus=* ]] && continue

remove above line

test/dax.sh run_test() { · line 47

Quoted 8 lines
test/dax.sh +1 -1
 		if [ "$count" -lt 10 ]; then
 			if [ "$p" != "0x100" ] && [ "$p" != "NOPAGE" ]; then
 				cleanup "$1"
 			fi
 		fi
 		count=$((count + 1))
-	done < <(trace-cmd report | awk '{ print $21 }')
+	done < <(trace-cmd report | awk '{ print $NF }')

replace above line w
done < <(trace-cmd report | grep dax_pmd_fault_done | awk '{ print $NF }')

Quoted 7 lines

Thanks for all of these Dan!

For this one, I ran into more metadata in the trace file, other than 'cpu=' causing the test to fail. I've tested what I'm showing above, which makes it immune to other things in the trace file.

Tell me you are OK w this and I'll apply this set to pending.

Yup, looks good to me and is even more robust. Thanks for the fixups!

maintainer
#9 lore raw

Re: [ndctl PATCH 3/5] test: Fix dax.sh expectations

In reply to Alison Schofield
Quoted 23 lines · Alison Schofield
Quoted 20 lines · Dan Williams

With current kernel+tracecmd combinations stdout is no longer purely trace records and column "21" is no longer the vmfault_t result.

Drop, if present, the diagnostic print of how many CPUs are in the trace and use the more universally compatible assumption that the fault result is the last column rather than a specific column.

---
 test/dax.sh | 3 ++-

 1 file changed, 2 insertions(+), 1 deletion(-)
test/dax.sh +0 -0
index 3ffbc8079eba..98faaf0eb9b2 100755
@@ -37,13 +37,14 @@ run_test() {

  rc=1
  while read -r p; do
  [[ $p ]] || continue

test/dax.sh run_test() { · line 40

Quoted 1 line
test/dax.sh +1 -0
+		[[ $p == cpus=* ]] && continue

remove above line

Quoted 10 lines

test/dax.sh run_test() { · line 47

Quoted 8 lines

  if [ "$count" -lt 10 ]; then
  if [ "$p" != "0x100" ] && [ "$p" != "NOPAGE" ]; then cleanup "$1"
  fi
  fi
  count=$((count + 1))

test/dax.sh +1 -1
-	done < <(trace-cmd report | awk '{ print $21 }')
+	done < <(trace-cmd report | awk '{ print $NF }')

replace above line w
done < <(trace-cmd report | grep dax_pmd_fault_done | awk '{ print $NF }')

Very minor nit, but since you're already using awk, no need to grep first, instead you can use awk's 'first part' to do the filtering -

done < <(trace-cmd report | awk '/dax_pmd_fault_done/{ print $NF }')

You can stick any regex between the /../ and it will only act on lines matching that.

maintainer
#10 lore raw

Re: [ndctl PATCH 3/5] test: Fix dax.sh expectations

Quoted 35 lines · Vishal Verma
Quoted 23 lines · Alison Schofield
Quoted 20 lines · Dan Williams

With current kernel+tracecmd combinations stdout is no longer purely trace records and column "21" is no longer the vmfault_t result.

Drop, if present, the diagnostic print of how many CPUs are in the trace and use the more universally compatible assumption that the fault result is the last column rather than a specific column.

---
 test/dax.sh | 3 ++-

 1 file changed, 2 insertions(+), 1 deletion(-)
test/dax.sh +0 -0
index 3ffbc8079eba..98faaf0eb9b2 100755
@@ -37,13 +37,14 @@ run_test() {

  rc=1
  while read -r p; do
  [[ $p ]] || continue

test/dax.sh run_test() { · line 40

Quoted 1 line
test/dax.sh +1 -0
+		[[ $p == cpus=* ]] && continue

remove above line

Quoted 10 lines

test/dax.sh run_test() { · line 47

Quoted 8 lines

  if [ "$count" -lt 10 ]; then
  if [ "$p" != "0x100" ] && [ "$p" != "NOPAGE" ]; then cleanup "$1"
  fi
  fi
  count=$((count + 1))

test/dax.sh +1 -1
-	done < <(trace-cmd report | awk '{ print $21 }')
+	done < <(trace-cmd report | awk '{ print $NF }')

replace above line w
done < <(trace-cmd report | grep dax_pmd_fault_done | awk '{ print $NF }')

Quoted 7 lines

Very minor nit, but since you're already using awk, no need to grep first, instead you can use awk's 'first part' to do the filtering -

done < <(trace-cmd report | awk '/dax_pmd_fault_done/{ print $NF }')

You can stick any regex between the /../ and it will only act on lines matching that.

Thanks Vishal! I hope to remember that for 'next time' I see grep and awk used together. Not rev'ing this one.

#11 lore raw

PATCH 4/5 test: Update documentation with required packages to install

In reply to Dan Williams

After recently needing to manually rebuild a test environment I discovered the dependencies that need to be installed. Add a section to the README for package dependencies.

---
 README.md | 5 +++++
 1 file changed, 5 insertions(+)
README.md +5 -0
index ac24eeb28b6b..1943fd66d432 100644
@@ -85,6 +85,11 @@ loaded.  To build and install nfit_test.ko:
    CONFIG_TRANSPARENT_HUGEPAGE=y
    ```
 
+1. Install the following packages, (Fedora instructions):
+   ```
+   dnf install e2fsprogs xfsprogs parted jq trace-cmd hostname fio fio-engine-dev-dax
+   ```
+
 1. Build and install the unit test enabled libnvdimm modules in the
    following order.  The unit test modules need to be in place prior to
    the `depmod` that runs during the final `modules_install`  
Signature · 1 line
2.49.0
maintainer Reviewed-by on v1 4/5
#12 lore raw

Re: [ndctl PATCH 4/5] test: Update documentation with required packages to install

Quoted 5 lines · Dan Williams

After recently needing to manually rebuild a test environment I discovered the dependencies that need to be installed. Add a section to the README for package dependencies.

Quoted 20 lines
---
 README.md | 5 +++++
 1 file changed, 5 insertions(+)
README.md +5 -0
index ac24eeb28b6b..1943fd66d432 100644
@@ -85,6 +85,11 @@ loaded.  To build and install nfit_test.ko:
    CONFIG_TRANSPARENT_HUGEPAGE=y
    ```
 
+1. Install the following packages, (Fedora instructions):
+   ```
+   dnf install e2fsprogs xfsprogs parted jq trace-cmd hostname fio fio-engine-dev-dax
+   ```
+
 1. Build and install the unit test enabled libnvdimm modules in the
    following order.  The unit test modules need to be in place prior to
    the `depmod` that runs during the final `modules_install`  
#13 lore raw

PATCH 5/5 test: Fixup fwctl dependency

In reply to Dan Williams

Ensure the 'fwctl' test binary is always built for test runs.

Fixes e461c7e2da63 ("test/cxl-features.sh: add test for CXL features device")
---
 test/meson.build | 1 +
 1 file changed, 1 insertion(+)
test/meson.build +1 -0
index 91eb6c2b1363..775542c1b787 100644
@@ -275,6 +275,7 @@ foreach t : tests
       dax_errors,
       daxdev_errors,
       dax_dev,
+      fwctl,
       mmap,
     ],
     suite: t[2],
Signature · 1 line
2.49.0
maintainer Reviewed-by on v1 5/5
#14 lore raw

Re: [ndctl PATCH 5/5] test: Fixup fwctl dependency

Quoted 4 lines · Dan Williams

Ensure the 'fwctl' test binary is always built for test runs.

Fixes e461c7e2da63 ("test/cxl-features.sh: add test for CXL features device")

thanks for the fix

Quoted 16 lines
---
 test/meson.build | 1 +
 1 file changed, 1 insertion(+)
test/meson.build +1 -0
index 91eb6c2b1363..775542c1b787 100644
@@ -275,6 +275,7 @@ foreach t : tests
       dax_errors,
       daxdev_errors,
       dax_dev,
+      fwctl,
       mmap,
     ],
     suite: t[2],
maintainer
#15 lore raw
In reply to Dan Williams
Quoted 5 lines · Dan Williams

Recently I stood up a new test system from scratch and discovered some gaps in the documentation and the tests.

Fix those up to get all tests passing with v6.16-rc2 and latest version of all test dependencies currently available in Fedora Rawhide.

Thanks and applied to pending at: https://github.com/pmem/ndctl/

[ commit msg updates and the mentioned dax.sh awk change ]

Quoted 21 lines

Dan Williams (5):
build: Fix meson feature deprecation warnings
test: Fix 'ndctl' dependency in test/sub-section.sh
test: Fix dax.sh expectations
test: Update documentation with required packages to install
test: Fixup fwctl dependency

 README.md           | 5 +++++
 contrib/meson.build | 2 +-
 meson.build         | 5 +++--
 test/dax.sh         | 3 ++-
 test/meson.build    | 1 +
 test/sub-section.sh | 2 +-
 6 files changed, 13 insertions(+), 5 deletions(-)

base-commit: 74b9e411bf13e87df39a517d10143fafa7e2ea92

Signature · 1 line
2.49.0