lib: add module support to sort tests
cover lib: add module support to sort tests
Hi Andrew,
This patch series allows to compile the array-based and linked list sort test code either to loadable modules, or builtin into the kernel.
It's very valuable to have modular tests, so you can run them just by insmodding the test modules, instead of needing a separate kernel that runs them at boot.
Thanks for applying!
Geert Uytterhoeven (3):
Revert "lib/test_sort.c: make it explicitly non-modular"
lib: add module support to array-based sort tests
lib: add module support to linked list sorting tests
lib/Kconfig.debug | 14 ++--- lib/Makefile | 1 + lib/list_sort.c | 149 -------------------------------------------------- lib/test_list_sort.c | 150 +++++++++++++++++++++++++++++++++++++++++++++++++++ lib/test_sort.c | 11 ++-- 5 files changed, 164 insertions(+), 161 deletions(-) create mode 100644 lib/test_list_sort.c
Signature · 12 lines
2.7.4
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 TorvaldsPATCH 1/3 Revert "lib/test_sort.c: make it explicitly non-modular"
This reverts commit 8893f519330bb073a49c5b4676fce4be6f1be15d.
It's very valuable to have modular tests, so you can run them just by insmodding the test modules, instead of needing a separate kernel that runs them at boot.
--- lib/test_sort.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
lib/test_sort.c +5 -6
@@ -1,11 +1,8 @@#include <linux/sort.h> #include <linux/slab.h> -#include <linux/init.h> +#include <linux/module.h> -/* -* A simple boot-time regression test -* License: GPL -*/ +/* a simple boot-time regression test */ #define TEST_LEN 1000
@@ -41,4 +38,6 @@ static int __init test_sort_init(void)kfree (a);return err; } -subsys_initcall (test_sort_init); + +module_init (test_sort_init); +MODULE_LICENSE ("GPL" );
Signature · 1 line
2.7.4
Re: [PATCH 1/3] Revert "lib/test_sort.c: make it explicitly non-modular"
Quoted 23 lines · Geert Uytterhoeven
This reverts commit
8893f519330bb073a49c5b4676fce4be6f1be15d.It's very valuable to have modular tests, so you can run them just by insmodding the test modules, instead of needing a separate kernel that runs them at boot.
Signed-off-by Geert Uytterhoeven <[email protected]>---
lib/test_sort.c | 11 +++++------1 file changed, 5 insertions(+), 6 deletions(-)lib/test_sort.c +1
-1@@ -1,11 +1,8 @@ #include <linux/sort.h> #include <linux/slab.h> -#include <linux/init.h> +#include <linux/module.h>
lib/test_sort.c line 5
Quoted 5 lines
lib/test_sort.c +1
-4-/* -* A simple boot-time regression test -* License: GPL -*/ +/* a simple boot-time regression test */
I would leave this piece as is now.
The rest is okay.
Quoted 11 lines
#defineTEST_LEN1000lib/test_sort.c +3
-1@@ -41,4 +38,6 @@ static int __init test_sort_init(void) kfree(a); return err; } -subsys_initcall (test_sort_init); + +module_init (test_sort_init); +MODULE_LICENSE ("GPL" );
Signature · 2 lines
Andy Shevchenko <[email protected]> Intel Finland Oy
Re: [PATCH 1/3] Revert "lib/test_sort.c: make it explicitly non-modular"
Hi Andy,
Quoted 24 lines · Andy Shevchenko
Quoted 23 lines · Geert Uytterhoeven
This reverts commit
8893f519330bb073a49c5b4676fce4be6f1be15d.It's very valuable to have modular tests, so you can run them just by insmodding the test modules, instead of needing a separate kernel that runs them at boot.
Signed-off-by Geert Uytterhoeven <[email protected]>--- lib/test_sort.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)lib/test_sort.c +1
-1@@ -1,11 +1,8 @@#include <linux/sort.h> #include <linux/slab.h> -#include <linux/init.h> +#include <linux/module.h>
Quoted 7 lines
lib/test_sort.c line 5
Quoted 5 lines
lib/test_sort.c +1
-4-/* -* A simple boot-time regression test -* License: GPL -*/ +/* a simple boot-time regression test */ I would leave this piece as is now.
As this is a revert, I prefer to revert 100%.
Quoted 1 line
The rest is okay.
Thanks!
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
PATCH 2/3 lib: add module support to array-based sort tests
In reply to Geert UytterhoevenAllow to compile the array-based sort test code either to a loadable module, or builtin into the kernel.
--- lib/Kconfig.debug | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
lib/Kconfig.debug +4 -3
@@ -1740,10 +1740,11 @@ config TEST_LIST_SORT If unsure, say N. config TEST_SORT - bool "Array-based sort test" - depends on DEBUG_KERNEL + tristate "Array-based sort test" + depends on DEBUG_KERNEL || m help - This option enables the self-test function of 'sort()' at boot. + This option enables the self-test function of 'sort()' at boot, + or at module load time. If unsure, say N.
Signature · 1 line
2.7.4
PATCH 3/3 lib: add module support to linked list sorting tests
In reply to Geert UytterhoevenExtract the linked list sorting test code into its own source file, to allow to compile it either to a loadable module, or builtin into the kernel.
--- lib/Kconfig.debug | 7 +-- lib/Makefile | 1 + lib/list_sort.c | 149 -------------------------------------------------- lib/test_list_sort.c | 150 +++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 155 insertions(+), 152 deletions(-) create mode 100644 lib/test_list_sort.c
lib/Kconfig.debug +4 -3
@@ -1731,11 +1731,12 @@ config LKDTM Documentation/fault-injection/provoke-crashes.txt config TEST_LIST_SORT - bool "Linked list sorting test" - depends on DEBUG_KERNEL + tristate "Linked list sorting test" + depends on DEBUG_KERNEL || m help Enable this to turn on 'list_sort()' function test. This test is - executed only once during system boot, so affects only boot time. + executed only once during system boot (so affects only boot time), + or at module load time. If unsure, say N.
lib/Makefile +1 -0
@@ -49,6 +49,7 @@ obj-$(CONFIG_TEST_FIRMWARE) += test_firmware.o obj-$(CONFIG_TEST_HASH) += test_hash.o test_siphash.o obj-$(CONFIG_TEST_KASAN) += test_kasan.o obj-$(CONFIG_TEST_KSTRTOX) += test-kstrtox.o +obj-$(CONFIG_TEST_LIST_SORT) += test_list_sort.o obj-$(CONFIG_TEST_LKM) += test_module.o obj-$(CONFIG_TEST_RHASHTABLE) += test_rhashtable.o obj-$(CONFIG_TEST_SORT) += test_sort.o
lib/list_sort.c +0 -149
155 lines not on this page · raw message
lib/test_list_sort.c new file +150 -0
150 lines not on this page · raw message
Signature · 1 line
2.7.4
Re: [PATCH 3/3] lib: add module support to linked list sorting tests
lib/Kconfig.debug config LKDTM · line 1735
Quoted 12 lines · Geert Uytterhoeven
lib/Kconfig.debug +2
-2@@ -1731,11 +1731,12 @@ config LKDTM Documentation/fault-injection/provoke-crashes.txt config TEST_LIST_SORT - bool "Linked list sorting test" - depends on DEBUG_KERNEL + tristate "Linked list sorting test" + depends on DEBUG_KERNEL || m
I don't see any other test code with a "DEBUG_KERNEL || m" dependency, but several that are "DEBUG_KERNEL && m". Maybe we should just force it to be a module like the others? If there are good reasons to have it built-in, I'd just drop the "|| m" here.
Arnd
Re: [PATCH 3/3] lib: add module support to linked list sorting tests
Hi Arnd,
Quoted 10 lines · Arnd Bergmann
Quoted 7 lines · Geert Uytterhoeven
lib/Kconfig.debug +0
-0@@ -1731,11 +1731,12 @@ config LKDTM Documentation/fault-injection/provoke-crashes.txt
Quoted 10 lines
lib/Kconfig.debug config LKDTM · line 1735
Quoted 5 lines
lib/Kconfig.debug +2
-2config TEST_LIST_SORT - bool "Linked list sorting test" - depends on DEBUG_KERNEL + tristate "Linked list sorting test" + depends on DEBUG_KERNEL || mI don't see any other test code with a "
DEBUG_KERNEL|| m" dependency, but several that are "DEBUG_KERNEL&& m". Maybe we should just force it to be a module like the others? If there are good reasons to have it built-in, I'd just drop the "|| m" here.
Some people want to run all tests at boot time, so forcing the test to be modular breaks that.
I used "|| m" as I like to enable all tests as modules, even when not using DEBUG_KERNEL.
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
Quoted 11 lines · Geert Uytterhoeven
Hi Andrew,
This patch series allows to compile the array-based and linked list sort
test code either to loadable modules, or builtin into the kernel.It's very valuable to have modular tests, so you can run them just by insmodding the test modules, instead of needing a separate kernel that runs them at boot.
Thanks for applying!
FWIW:
On the first glance looks okay to me. I didn't carefully checked code move (I guess -M -C will not help much, though one can play with numbers there), so I believe Geert didn't change much there.
Quoted 16 lines
Geert Uytterhoeven (3):
Revert "lib/test_sort.c: make it explicitly non-modular"
lib: add module support to array-based sort tests
lib: add module support to linked list sorting testslib/Kconfig.debug | 14 ++---
lib/Makefile | 1 +
lib/list_sort.c | 149 ------------------------------------------
--------
lib/test_list_sort.c | 150
+++++++++++++++++++++++++++++++++++++++++++++++++++
lib/test_sort.c | 11 ++--5 files changed, 164 insertions(+), 161 deletions(-)create mode 100644
lib/test_list_sort.c
Signature · 2 lines
Andy Shevchenko <[email protected]> Intel Finland Oy