Skip to contentSkip to conversation

xarray: port tests to kunit

PATCH Applied Tamir Duberstein 7 participants 22 messages Dec 5, 2024 – Jan 31, 2025

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

PATCH 1/1 xarray: port tests to kunit

Minimally rewrite the XArray unit tests to use kunit. This integrates nicely with existing kunit tools which produce nicer human-readable output compared to the existing machinery.

Running the xarray tests before this change requires an obscure invocation

```
tools/testing/kunit/kunit.py run --arch arm64 --make_options LLVM=1 \
  --kconfig_add CONFIG_TEST_XARRAY=y --raw_output=all nothing
```

which on failure produces

```
BUG at check_reserve:513
...
XArray: 6782340 of 6782364 tests passed
```

and exits 0.

Running the xarray tests after this change requires a simpler invocation

```
tools/testing/kunit/kunit.py run --arch arm64 --make_options LLVM=1 \
  xarray
```

which on failure produces (colors omitted)

```
[09:50:53] ====================== check_reserve  ======================
[09:50:53] [FAILED] param-0
[09:50:53]     # check_reserve: EXPECTATION FAILED at lib/test_xarray.c:536
[09:50:53] xa_erase(xa, 12345678) != NULL
...
[09:50:53]     # module: test_xarray
[09:50:53] # xarray: pass:26 fail:3 skip:0 total:29
[09:50:53] # Totals: pass:28 fail:3 skip:0 total:31
[09:50:53] ===================== [FAILED] xarray ======================
```

and exits 1.

Use of richer kunit assertions is intentionally omitted to reduce the scope of the change.

---
 arch/m68k/configs/amiga_defconfig    |   1 -
 arch/m68k/configs/apollo_defconfig   |   1 -
 arch/m68k/configs/atari_defconfig    |   1 -
 arch/m68k/configs/bvme6000_defconfig |   1 -
 arch/m68k/configs/hp300_defconfig    |   1 -
 arch/m68k/configs/mac_defconfig      |   1 -
 arch/m68k/configs/multi_defconfig    |   1 -
 arch/m68k/configs/mvme147_defconfig  |   1 -
 arch/m68k/configs/mvme16x_defconfig  |   1 -
 arch/m68k/configs/q40_defconfig      |   1 -
 arch/m68k/configs/sun3_defconfig     |   1 -
 arch/m68k/configs/sun3x_defconfig    |   1 -
 arch/powerpc/configs/ppc64_defconfig |   1 -
 lib/Kconfig.debug                    |  18 +-
 lib/Makefile                         |   2 +-
 lib/test_xarray.c                    | 669 ++++++++++++++++++++---------------
 16 files changed, 409 insertions(+), 293 deletions(-)
arch/m68k/configs/amiga_defconfig +0 -1
index c705247e7b5b3d67a9e0c2152f479a208d1acd44..581f0080814e92289610463f86abd9b38dab3d3f 100644
@@ -629,7 +629,6 @@ CONFIG_TEST_PRINTF=m
 CONFIG_TEST_SCANF=m
 CONFIG_TEST_BITMAP=m
 CONFIG_TEST_UUID=m
-CONFIG_TEST_XARRAY=m
 CONFIG_TEST_MAPLE_TREE=m
 CONFIG_TEST_RHASHTABLE=m
 CONFIG_TEST_IDA=m
arch/m68k/configs/apollo_defconfig +0 -1
index 6d62b9187a58afc079cbefe126d0e2230bbc887c..25628a1e8fa1ccbc8d44398caf4d303fedf50807 100644
@@ -586,7 +586,6 @@ CONFIG_TEST_PRINTF=m
 CONFIG_TEST_SCANF=m
 CONFIG_TEST_BITMAP=m
 CONFIG_TEST_UUID=m
-CONFIG_TEST_XARRAY=m
 CONFIG_TEST_MAPLE_TREE=m
 CONFIG_TEST_RHASHTABLE=m
 CONFIG_TEST_IDA=m
arch/m68k/configs/atari_defconfig +0 -1
index c3c644df852d280139828fce66e55f61eadbeca6..503a9ea526b56ae755b6e74dc02e37177a1a3886 100644
@@ -606,7 +606,6 @@ CONFIG_TEST_PRINTF=m
 CONFIG_TEST_SCANF=m
 CONFIG_TEST_BITMAP=m
 CONFIG_TEST_UUID=m
-CONFIG_TEST_XARRAY=m
 CONFIG_TEST_MAPLE_TREE=m
 CONFIG_TEST_RHASHTABLE=m
 CONFIG_TEST_IDA=m
arch/m68k/configs/bvme6000_defconfig +0 -1
index 20261f8196918f0315fd29c82c97da0d581a4100..3358349898eff72b250a410940495fb55b597dfa 100644
@@ -578,7 +578,6 @@ CONFIG_TEST_PRINTF=m
 CONFIG_TEST_SCANF=m
 CONFIG_TEST_BITMAP=m
 CONFIG_TEST_UUID=m
-CONFIG_TEST_XARRAY=m
 CONFIG_TEST_MAPLE_TREE=m
 CONFIG_TEST_RHASHTABLE=m
 CONFIG_TEST_IDA=m
arch/m68k/configs/hp300_defconfig +0 -1
index ce4fe93a0f701958b5ec79c5d24e9e004e21f076..a5e933a7fdf9dfe16d8943032cf5da062c4c67d0 100644
@@ -588,7 +588,6 @@ CONFIG_TEST_PRINTF=m
 CONFIG_TEST_SCANF=m
 CONFIG_TEST_BITMAP=m
 CONFIG_TEST_UUID=m
-CONFIG_TEST_XARRAY=m
 CONFIG_TEST_MAPLE_TREE=m
 CONFIG_TEST_RHASHTABLE=m
 CONFIG_TEST_IDA=m
arch/m68k/configs/mac_defconfig +0 -1
index 040ae75f47c3957f2e5c93e19ef397fc23e3dfbd..a90676c04da6d03700a8273b16d22d65630633a7 100644
@@ -605,7 +605,6 @@ CONFIG_TEST_PRINTF=m
 CONFIG_TEST_SCANF=m
 CONFIG_TEST_BITMAP=m
 CONFIG_TEST_UUID=m
-CONFIG_TEST_XARRAY=m
 CONFIG_TEST_MAPLE_TREE=m
 CONFIG_TEST_RHASHTABLE=m
 CONFIG_TEST_IDA=m
arch/m68k/configs/multi_defconfig +0 -1
index 20d877cb4e308b10e48bfd872c45af795feed098..f28f7783b090e79ed6840df8e052fe43308d1302 100644
@@ -692,7 +692,6 @@ CONFIG_TEST_PRINTF=m
 CONFIG_TEST_SCANF=m
 CONFIG_TEST_BITMAP=m
 CONFIG_TEST_UUID=m
-CONFIG_TEST_XARRAY=m
 CONFIG_TEST_MAPLE_TREE=m
 CONFIG_TEST_RHASHTABLE=m
 CONFIG_TEST_IDA=m
arch/m68k/configs/mvme147_defconfig +0 -1
index 5e1c8d0d3da57de9397220b9544e0f883c4c2c30..61308c2cd96cfbf035b47ca7ac3d9366c61e1740 100644
@@ -578,7 +578,6 @@ CONFIG_TEST_PRINTF=m
 CONFIG_TEST_SCANF=m
 CONFIG_TEST_BITMAP=m
 CONFIG_TEST_UUID=m
-CONFIG_TEST_XARRAY=m
 CONFIG_TEST_MAPLE_TREE=m
 CONFIG_TEST_RHASHTABLE=m
 CONFIG_TEST_IDA=m
arch/m68k/configs/mvme16x_defconfig +0 -1
index 5d1409e6a13773b43236ebe6d9a442348ac624a6..9ec8eb9ea6147c22dbeba8c90ea211404ed2dfc8 100644
@@ -579,7 +579,6 @@ CONFIG_TEST_PRINTF=m
 CONFIG_TEST_SCANF=m
 CONFIG_TEST_BITMAP=m
 CONFIG_TEST_UUID=m
-CONFIG_TEST_XARRAY=m
 CONFIG_TEST_MAPLE_TREE=m
 CONFIG_TEST_RHASHTABLE=m
 CONFIG_TEST_IDA=m
arch/m68k/configs/q40_defconfig +0 -1
index e4c30e2b9bbb8753a2fec9422ab5770ecd38d8bc..5fd094391b9ecf3a7dd73f49432f8e64856f1887 100644
@@ -595,7 +595,6 @@ CONFIG_TEST_PRINTF=m
 CONFIG_TEST_SCANF=m
 CONFIG_TEST_BITMAP=m
 CONFIG_TEST_UUID=m
-CONFIG_TEST_XARRAY=m
 CONFIG_TEST_MAPLE_TREE=m
 CONFIG_TEST_RHASHTABLE=m
 CONFIG_TEST_IDA=m
arch/m68k/configs/sun3_defconfig +0 -1
index 980843a9ea1eeda6d1d692e5772d5ad62adbeeec..5e9c9d704c2ee8df7e9fe1d73fcaef3f0ae2aa37 100644
@@ -575,7 +575,6 @@ CONFIG_TEST_PRINTF=m
 CONFIG_TEST_SCANF=m
 CONFIG_TEST_BITMAP=m
 CONFIG_TEST_UUID=m
-CONFIG_TEST_XARRAY=m
 CONFIG_TEST_MAPLE_TREE=m
 CONFIG_TEST_RHASHTABLE=m
 CONFIG_TEST_IDA=m
arch/m68k/configs/sun3x_defconfig +0 -1
index 38681cc6b598c5b433f04998d9af58ec6c2c58f2..b2f5f398fe42ae150049424e26f988cffa33062f 100644
@@ -576,7 +576,6 @@ CONFIG_TEST_PRINTF=m
 CONFIG_TEST_SCANF=m
 CONFIG_TEST_BITMAP=m
 CONFIG_TEST_UUID=m
-CONFIG_TEST_XARRAY=m
 CONFIG_TEST_MAPLE_TREE=m
 CONFIG_TEST_RHASHTABLE=m
 CONFIG_TEST_IDA=m
arch/powerpc/configs/ppc64_defconfig +0 -1
index f39c0d000c4386dc77fe36965e38a96f5f11daac..bc48063fd860627fdf24ee8dbe18cdedcec79078 100644
@@ -451,7 +451,6 @@ CONFIG_TEST_PRINTF=m
 CONFIG_TEST_SCANF=m
 CONFIG_TEST_BITMAP=m
 CONFIG_TEST_UUID=m
-CONFIG_TEST_XARRAY=m
 CONFIG_TEST_MAPLE_TREE=m
 CONFIG_TEST_RHASHTABLE=m
 CONFIG_TEST_IDA=m
lib/Kconfig.debug +16 -2
index e968f083d356a53a87aa73d08caeb8471ea3603a..b53f5da22e4053dee79860c9a10d8dd26a7080d6 100644
@@ -2456,8 +2456,22 @@ config TEST_BITMAP
 config TEST_UUID
 	tristate "Test functions located in the uuid module at runtime"
 
-config TEST_XARRAY
-	tristate "Test the XArray code at runtime"
+config XARRAY_KUNIT
+	tristate "KUnit test XArray code at runtime" if !KUNIT_ALL_TESTS
+	depends on KUNIT
+	default KUNIT_ALL_TESTS
+	help
+	  Enable this option to test the Xarray code at boot.
+
+	  KUnit tests run during boot and output the results to the debug log
+	  in TAP format (http://testanything.org/). Only useful for kernel devs
+	  running the KUnit test harness, and not intended for inclusion into a
+	  production build.
+
+	  For more information on KUnit and unit tests in general please refer
+	  to the KUnit documentation in Documentation/dev-tools/kunit/.
+
+	  If unsure, say N.
 
 config TEST_MAPLE_TREE
 	tristate "Test the Maple Tree code at runtime or module load"
lib/Makefile +1 -1
index a8155c972f02856fcc61ee949ddda436cfe211ff..c0458ff841fe8feff840c77bb652adb2aae48678 100644
@@ -94,7 +94,6 @@ GCOV_PROFILE_test_bitmap.o := n
 endif
 
 obj-$(CONFIG_TEST_UUID) += test_uuid.o
-obj-$(CONFIG_TEST_XARRAY) += test_xarray.o
 obj-$(CONFIG_TEST_MAPLE_TREE) += test_maple_tree.o
 obj-$(CONFIG_TEST_PARMAN) += test_parman.o
 obj-$(CONFIG_TEST_KMOD) += test_kmod.o
@@ -375,6 +374,7 @@ CFLAGS_bitfield_kunit.o := $(DISABLE_STRUCTLEAK_PLUGIN)
 obj-$(CONFIG_BITFIELD_KUNIT) += bitfield_kunit.o
 obj-$(CONFIG_CHECKSUM_KUNIT) += checksum_kunit.o
 obj-$(CONFIG_UTIL_MACROS_KUNIT) += util_macros_kunit.o
+obj-$(CONFIG_XARRAY_KUNIT) += test_xarray.o
 obj-$(CONFIG_LIST_KUNIT_TEST) += list-test.o
 obj-$(CONFIG_HASHTABLE_KUNIT_TEST) += hashtable_test.o
 obj-$(CONFIG_LINEAR_RANGES_TEST) += test_linear_ranges.o
lib/test_xarray.c +392 -277

1,439 lines not on this page · raw message

---
base-commit: ac0019f46558a127f874d0c602686af7ae498773
change-id: 20241204-xarray-kunit-port-87e6161bc1ab

Best regards,

Signature · 1 line
Tamir Duberstein <[email protected]>
#1 lore raw

+ Liam, Matthew

Hello,

I believe this patch needs to be reverted for now as it breaks the user-space build of /tools/testing/radix-tree with:

In file included from xarray.c:11:
../../../lib/test_xarray.c:9:10: fatal error: kunit/test.h: No such file or directory

     9 | #include <kunit/test.h>
       |          ^~~~~~~~~~~~~~

compilation terminated.
make: *** [<builtin>: xarray.o] Error 1
make: *** Waiting for unfinished jobs....

this then prevents the maple tree test suite from building.

Thanks,
Sid

#2 lore raw
Quoted 1 line · Sidhartha Kumar

+ Liam, Matthew

+ linux-mm

Thank you Sid.

Quoted 9 lines

Hello,

I believe this patch needs to be reverted for now as it breaks the user-space build of /tools/testing/radix-tree with:

In file included from xarray.c:11:
../../../lib/test_xarray.c:9:10: fatal error: kunit/test.h: No such file or directory

Quoted 7 lines
     9 | #include <kunit/test.h>
       |          ^~~~~~~~~~~~~~

compilation terminated.
make: *** [<builtin>: xarray.o] Error 1
make: *** Waiting for unfinished jobs....

this then prevents the maple tree test suite from building.

How are grammar corrections going to the right person (but not the mailing list) while an entire conversion to kunit is not [1]?

Does the patch really need to drop the module testing too?

What exactly is the point of converting one testing system to another besides disruption of actual work? Who asked for this? What is the point?

Is anyone doing work on the xarray running the kunit tests?

This should be reverted as it should never have been merged.

Regards,
Liam

[1]. https://lore.kernel.org/all/[email protected]/

#3 lore raw
Quoted 23 lines · Liam R. Howlett
Quoted 1 line · Sidhartha Kumar

+ Liam, Matthew

+ linux-mm

Thank you Sid.

Quoted 15 lines

Hello,

I believe this patch needs to be reverted for now as it breaks the user-space build of /tools/testing/radix-tree with:

In file included from xarray.c:11:
../../../lib/test_xarray.c:9:10: fatal error: kunit/test.h: No such file or directory

     9 | #include <kunit/test.h>
       |          ^~~~~~~~~~~~~~

compilation terminated.
make: *** [<builtin>: xarray.o] Error 1
make: *** Waiting for unfinished jobs....

Quoted 4 lines
Quoted 1 line

this then prevents the maple tree test suite from building.

How are grammar corrections going to the right person (but not the mailing list) while an entire conversion to kunit is not [1]?

Very simple: the tests are not properly included in MAINTAINERS. I
sent https://lore.kernel.org/all/[email protected]/
a few minutes ago for this reason.

Quoted 5 lines

Does the patch really need to drop the module testing too?

What exactly is the point of converting one testing system to another besides disruption of actual work? Who asked for this? What is the point?

All this is described in the commit message.

Quoted 1 line

Is anyone doing work on the xarray running the kunit tests?

I was doing work on xarray and I was running the kunit tests.

Quoted 6 lines

This should be reverted as it should never have been merged.

Regards,
Liam

[1]. https://lore.kernel.org/all/[email protected]/

#4 lore raw
Quoted 24 lines · Tamir Duberstein
Quoted 23 lines · Liam R. Howlett
Quoted 1 line · Sidhartha Kumar

+ Liam, Matthew

+ linux-mm

Thank you Sid.

Quoted 15 lines

Hello,

I believe this patch needs to be reverted for now as it breaks the user-space build of /tools/testing/radix-tree with:

In file included from xarray.c:11:
../../../lib/test_xarray.c:9:10: fatal error: kunit/test.h: No such file or directory

     9 | #include <kunit/test.h>
       |          ^~~~~~~~~~~~~~

compilation terminated.
make: *** [<builtin>: xarray.o] Error 1
make: *** Waiting for unfinished jobs....

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

this then prevents the maple tree test suite from building.

How are grammar corrections going to the right person (but not the mailing list) while an entire conversion to kunit is not [1]?

Very simple: the tests are not properly included in MAINTAINERS. I
sent https://lore.kernel.org/all/[email protected]/
a few minutes ago for this reason.

Fair enough, but from the patch:

@@ -6,11 +6,10 @@
* Author: Matthew Wilcox <[email protected]>
*/

-#include <linux/xarray.h>
-#include <linux/module.h>
+#include <kunit/test.h>

...

-module_init(xarray_checks); -module_exit(xarray_exit);
MODULE_AUTHOR("Matthew Wilcox <[email protected]>"); MODULE_DESCRIPTION("XArray API test module"); MODULE_LICENSE("GPL");

I don't get why the huge list of Cc's didn't include the author who is in the git commit signers:

 $ ./scripts/get_maintainer.pl --git lib/xarray.c
Matthew Wilcox <[email protected]> (supporter:XARRAY,commit_signer:1/3=33%,authored:1/3=33%,added_lines:19/52=37%,removed_lines:4/23=17%)
Andrew Morton <[email protected]> (supporter:LIBRARY CODE,commit_signer:3/3=100%)
...
Quoted 8 lines
Quoted 6 lines

Does the patch really need to drop the module testing too?

What exactly is the point of converting one testing system to another besides disruption of actual work? Who asked for this? What is the point?

All this is described in the commit message.

The commit message says you like the output more and implies you like the command better.

I've never used the kunit testing of xarray and have used the userspace testing instead, so I can't speak to the obscure invocation as both commands seem insanely long and obscure to me.

Quoted 4 lines
Quoted 2 lines

Is anyone doing work on the xarray running the kunit tests?

I was doing work on xarray and I was running the kunit tests.

...

You should look at the userspace testing (that this broke) as it has been really useful in certain scenarios.

Thanks,
Liam

#5 lore raw
Quoted 54 lines · Liam R. Howlett
Quoted 24 lines · Tamir Duberstein
Quoted 23 lines · Liam R. Howlett
Quoted 1 line · Sidhartha Kumar

+ Liam, Matthew

+ linux-mm

Thank you Sid.

Quoted 15 lines

Hello,

I believe this patch needs to be reverted for now as it breaks the user-space build of /tools/testing/radix-tree with:

In file included from xarray.c:11:
../../../lib/test_xarray.c:9:10: fatal error: kunit/test.h: No such file or directory

     9 | #include <kunit/test.h>
       |          ^~~~~~~~~~~~~~

compilation terminated.
make: *** [<builtin>: xarray.o] Error 1
make: *** Waiting for unfinished jobs....

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

this then prevents the maple tree test suite from building.

How are grammar corrections going to the right person (but not the mailing list) while an entire conversion to kunit is not [1]?

Very simple: the tests are not properly included in MAINTAINERS. I
sent https://lore.kernel.org/all/[email protected]/
a few minutes ago for this reason.

Fair enough, but from the patch:

lib/test_xarray.c +1 -4
@@ -6,11 +6,10 @@
  * Author: Matthew Wilcox <[email protected]>
  */
 
-#include <linux/xarray.h>
-#include <linux/module.h>
+#include <kunit/test.h>
 
...
 
 
-module_init(xarray_checks);
-module_exit(xarray_exit);
 MODULE_AUTHOR("Matthew Wilcox <[email protected]>");
 MODULE_DESCRIPTION("XArray API test module");
 MODULE_LICENSE("GPL");
Quoted 5 lines

I don't get why the huge list of Cc's didn't include the author who is in the git commit signers:

 $ ./scripts/get_maintainer.pl --git lib/xarray.c
Matthew Wilcox <[email protected]> (supporter:XARRAY,commit_signer:1/3=33%,authored:1/3=33%,added_lines:19/52=37%,removed_lines:4/23=17%)
Andrew Morton <[email protected]> (supporter:LIBRARY CODE,commit_signer:3/3=100%)

I'm not sure what you're asking. I used b4 prep --auto-to-cc. It doesn't know that test_xarray.c and xarray.c have the same maintainer.

Quoted 23 lines

...

Quoted 8 lines
Quoted 6 lines

Does the patch really need to drop the module testing too?

What exactly is the point of converting one testing system to another besides disruption of actual work? Who asked for this? What is the point?

All this is described in the commit message.

The commit message says you like the output more and implies you like the command better.

I've never used the kunit testing of xarray and have used the userspace testing instead, so I can't speak to the obscure invocation as both commands seem insanely long and obscure to me.

Quoted 4 lines
Quoted 2 lines

Is anyone doing work on the xarray running the kunit tests?

I was doing work on xarray and I was running the kunit tests.

Quoted 7 lines

...

You should look at the userspace testing (that this broke) as it has been really useful in certain scenarios.

Thanks,
Liam

For what it's worth the kunit invocation, while obscure, is self-documenting. There's usage information that's reasonably understandable embedded in the tool itself. I looked for the userspace testing initially but failed to find tools/testing/radix-tree/xarray.c. Even now, I'm not sure how I'm meant to compile this.

Tamir

maintainer
#6 lore raw
Quoted 6 lines · Tamir Duberstein
Quoted 3 lines
 $ ./scripts/get_maintainer.pl --git lib/xarray.c
Matthew Wilcox <[email protected]> (supporter:XARRAY,commit_signer:1/3=33%,authored:1/3=33%,added_lines:19/52=37%,removed_lines:4/23=17%)
Andrew Morton <[email protected]> (supporter:LIBRARY CODE,commit_signer:3/3=100%)

I'm not sure what you're asking. I used b4 prep --auto-to-cc. It doesn't know that test_xarray.c and xarray.c have the same maintainer.

You need to use your brain. You can't just say "I used the tool". Tools are just tools. Sometimes they're wrong. My email address is listed as the Author: of test_xarray.c. You should have noticed that.

Quoted 6 lines

For what it's worth the kunit invocation, while obscure, is self-documenting. There's usage information that's reasonably understandable embedded in the tool itself. I looked for the userspace testing initially but failed to find tools/testing/radix-tree/xarray.c. Even now, I'm not sure how I'm meant to compile this.

kunit is useless. The test_xarray.c module is useless. If you break xarray, the kernel won't boot far enough to load any modules. You haven't thought about this AT ALL.

cd tools/testing/radix-tree
make

Then you can run the tests, whichever ones make sense for you to run.

#7 lore raw
Quoted 6 lines · Matthew Wilcox
Quoted 4 lines · Tamir Duberstein
Quoted 3 lines
 $ ./scripts/get_maintainer.pl --git lib/xarray.c
Matthew Wilcox <[email protected]> (supporter:XARRAY,commit_signer:1/3=33%,authored:1/3=33%,added_lines:19/52=37%,removed_lines:4/23=17%)
Andrew Morton <[email protected]> (supporter:LIBRARY CODE,commit_signer:3/3=100%)
Quoted 6 lines
Quoted 2 lines

I'm not sure what you're asking. I used b4 prep --auto-to-cc. It doesn't know that test_xarray.c and xarray.c have the same maintainer.

You need to use your brain. You can't just say "I used the tool". Tools are just tools. Sometimes they're wrong. My email address is listed as the Author: of test_xarray.c. You should have noticed that.

The whole point of tools is to liberate stupid humans' brains like mine from mundane tasks like working out who to email. The tool wasn't wrong; it did exactly what you told it to do in your MAINTAINERS entry.

Quoted 10 lines
Quoted 6 lines

For what it's worth the kunit invocation, while obscure, is self-documenting. There's usage information that's reasonably understandable embedded in the tool itself. I looked for the userspace testing initially but failed to find tools/testing/radix-tree/xarray.c. Even now, I'm not sure how I'm meant to compile this.

kunit is useless. The test_xarray.c module is useless. If you break xarray, the kernel won't boot far enough to load any modules. You haven't thought about this AT ALL.

I don't understand what you're saying here.

Quoted 4 lines

cd tools/testing/radix-tree
make

Then you can run the tests, whichever ones make sense for you to run.

Thanks.

maintainer
#8 lore raw
Quoted 4 lines · Tamir Duberstein

The whole point of tools is to liberate stupid humans' brains like mine from mundane tasks like working out who to email. The tool wasn't wrong; it did exactly what you told it to do in your MAINTAINERS entry.

Tools do get things wrong. So do humans. When you take your hands off the steering wheel and the car crashes, it's still your fault.

Quoted 7 lines
Quoted 7 lines
Quoted 6 lines

For what it's worth the kunit invocation, while obscure, is self-documenting. There's usage information that's reasonably understandable embedded in the tool itself. I looked for the userspace testing initially but failed to find tools/testing/radix-tree/xarray.c. Even now, I'm not sure how I'm meant to compile this.

Quoted 5 lines
Quoted 3 lines

kunit is useless. The test_xarray.c module is useless. If you break xarray, the kernel won't boot far enough to load any modules. You haven't thought about this AT ALL.

I don't understand what you're saying here.

Then I don't want to see any more patches from you until you do.

#9 lore raw
Quoted 9 lines · Matthew Wilcox
Quoted 4 lines · Tamir Duberstein

The whole point of tools is to liberate stupid humans' brains like mine from mundane tasks like working out who to email. The tool wasn't wrong; it did exactly what you told it to do in your MAINTAINERS entry.

Tools do get things wrong. So do humans. When you take your hands off the steering wheel and the car crashes, it's still your fault.

Which one of us is driving in this analogy?

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines

For what it's worth the kunit invocation, while obscure, is self-documenting. There's usage information that's reasonably understandable embedded in the tool itself. I looked for the userspace testing initially but failed to find tools/testing/radix-tree/xarray.c. Even now, I'm not sure how I'm meant to compile this.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

kunit is useless. The test_xarray.c module is useless. If you break xarray, the kernel won't boot far enough to load any modules. You haven't thought about this AT ALL.

I don't understand what you're saying here.

Then I don't want to see any more patches from you until you do.

Yes, I see now. But it's not quite true; the patch was itself motivated by the difficult output of the tests, so I did run this with kunit in a state that produced a failure. Your point is taken.

#10 lore raw
In reply to Liam R. Howlett

Hi Liam,

Quoted 3 lines · Liam R. Howlett

I've never used the kunit testing of xarray and have used the userspace testing instead, so I can't speak to the obscure invocation as both commands seem insanely long and obscure to me.

The long and obscure command line is a red herring: a simple "modprobe test_xarray" is all it takes...

Quoted 2 lines

You should look at the userspace testing (that this broke) as it has been really useful in certain scenarios.

BTW, how do I even build tools/testing/radix-tree?
"make tools/help" doesn't show the radix-tree test.
"make tools/all" doesn't seem to try to build it.
Same for "make kselftest-all".
When trying the above, and ignoring failures due to missing packages on my host:
- there are several weird build errors,
- this doesn't play well with O=,
- lots of scary warnings when building for 32-bit,
- ...

At least the kunit tests build (and run[1] ;-) most of the time...

[1] test_xarray started failing on m68k recently
https://lore.kernel.org/all/CAMuHMdU_bfadUO=0OZ=AoQ9EAmQPA4wsLCBqohXR+QCeCKRn4A@mail.gmail.com/

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#11 lore raw
Quoted 9 lines · Geert Uytterhoeven

Hi Liam,

Quoted 3 lines · Liam R. Howlett

I've never used the kunit testing of xarray and have used the userspace testing instead, so I can't speak to the obscure invocation as both commands seem insanely long and obscure to me.

The long and obscure command line is a red herring: a simple "modprobe test_xarray" is all it takes...

That command worked before too...

Quoted 8 lines
Quoted 3 lines

You should look at the userspace testing (that this broke) as it has been really useful in certain scenarios.

BTW, how do I even build tools/testing/radix-tree? "make tools/help" doesn't show the radix-tree test. "make tools/all" doesn't seem to try to build it. Same for "make kselftest-all".

make

Or look at the make file and stop guessing. Considering how difficult it is to get m68k to build, you should probably know how to read a makefile.

Quoted 8 lines

When trying the above, and ignoring failures due to missing packages on my host:
- there are several weird build errors,
- this doesn't play well with O=,
- lots of scary warnings when building for 32-bit,
- ...

At least the kunit tests build (and run[1] ;-) most of the time...

Do they? How about you break something in xarray and then try to boot the kunit, or try to boot to load that module.

This exchange is a good argument against doing any kunit work on my tests.

Quoted 15 lines

[1] test_xarray started failing on m68k recently
https://lore.kernel.org/all/CAMuHMdU_bfadUO=0OZ=AoQ9EAmQPA4wsLCBqohXR+QCeCKRn4A@mail.gmail.com/

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#12 lore raw

Hi Liam,

Quoted 10 lines · Liam R. Howlett
Quoted 7 lines · Geert Uytterhoeven
Quoted 3 lines · Liam R. Howlett

I've never used the kunit testing of xarray and have used the userspace testing instead, so I can't speak to the obscure invocation as both commands seem insanely long and obscure to me.

The long and obscure command line is a red herring: a simple "modprobe test_xarray" is all it takes...

That command worked before too...

Exactly, great!

Quoted 9 lines
Quoted 7 lines
Quoted 2 lines

You should look at the userspace testing (that this broke) as it has been really useful in certain scenarios.

BTW, how do I even build tools/testing/radix-tree? "make tools/help" doesn't show the radix-tree test. "make tools/all" doesn't seem to try to build it. Same for "make kselftest-all".

make

Where?

Quoted 1 line

Or look at the make file and stop guessing. Considering how difficult

There is no Makefile referencing tools/testing/radix-tree or the radix-tree subdir. That's why I asked...

Oh, I am supposed to run make in tools/testing/radix-tree/? What a surprise!

Which is a pain when building in a separate output directory, as you cannot just do "make -C tools/testing/radix-tree" there, but have to type the full "make -C tools/testing/radix-tree O=..." (and optionally ARCH=... and CROSS_COMPILE=...; oh wait, these are ignored :-( in the source directory instead...

If these tests are not integrated into the normal build system (see also [1]), I am not so surprised the auto-builders don't build them, and breakages are introduced...

Quoted 2 lines

it is to get m68k to build, you should probably know how to read a makefile.

Like all other kernel cross-compilation? Usually you don't even have to know where your cross-compiler is living:

make ARCH=m68k

Quoted 11 lines
Quoted 8 lines

When trying the above, and ignoring failures due to missing packages on my host:
- there are several weird build errors,
- this doesn't play well with O=,
- lots of scary warnings when building for 32-bit,
- ...

At least the kunit tests build (and run[1] ;-) most of the time...

Do they? How about you break something in xarray and then try to boot the kunit, or try to boot to load that module.

If you break the kernel beyond the point of booting, you can indeed not run any test modules...

Which does _not_ mean the userspace tests are not useful, and that I approve breaking the userspace tests...

[1] https://lore.kernel.org/all/CAK7LNASdA+5_pdTjr1dY-cKGSDq804Huc_CX_8-Gg+ypFCmajQ@mail.gmail.com/

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#13 lore raw
Quoted 19 lines · Geert Uytterhoeven

Hi Liam,

Quoted 10 lines · Liam R. Howlett
Quoted 7 lines · Geert Uytterhoeven
Quoted 3 lines · Liam R. Howlett

I've never used the kunit testing of xarray and have used the userspace testing instead, so I can't speak to the obscure invocation as both commands seem insanely long and obscure to me.

The long and obscure command line is a red herring: a simple "modprobe test_xarray" is all it takes...

That command worked before too...

Exactly, great!

Quoted 3 lines
Quoted 3 lines
Quoted 2 lines

You should look at the userspace testing (that this broke) as it has been really useful in certain scenarios.

Quoted 9 lines
Quoted 6 lines
Quoted 4 lines

BTW, how do I even build tools/testing/radix-tree? "make tools/help" doesn't show the radix-tree test. "make tools/all" doesn't seem to try to build it. Same for "make kselftest-all".

make

Where?

Quoted 1 line
Quoted 1 line

BTW, how do I even build tools/testing/radix-tree?

                                ^^^^^^^^^^^^^^^^^^^^^^^
Quoted 6 lines
Quoted 2 lines

Or look at the make file and stop guessing. Considering how difficult

There is no Makefile referencing tools/testing/radix-tree or the radix-tree subdir. That's why I asked...

Quoted 8 lines

Oh, I am supposed to run make in tools/testing/radix-tree/? What a surprise!

Which is a pain when building in a separate output directory, as you cannot just do "make -C tools/testing/radix-tree" there, but have to type the full "make -C tools/testing/radix-tree O=..." (and optionally ARCH=... and CROSS_COMPILE=...; oh wait, these are ignored :-( in the source directory instead...

I'll await your patch to link all this together. Please Cc the authors.

Quoted 5 lines

If these tests are not integrated into the normal build system (see also [1]), I am not so surprised the auto-builders don't build them, and breakages are introduced...

Quoted 7 lines
Quoted 2 lines

it is to get m68k to build, you should probably know how to read a makefile.

Like all other kernel cross-compilation? Usually you don't even have to know where your cross-compiler is living:

make ARCH=m68k

Ignoring that I had to make a config - which asked challenging questions...

And ignoring the steps to get m68k compiler...

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

When trying the above, and ignoring failures due to missing packages on my host:
- there are several weird build errors,
- this doesn't play well with O=,
- lots of scary warnings when building for 32-bit,
- ...

In file included from ./include/linux/sched.h:12,

                 from arch/m68k/kernel/asm-offsets.c:15:
./arch/m68k/include/asm/current.h:7:30: error: invalid register name for ‘current’
    7 | register struct task_struct *current __asm__("%a2");
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

At least the kunit tests build (and run[1] ;-) most of the time...

Do they? How about you break something in xarray and then try to boot the kunit, or try to boot to load that module.

If you break the kernel beyond the point of booting, you can indeed not run any test modules...

Which is extremely easy when you are changing code that runs so early in the boot.

My code found a compiler issue because it's the first function that returns a boolean. This is stupid.

Quoted 3 lines

Which does _not_ mean the userspace tests are not useful, and that I approve breaking the userspace tests...

Perfect, let's revert the patch then.

This is such a waste of time.

#17 lore raw
In reply to Geert Uytterhoeven

Geert,

Having written a ton of test code, I've unfortunately encountered a lot of this sort of push-back and it's HUGELY off-putting. Writing test code should be ENCOURAGED not litigated against.

The truth is far too little kernel code is tested to any degree, and this is part of why.

On kunit collaboration, I attended an in-person talk at LPC on kunit userland testing where it was broadly agreed that at this point in time, the xarray/radix tree tests weren't really suited to the framework.

Therefore I think the healthy means of pushing forward with integration is in sensible discussion and if patches, RFC patches in collaboration with authors.

The unhealthy approach is to needle one of the biggest contributors to core test code in the kernel on a thread because you don't seem to want to cd to a directory and run make.

Why is this relevant to me? I am the author of the VMA test suite, on which I spent countless hours + relied heavily on Liam's work to do so, and equally there you have to cd to a directory and run make.

But at the same time in both cases, testability of key internal components is ENORMOUSLY improved and allows for REALLY exciting possibilities in test coverage, really isolating functions for unit testing, enormously fast iteration speed, etc. etc.

I ask you to weigh up the desire to enumerate your misgivings about the testing approach used here vs. all of the above.

I would respectfully suggest that here is neither the time nor the place for splitting hairs.

Thanks, Lorenzo

Quoted 84 lines · Geert Uytterhoeven

Hi Liam,

Quoted 10 lines · Liam R. Howlett
Quoted 7 lines · Geert Uytterhoeven
Quoted 3 lines · Liam R. Howlett

I've never used the kunit testing of xarray and have used the userspace testing instead, so I can't speak to the obscure invocation as both commands seem insanely long and obscure to me.

The long and obscure command line is a red herring: a simple "modprobe test_xarray" is all it takes...

That command worked before too...

Exactly, great!

Quoted 9 lines
Quoted 7 lines
Quoted 2 lines

You should look at the userspace testing (that this broke) as it has been really useful in certain scenarios.

BTW, how do I even build tools/testing/radix-tree? "make tools/help" doesn't show the radix-tree test. "make tools/all" doesn't seem to try to build it. Same for "make kselftest-all".

make

Where?

Quoted 1 line

Or look at the make file and stop guessing. Considering how difficult

There is no Makefile referencing tools/testing/radix-tree or the radix-tree subdir. That's why I asked...

Oh, I am supposed to run make in tools/testing/radix-tree/? What a surprise!

Which is a pain when building in a separate output directory, as you cannot just do "make -C tools/testing/radix-tree" there, but have to type the full "make -C tools/testing/radix-tree O=..." (and optionally ARCH=... and CROSS_COMPILE=...; oh wait, these are ignored :-( in the source directory instead...

If these tests are not integrated into the normal build system (see also [1]), I am not so surprised the auto-builders don't build them, and breakages are introduced...

Quoted 2 lines

it is to get m68k to build, you should probably know how to read a makefile.

Like all other kernel cross-compilation? Usually you don't even have to know where your cross-compiler is living:

make ARCH=m68k

Quoted 11 lines
Quoted 8 lines

When trying the above, and ignoring failures due to missing packages on my host:
- there are several weird build errors,
- this doesn't play well with O=,
- lots of scary warnings when building for 32-bit,
- ...

At least the kunit tests build (and run[1] ;-) most of the time...

Do they? How about you break something in xarray and then try to boot the kunit, or try to boot to load that module.

If you break the kernel beyond the point of booting, you can indeed not run any test modules...

Which does _not_ mean the userspace tests are not useful, and that I approve breaking the userspace tests...

[1] https://lore.kernel.org/all/CAK7LNASdA+5_pdTjr1dY-cKGSDq804Huc_CX_8-Gg+ypFCmajQ@mail.gmail.com/

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

maintainer
#20 lore raw
In reply to Geert Uytterhoeven
Quoted 2 lines · Geert Uytterhoeven

The long and obscure command line is a red herring: a simple "modprobe test_xarray" is all it takes...

That's all I've ever done. I'm confused/annoyed by all this "let's wrap everything up in some complex and obscure new thing" practice.

Quoted 7 lines
Quoted 2 lines

You should look at the userspace testing (that this broke) as it has been really useful in certain scenarios.

BTW, how do I even build tools/testing/radix-tree? "make tools/help" doesn't show the radix-tree test. "make tools/all" doesn't seem to try to build it. Same for "make kselftest-all".

I've never heard of any of those things. So I didn't try to make any of them work.

Quoted 6 lines

When trying the above, and ignoring failures due to missing packages on my host:
- there are several weird build errors,
- this doesn't play well with O=,
- lots of scary warnings when building for 32-bit,
- ...

Really? Turns out I haven't built for 32-bit on this laptop, so I'm installing all the packages I need now. I seem to reemember it being painful due to liburcu packaging not allowing me to install both a 32-bit and 64-bit package at the same time.

Quoted 1 line

At least the kunit tests build (and run[1] ;-) most of the time...

That's unworthy. kunit isn't trying to do anything nearly as hard as the radix tree tests are.

Quoted 2 lines

[1] test_xarray started failing on m68k recently
https://lore.kernel.org/all/CAMuHMdU_bfadUO=0OZ=AoQ9EAmQPA4wsLCBqohXR+QCeCKRn4A@mail.gmail.com/

I really wish Andrew would stop merging xarray patches.

#14 lore raw
In reply to Liam R. Howlett

Hi Liam,

Quoted 23 lines · Liam R. Howlett
Quoted 22 lines · Geert Uytterhoeven
Quoted 10 lines · Liam R. Howlett
Quoted 7 lines · Geert Uytterhoeven
Quoted 3 lines · Liam R. Howlett

I've never used the kunit testing of xarray and have used the userspace testing instead, so I can't speak to the obscure invocation as both commands seem insanely long and obscure to me.

The long and obscure command line is a red herring: a simple "modprobe test_xarray" is all it takes...

That command worked before too...

Exactly, great!

Quoted 8 lines
Quoted 7 lines
Quoted 2 lines

You should look at the userspace testing (that this broke) as it has been really useful in certain scenarios.

BTW, how do I even build tools/testing/radix-tree? "make tools/help" doesn't show the radix-tree test. "make tools/all" doesn't seem to try to build it. Same for "make kselftest-all".

Quoted 5 lines
Quoted 4 lines
Quoted 1 line

make

Where?

Quoted 1 line
Quoted 1 line

BTW, how do I even build tools/testing/radix-tree?

                                ^^^^^^^^^^^^^^^^^^^^^^^

Things like "make -C drivers/net/ethernet/" stopped working ca. 20y ago.

Quoted 8 lines
Quoted 8 lines
Quoted 1 line

Or look at the make file and stop guessing. Considering how difficult

There is no Makefile referencing tools/testing/radix-tree or the radix-tree subdir. That's why I asked...

Oh, I am supposed to run make in tools/testing/radix-tree/? What a surprise!

Quoted 7 lines
Quoted 5 lines

Which is a pain when building in a separate output directory, as you cannot just do "make -C tools/testing/radix-tree" there, but have to type the full "make -C tools/testing/radix-tree O=..." (and optionally ARCH=... and CROSS_COMPILE=...; oh wait, these are ignored :-( in the source directory instead...

I'll await your patch to link all this together. Please Cc the authors.

I gave it a try for kselftests a few years ago.
https://lore.kernel.org/all/[email protected]
Unfortunately only one patch was applied...

Quoted 10 lines
Quoted 7 lines
Quoted 2 lines

it is to get m68k to build, you should probably know how to read a makefile.

Like all other kernel cross-compilation? Usually you don't even have to know where your cross-compiler is living:

make ARCH=m68k

Ignoring that I had to make a config - which asked challenging questions...

make ARCH=m68k defconfig

Quoted 1 line

And ignoring the steps to get m68k compiler...

apt install gcc-m68k-linux-gnu?

Quoted 8 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

When trying the above, and ignoring failures due to missing packages on my host:
- there are several weird build errors,
- this doesn't play well with O=,
- lots of scary warnings when building for 32-bit,
- ...

Quoted 4 lines

In file included from ./include/linux/sched.h:12,

                 from arch/m68k/kernel/asm-offsets.c:15:
./arch/m68k/include/asm/current.h:7:30: error: invalid register name for ‘current’
    7 | register struct task_struct *current __asm__("%a2");

Which compiler are you using?

Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Quoted 1 line

At least the kunit tests build (and run[1] ;-) most of the time...

Do they? How about you break something in xarray and then try to boot the kunit, or try to boot to load that module.

Quoted 8 lines
Quoted 2 lines

If you break the kernel beyond the point of booting, you can indeed not run any test modules...

Which is extremely easy when you are changing code that runs so early in the boot.

My code found a compiler issue because it's the first function that returns a boolean. This is stupid.

Sorry. I don't understand this comment.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
#18 lore raw
In reply to Lorenzo Stoakes

Hi Lorenzo,

Quoted 3 lines · Lorenzo Stoakes

Having written a ton of test code, I've unfortunately encountered a lot of this sort of push-back and it's HUGELY off-putting. Writing test code should be ENCOURAGED not litigated against.

I am not discouraging nor pushing back on any testing code (on the contrary, I test every single new kunit test that appears upstream). My apologies if I gave the impression.

Quoted 10 lines

The truth is far too little kernel code is tested to any degree, and this is part of why.

On kunit collaboration, I attended an in-person talk at LPC on kunit userland testing where it was broadly agreed that at this point in time, the xarray/radix tree tests weren't really suited to the framework.

Therefore I think the healthy means of pushing forward with integration is in sensible discussion and if patches, RFC patches in collaboration with authors.

Good.

Quoted 3 lines

The unhealthy approach is to needle one of the biggest contributors to core test code in the kernel on a thread because you don't seem to want to cd to a directory and run make.

My initial issue was that I could not find out where that is documented.

    $ make help
    ...
    Userspace tools targets:
      use "make tools/help"
      or  "cd tools; make help"
    $ make tools/help
    Possible targets:
    ...
    You can do:
      ...
      $ make tools/all

builds all tools.

But that command does not build tools/testing/radix-tree, so I was completely lost.

Quoted 3 lines

Why is this relevant to me? I am the author of the VMA test suite, on which I spent countless hours + relied heavily on Liam's work to do so, and equally there you have to cd to a directory and run make.

Thanks for your work! One suggestion for improvement: tools/testing/vma does not seem to be built by "make tools/all" either.

Quoted 7 lines

But at the same time in both cases, testability of key internal components is ENORMOUSLY improved and allows for REALLY exciting possibilities in test coverage, really isolating functions for unit testing, enormously fast iteration speed, etc. etc.

I ask you to weigh up the desire to enumerate your misgivings about the testing approach used here vs. all of the above.

I repeat: I am not against these tests.

Thanks!

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
#19 lore raw
Quoted 11 lines · Geert Uytterhoeven

Hi Lorenzo,

Quoted 3 lines · Lorenzo Stoakes

Having written a ton of test code, I've unfortunately encountered a lot of this sort of push-back and it's HUGELY off-putting. Writing test code should be ENCOURAGED not litigated against.

I am not discouraging nor pushing back on any testing code (on the contrary, I test every single new kunit test that appears upstream). My apologies if I gave the impression.

My point is what comes across as pedantry often seems to arrive (in my experience) in response to test code submissions.

A wag would say 'isn't that true of all kernel code?' :) but my experience has been that there has been poor RoI on the kind of feedback you get vs. meaningful benefits to the point that it feels like letting yourself in for yak shaving.

We may be terribly misreading you in this thread, but it's in any case how it comes across. Obviously this isn't helped by the context of this discussion!

Quoted 33 lines
Quoted 11 lines

The truth is far too little kernel code is tested to any degree, and this is part of why.

On kunit collaboration, I attended an in-person talk at LPC on kunit userland testing where it was broadly agreed that at this point in time, the xarray/radix tree tests weren't really suited to the framework.

Therefore I think the healthy means of pushing forward with integration is in sensible discussion and if patches, RFC patches in collaboration with authors.

Good.

Quoted 3 lines

The unhealthy approach is to needle one of the biggest contributors to core test code in the kernel on a thread because you don't seem to want to cd to a directory and run make.

My initial issue was that I could not find out where that is documented.

    $ make help
    ...
    Userspace tools targets:
      use "make tools/help"
      or  "cd tools; make help"
    $ make tools/help
    Possible targets:
    ...
    You can do:
      ...
      $ make tools/all
Quoted 4 lines

builds all tools.

But that command does not build tools/testing/radix-tree, so I was completely lost.

Right, I mean this should be easy enough to fix.

If what you're saying is - make this more discoverable, make this easily buildable from the top of the tree - then sure, and I expect this shouldn't be too challenging.

Quoted 7 lines
Quoted 4 lines

Why is this relevant to me? I am the author of the VMA test suite, on which I spent countless hours + relied heavily on Liam's work to do so, and equally there you have to cd to a directory and run make.

Thanks for your work! One suggestion for improvement: tools/testing/vma does not seem to be built by "make tools/all" either.

You're welcome, and right yeah, should be relatively simple to fix.

This kind of straightforward practical thing is fine. 'You must use the space wombat with extra fireworks' type feedback is not so much...

Quoted 10 lines
Quoted 8 lines

But at the same time in both cases, testability of key internal components is ENORMOUSLY improved and allows for REALLY exciting possibilities in test coverage, really isolating functions for unit testing, enormously fast iteration speed, etc. etc.

I ask you to weigh up the desire to enumerate your misgivings about the testing approach used here vs. all of the above.

I repeat: I am not against these tests.

Good, but I would also emphasise what I'm trying to get across with the wall of text here (sorry, that's very me) - let's not get bogged down in the framework or whether it might be preferable to have it under kunit or this that or the other thing vs. the enormous benefits this stuff brings.

Sometimes, esp. with new approaches to testing, it has to be at the very least incremental.

If you're saying 'just get it documented in a make help and make it buildable from the top of the tree' then fair enough and hopefully not too difficult.

In other words - we are all after the same thing here, let's work towards making everything better, and not unnecessarily throw unshaved yaks in the way :)

Quoted 5 lines

Thanks!

Gr{oetje,eeting}s,

Quoted 8 lines

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

Cheers, Lorenzo

#15 lore raw
In reply to Geert Uytterhoeven
Quoted 1 line · Geert Uytterhoeven

Hi Liam,

Hi Geert,

I'd like to say sorry for getting upset about this.

Quoted 8 lines · Liam R. Howlett
Quoted 2 lines

I'll await your patch to link all this together. Please Cc the authors.

I gave it a try for kselftests a few years ago.
https://lore.kernel.org/all/[email protected]
Unfortunately only one patch was applied...

It is difficult to integrate the test framework due to the nature of it stubbing out a lot of the kernel code it uses.

This is also a strength as it can be used to test unlikely failure scenarios that are difficult or impossible to recreate in kunit or a running kernel - even with injections of failures.

It can also be used to isolate issues for recreating, which is very valuable in larger, longer running issues.

I also use the userspace testing to test rcu using threads and I think that would be even more challenging on a booted system.

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines

it is to get m68k to build, you should probably know how to read a makefile.

Like all other kernel cross-compilation? Usually you don't even have to know where your cross-compiler is living:

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

make ARCH=m68k

Ignoring that I had to make a config - which asked challenging questions...

make ARCH=m68k defconfig

That also prompts, defoldconfig did not.

Quoted 4 lines
Quoted 2 lines

And ignoring the steps to get m68k compiler...

apt install gcc-m68k-linux-gnu?

There are a few compilers, multilib or such? I've had issues with getting all the archs working for cross compile on the same machine (arm, arm64, riscv, m68k, ppc, ppc64, parisc).

Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

When trying the above, and ignoring failures due to missing packages on my host:
- there are several weird build errors,
- this doesn't play well with O=,
- lots of scary warnings when building for 32-bit,
- ...

Quoted 6 lines
Quoted 4 lines

In file included from ./include/linux/sched.h:12,

                 from arch/m68k/kernel/asm-offsets.c:15:
./arch/m68k/include/asm/current.h:7:30: error: invalid register name for ‘current’
    7 | register struct task_struct *current __asm__("%a2");

Which compiler are you using?

I've had a hard time getting m68k to boot in qemu because of the lack of userspace. I use m68k for nommu testing, but have a hard time getting the buildroot to work correctly to build what I need.

This was a grumpy, pre-coffee way of saying that some tasks are not straight forward and are extremely difficult to make straight forward.

Sorry, I should not have made such rash comments. I respect you and your work and appreciate the help you have given me in the past.

I would also like to thank you for your earlier statements. After rereading them, I believe I misunderstood what you were saying. I've been trying to make these tests a part of automatic testing somehow, even getting them to run in userspace.

Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

At least the kunit tests build (and run[1] ;-) most of the time...

Do they? How about you break something in xarray and then try to boot the kunit, or try to boot to load that module.

If you break the kernel beyond the point of booting, you can indeed not run any test modules...

Quoted 7 lines
Quoted 5 lines

Which is extremely easy when you are changing code that runs so early in the boot.

My code found a compiler issue because it's the first function that returns a boolean. This is stupid.

Sorry. I don't understand this comment.

I had a bug a few years ago that turned out to be a clang compiler issue with booleans. It turns out my code was the first function to return a boolean and that wasn't being properly handled by the compiler (thanks to mitigation of clearing registers with certain .config/compiler flags).. it's not important.

More importantly, I think I get your point, you think that the testing should be integrated and complain if it's broken - at least by bots. I don't think this is practical in all cases, unfortunately.

Although I would like to strive for this - and I do by keeping any tests I can as a kernel module while keeping the harder to recreate issues as user space. I think we do a good job keeping testing up to date and adding testcases as new issues are discovered.

Thanks,
Liam

maintainer
#21 lore raw
In reply to Tamir Duberstein
Quoted 6 lines · On Wed, 29 Jan 2025 16:28:32 -0500 Tamir Duberstein <[email protected]> wrote:
Quoted 2 lines

How are grammar corrections going to the right person (but not the mailing list) while an entire conversion to kunit is not [1]?

Very simple: the tests are not properly included in MAINTAINERS. I
sent https://lore.kernel.org/all/[email protected]/
a few minutes ago for this reason.

I failed to notice that this patch didn't cc linux-mm.

MAINTAINERS doesn't ask people to cc linux-mm on xarray changes.

linux-mm averages 130 messages/day - I think it's reasonable to believe that MM developers spend a few minutes a day scanning the Subject:s.

This:

From: Andrew Morton <[email protected]>
Subject: MAINTAINERS: include linux-mm for xarray maintenance
Date: Thu Jan 30 04:16:20 PM PST 2025

MM developers have an interest in the xarray code.

---

 MAINTAINERS |    1 +
 1 file changed, 1 insertion(+)
MAINTAINERS renamed from MAINTAINERS~maintainers-include-linux-mm-for-xarray-maintenance +1 -0
@@ -25676,6 +25676,7 @@ F:	arch/x86/entry/vdso/
 XARRAY
 M:	Matthew Wilcox <[email protected]>
 L:	[email protected]
+L:	[email protected]
 S:	Supported
 F:	Documentation/core-api/xarray.rst
 F:	include/linux/idr.h

_

#16 lore raw
In reply to Liam R. Howlett

Hi Liam,

Quoted 8 lines · Liam R. Howlett
Quoted 7 lines · Geert Uytterhoeven
Quoted 6 lines · Liam R. Howlett
Quoted 6 lines
Quoted 2 lines

it is to get m68k to build, you should probably know how to read a makefile.

Like all other kernel cross-compilation? Usually you don't even have to know where your cross-compiler is living:

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 1 line

make ARCH=m68k

Ignoring that I had to make a config - which asked challenging questions...

make ARCH=m68k defconfig

That also prompts, defoldconfig did not.

Hmm, using a defconfig should never ask for questions. Perhaps this might happen if it has an option enabled that depends on specific compiler support?

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

And ignoring the steps to get m68k compiler...

apt install gcc-m68k-linux-gnu?

There are a few compilers, multilib or such? I've had issues with getting all the archs working for cross compile on the same machine (arm, arm64, riscv, m68k, ppc, ppc64, parisc).

I have installed all of the above (and more) from Ubuntu (except for parisc, as Ubuntu does not have it), and more from https://www.kernel.org/pub/tools/crosstool/.
All of them should work fine (for building kernels).

Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

When trying the above, and ignoring failures due to missing packages on my host:
- there are several weird build errors,
- this doesn't play well with O=,
- lots of scary warnings when building for 32-bit,
- ...

In file included from ./include/linux/sched.h:12,

                 from arch/m68k/kernel/asm-offsets.c:15:
./arch/m68k/include/asm/current.h:7:30: error: invalid register name for ‘current’
    7 | register struct task_struct *current __asm__("%a2");
Quoted 5 lines
Quoted 1 line

Which compiler are you using?

I've had a hard time getting m68k to boot in qemu because of the lack of userspace. I use m68k for nommu testing, but have a hard time getting the buildroot to work correctly to build what I need.

I only do m68k with MMU, and use Debian (ports) userland. Perhaps https://landley.net/toybox/ might give you a nommu userland.

Quoted 3 lines

More importantly, I think I get your point, you think that the testing should be integrated and complain if it's broken - at least by bots. I don't think this is practical in all cases, unfortunately.

Exactly:
- (cross)building kernel module tests is easy, and included in a kernel build, so build failures are detected early.
- (cross)building the userland testing tools is cumbersome.
So there's an opportunity for improvement...

Thanks!

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds