lib/string: Add strscpy_pad() function
Subsystems (6)
v4 cover lib/string: Add strscpy_pad() function
Hi Shua,
Here is the set with cleanup as suggested by Kees on v3.
Configured, built, and tested all modules loaded by tools/testing/selftests/lib/*.sh
Quoted 1 line
From previous cover letters ...
While doing the testing for strscpy_pad() it was noticed that there is duplication in how test modules are being fed to kselftest and also in the test modules themselves.
This set makes an attempt at adding a framework to kselftest for writing kernel test modules. It also adds a script for use in creating script test runners for kselftest. My macro-foo is not great, all criticism and suggestions very much appreciated. The design is based on test modules lib/test_printf.c, lib/test_bitmap.c, lib/test_xarray.c.
Changes since last version:
- Remove dependency on Bash (thanks Kees)
- Use oneliner to implement kselftest test runners (thanks Kees)
- Squash patch that adds kselftest script creator script with patch that uses it.
- Fix typos (thanks Randy)
- Add Kees' Acked-by tags to all patches
thanks,
Tobin.
Tobin C. Harding (6):
lib/test_printf: Add empty module_exit function
kselftest: Add test runner creation script
kselftest: Add test module framework header
lib: Use new kselftest header
lib/string: Add strscpy_pad() function
lib: Add test module for strscpy_pad
Documentation/dev-tools/kselftest.rst | 94 +++++++++++- include/linux/string.h | 4 + lib/Kconfig.debug | 3 + lib/Makefile | 1 + lib/string.c | 47 +++++- lib/test_bitmap.c | 20 +-- lib/test_printf.c | 17 +-- lib/test_strscpy.c | 150 +++++++++++++++++++ tools/testing/selftests/kselftest_module.h | 48 ++++++ tools/testing/selftests/kselftest_module.sh | 84 +++++++++++ tools/testing/selftests/lib/Makefile | 2 +- tools/testing/selftests/lib/bitmap.sh | 18 +-- tools/testing/selftests/lib/config | 1 + tools/testing/selftests/lib/prime_numbers.sh | 17 +-- tools/testing/selftests/lib/printf.sh | 19 +-- tools/testing/selftests/lib/strscpy.sh | 3 + 16 files changed, 440 insertions(+), 88 deletions(-) create mode 100644 lib/test_strscpy.c create mode 100644 tools/testing/selftests/kselftest_module.h create mode 100755 tools/testing/selftests/kselftest_module.sh create mode 100755 tools/testing/selftests/lib/strscpy.sh
Signature · 1 line
2.21.0
PATCH v4 1/6 lib/test_printf: Add empty module_exit function
Currently the test_printf module does not have an exit function, this prevents the module from being unloaded. If we cannot unload the module we cannot run the tests a second time.
Add an empty exit function.
--- lib/test_printf.c | 6 ++++++ 1 file changed, 6 insertions(+)
lib/test_printf.c +6 -0
@@ -615,5 +615,11 @@ test_printf_init(void)module_init (test_printf_init); +static void __exit test_printf_exit(void) +{ +} + +module_exit (test_printf_exit); +MODULE_AUTHOR ("Rasmus Villemoes <[email protected]>" );MODULE_LICENSE ("GPL" );
Signature · 1 line
2.21.0
PATCH v4 2/6 kselftest: Add test runner creation script
In reply to Tobin C. HardingCurrently if we wish to use kselftest to run tests within a kernel module we write a small script to load/unload and do error reporting. There are a bunch of these under tools/testing/selftests/lib/ that are all identical except for the test name. We can reduce code duplication and improve maintainability if we have one version of this. However kselftest requires an executable for each test. We can move all the script logic to a central script then have each individual test script call the main script.
Oneliner to call kselftest_module.sh courtesy of Kees, thanks!
Add test runner creation script. Convert tools/testing/selftests/lib/*.sh to use new test creation script.
Testing
-------
Configure kselftests for lib/ then build and boot kernel. Then run kselftests as follows:
$ cd /path/to/kernel/tree $ sudo make O=$output_path -C tools/testing/selftests TARGETS="lib" run_tests
and also
$ cd /path/to/kernel/tree $ cd tools/testing/selftests $ sudo make O=$output_path TARGETS="lib" run_tests
and also
$ cd /path/to/kernel/tree $ cd tools/testing/selftests $ sudo make TARGETS="lib" run_tests
--- tools/testing/selftests/kselftest_module.sh | 84 ++++++++++++++++++++ tools/testing/selftests/lib/bitmap.sh | 18 +---- tools/testing/selftests/lib/prime_numbers.sh | 17 +--- tools/testing/selftests/lib/printf.sh | 19 +---- 4 files changed, 88 insertions(+), 50 deletions(-) create mode 100755 tools/testing/selftests/kselftest_module.sh
tools/testing/selftests/kselftest_module.sh new file +84 -0
@@ -0,0 +1,84 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0+ + +# +# Runs an individual test module. +# +# kselftest expects a separate executable for each test, this can be +# created by adding a script like this: +# +# #!/bin/sh +# SPDX-License-Identifier: GPL-2.0+ +# $(dirname $0)/../kselftest_module.sh "description" module_name +# +# Example: tools/testing/selftests/lib/printf.sh + +desc="" # Output prefix. +module="" # Filename (without the .ko). +args="" # modprobe arguments. + +modprobe="/sbin/modprobe" + +main() { + parse_args "$@" + assert_root + assert_have_module + run_module +} + +parse_args() { + script=${0##*/} + + if [ $# -lt 2 ]; then + echo "Usage: $script <description> <module_name> [FAIL]" + exit 1 + fi + + desc="$1" + shift || true + module="$1" + shift || true + args="$@" +} + +assert_root() { + if [ ! -w /dev ]; then + skip "please run as root" + fi +} + +assert_have_module() { + if ! $modprobe -q -n $module; then + skip "module $module is not found" + fi +} + +run_module() { + if $modprobe -q $module $args; then + $modprobe -q -r $module + say "ok" + else + fail "" + fi +} + +say() { + echo "$desc: $1" +} + + +fail() { + say "$1 [FAIL]" >&2 + exit 1 +} + +skip() { + say "$1 [SKIP]" >&2 + # Kselftest framework requirement - SKIP code is 4. + exit 4 +} + +# +# Main script +# +main "$@"
tools/testing/selftests/lib/bitmap.sh +1 -17
@@ -1,19 +1,3 @@ #!/bin/sh # SPDX-License-Identifier: GPL-2.0 - -# Kselftest framework requirement - SKIP code is 4. -ksft_skip=4 - -# Runs bitmap infrastructure tests using test_bitmap kernel module -if ! /sbin/modprobe -q -n test_bitmap; then - echo "bitmap: module test_bitmap is not found [SKIP]" - exit $ksft_skip -fi - -if /sbin/modprobe -q test_bitmap; then - /sbin/modprobe -q -r test_bitmap - echo "bitmap: ok" -else - echo "bitmap: [FAIL]" - exit 1 -fi +$(dirname $0)/../kselftest_module.sh "bitmap" test_bitmap
tools/testing/selftests/lib/prime_numbers.sh +1 -16
@@ -1,19 +1,4 @@ #!/bin/sh # SPDX-License-Identifier: GPL-2.0 # Checks fast/slow prime_number generation for inconsistencies - -# Kselftest framework requirement - SKIP code is 4. -ksft_skip=4 - -if ! /sbin/modprobe -q -n prime_numbers; then - echo "prime_numbers: module prime_numbers is not found [SKIP]" - exit $ksft_skip -fi - -if /sbin/modprobe -q prime_numbers selftest=65536; then - /sbin/modprobe -q -r prime_numbers - echo "prime_numbers: ok" -else - echo "prime_numbers: [FAIL]" - exit 1 -fi +$(dirname $0)/../kselftest_module.sh "prime numbers" prime_numbers selftest=65536
tools/testing/selftests/lib/printf.sh +2 -17
@@ -1,19 +1,4 @@ #!/bin/sh # SPDX-License-Identifier: GPL-2.0 -# Runs printf infrastructure using test_printf kernel module - -# Kselftest framework requirement - SKIP code is 4. -ksft_skip=4 - -if ! /sbin/modprobe -q -n test_printf; then - echo "printf: module test_printf is not found [SKIP]" - exit $ksft_skip -fi - -if /sbin/modprobe -q test_printf; then - /sbin/modprobe -q -r test_printf - echo "printf: ok" -else - echo "printf: [FAIL]" - exit 1 -fi +# Tests the printf infrastructure using test_printf kernel module. +$(dirname $0)/../kselftest_module.sh "printf" test_printf
Signature · 1 line
2.21.0
Re: [PATCH v4 2/6] kselftest: Add test runner creation script
Hi Tobin,
Quoted 15 lines · Tobin C. Harding
Currently if we wish to use kselftest to run tests within a kernel module we write a small script to load/unload and do error reporting. There are a bunch of these under
tools/testing/selftests/lib/that are all identical except for the test name. We can reduce code duplication and improve maintainability if we have one version of this. However kselftest requires an executable for each test. We can move all the script logic to a central script then have each individual test script call the main script.Oneliner to call
kselftest_module.shcourtesy of Kees, thanks!Add test runner creation script. Convert
tools/testing/selftests/lib/*.shto use new test creation script.
Quoted 8 lines
Testing
-------Configure kselftests for
lib/then build and boot kernel. Then run kselftests as follows:$ cd /path/to/kernel/tree $ sudo make O=$output_path -C tools/testing/selftests TARGETS="lib" run_tests
We are missing "kselftest_module.sh" file when we do "make install" and followed by generating a tar file "gen_kselftest_tar.sh" and copying that on to target device and running tests by using "run_kselftest.sh" script file on the target.
Could you install the supporting script file "kselftest_module.sh" ?
Error log,
-------------
# selftests lib printf.sh lib: printf.sh_ # # ./printf.sh line 4 ./../kselftest_module.sh No such file or directory line: 4_./../kselftest_module.sh # [FAIL] 1 selftests lib printf.sh # exit=127 selftests: lib_printf.sh [FAIL] # selftests lib bitmap.sh lib: bitmap.sh_ # # ./bitmap.sh line 3 ./../kselftest_module.sh No such file or directory line: 3_./../kselftest_module.sh # [FAIL] 2 selftests lib bitmap.sh # exit=127 selftests: lib_bitmap.sh [FAIL] # selftests lib prime_numbers.sh lib: prime_numbers.sh_ # # ./prime_numbers.sh line 4 ./../kselftest_module.sh No such file or directory line: 4_./../kselftest_module.sh # [FAIL] 3 selftests lib prime_numbers.sh # exit=127 selftests: lib_prime_numbers.sh [FAIL] # selftests lib strscpy.sh lib: strscpy.sh_ # # ./strscpy.sh line 3 ./../kselftest_module.sh No such file or directory line: 3_./../kselftest_module.sh # [FAIL] 4 selftests lib strscpy.sh # exit=127 selftests: lib_strscpy.sh [FAIL]
- Naresh
Re: [PATCH v4 2/6] kselftest: Add test runner creation script
Quoted 24 lines · Naresh Kamboju
Hi Tobin,
Quoted 21 lines · Tobin C. Harding
Currently if we wish to use kselftest to run tests within a kernel module we write a small script to load/unload and do error reporting. There are a bunch of these under
tools/testing/selftests/lib/that are all identical except for the test name. We can reduce code duplication and improve maintainability if we have one version of this. However kselftest requires an executable for each test. We can move all the script logic to a central script then have each individual test script call the main script.Oneliner to call
kselftest_module.shcourtesy of Kees, thanks!Add test runner creation script. Convert
tools/testing/selftests/lib/*.shto use new test creation script.Testing
-------Configure kselftests for
lib/then build and boot kernel. Then run kselftests as follows:
Quoted 7 lines
Quoted 2 lines
$ cd /path/to/kernel/tree $ sudo make O=$output_path -C tools/testing/selftests TARGETS="lib" run_testsWe are missing "
kselftest_module.sh" file when we do "make install" and followed by generating a tar file "gen_kselftest_tar.sh" and copying that on to target device and running tests by using "run_kselftest.sh" script file on the target.
Yikes -- there's a problem with gen_kselftest_tar.sh using the wrong directory. I'll send a patch...
-Kees
Quoted 31 lines
Could you install the supporting script file "
kselftest_module.sh" ?Error log,
-------------# selftests lib printf.sh lib: printf.sh_ # # ./printf.sh line 4 ./../kselftest_module.sh No such file or directory line: 4_./../kselftest_module.sh # [FAIL] 1 selftests lib printf.sh # exit=127 selftests: lib_printf.sh [FAIL] # selftests lib bitmap.sh lib: bitmap.sh_ # # ./bitmap.sh line 3 ./../kselftest_module.sh No such file or directory line: 3_./../kselftest_module.sh # [FAIL] 2 selftests lib bitmap.sh # exit=127 selftests: lib_bitmap.sh [FAIL] # selftests lib prime_numbers.sh lib: prime_numbers.sh_ # # ./prime_numbers.sh line 4 ./../kselftest_module.sh No such file or directory line: 4_./../kselftest_module.sh # [FAIL] 3 selftests lib prime_numbers.sh # exit=127 selftests: lib_prime_numbers.sh [FAIL] # selftests lib strscpy.sh lib: strscpy.sh_ # # ./strscpy.sh line 3 ./../kselftest_module.sh No such file or directory line: 3_./../kselftest_module.sh # [FAIL] 4 selftests lib strscpy.sh # exit=127 selftests: lib_strscpy.sh [FAIL]- Naresh
Signature · 1 line
Kees Cook
PATCH v4 3/6 kselftest: Add test module framework header
In reply to Tobin C. Hardingkselftest runs as a userspace process. Sometimes we need to test things from kernel space. One way of doing this is by creating a test module. Currently doing so requires developers to write a bunch of boiler plate in the module if kselftest is to be used to run the tests. This means we currently have a load of duplicate code to achieve these ends. If we have a uniform method for implementing test modules then we can reduce code duplication, ensure uniformity in the test framework, ease code maintenance, and reduce the work required to create tests. This all helps to encourage developers to write and run tests.
Add a C header file that can be included in test modules. This provides a single point for common test functions/macros. Implement a few macros that make up the start of the test framework.
Add documentation for new kselftest header to kselftest documentation.
--- Documentation/dev-tools/kselftest.rst | 94 +++++++++++++++++++++- tools/testing/selftests/kselftest_module.h | 48 +++++++++++ 2 files changed, 140 insertions(+), 2 deletions(-) create mode 100644 tools/testing/selftests/kselftest_module.h
Documentation/dev-tools/kselftest.rst +92 -2
@@ -14,6 +14,10 @@ in safe mode with a limited scope. In limited mode, cpu-hotplug test is run on a single cpu as opposed to all hotplug capable cpus, and memory hotplug test is run on 2% of hotplug capable memory instead of 10%. +kselftest runs as a userspace process. Tests that can be written/run in +userspace may wish to use the `Test Harness`_. Tests that need to be +run in kernel space may wish to use a `Test Module`_. + Running the selftests (hotplug tests are run in limited mode) =============================================================
@@ -161,11 +165,97 @@ Contributing new tests (details) e.g: tools/testing/selftests/android/config +Test Module +=========== + +Kselftest tests the kernel from userspace. Sometimes things need +testing from within the kernel, one method of doing this is to create a +test module. We can tie the module into the kselftest framework by +using a shell script test runner. ``kselftest_module.sh`` is designed +to facilitate this process. There is also a header file provided to +assist writing kernel modules that are for use with kselftest: + +- ``tools/testing/kselftest/kselftest_module.h`` +- ``tools/testing/kselftest/kselftest_module.sh`` + +How to use +---------- + +Here we show the typical steps to create a test module and tie it into +kselftest. We use kselftests for lib/ as an example. + +1. Create the test module + +2. Create the test script that will run (load/unload) the module + e.g. ``tools/testing/selftests/lib/printf.sh`` + +3. Add line to config file e.g. ``tools/testing/selftests/lib/config`` + +4. Add test script to makefile e.g. ``tools/testing/selftests/lib/Makefile`` + +5. Verify it works: + +.. code-block:: sh + + # Assumes you have booted a fresh build of this kernel tree + cd /path/to/linux/tree + make kselftest-merge + make modules + sudo make modules_install + make TARGETS=lib kselftest + +Example Module +-------------- + +A bare bones test module might look like this: + +.. code-block:: c + + // SPDX-License-Identifier: GPL-2.0+ + + #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + + #include "../tools/testing/selftests/kselftest_module.h" + + KSTM_MODULE_GLOBALS(); + + /* + * Kernel module for testing the foobinator + */ + + static int __init test_function() + { + ... + } + + static void __init selftest(void) + { + KSTM_CHECK_ZERO(do_test_case("", 0)); + } + + KSTM_MODULE_LOADERS(test_foo); + MODULE_AUTHOR("John Developer <[email protected]>"); + MODULE_LICENSE("GPL"); + +Example test script +------------------- + +.. code-block:: sh + + #!/bin/bash + # SPDX-License-Identifier: GPL-2.0+ + $(dirname $0)/../kselftest_module.sh "foo" test_foo + + Test Harness ============ -The kselftest_harness.h file contains useful helpers to build tests. The tests -from tools/testing/selftests/seccomp/seccomp_bpf.c can be used as example. +The kselftest_harness.h file contains useful helpers to build tests. The +test harness is for userspace testing, for kernel space testing see `Test +Module`_ above. + +The tests from tools/testing/selftests/seccomp/seccomp_bpf.c can be used as +example. Example -------
tools/testing/selftests/kselftest_module.h new file +48 -0
48 lines not on this page · raw message
Signature · 1 line
2.21.0
PATCH v4 4/6 lib: Use new kselftest header
In reply to Tobin C. HardingWe just added a new C header file for use with test modules that are intended to be run with kselftest. We can reduce code duplication by using this header.
Use new kselftest header to reduce code duplication in test_printf and test_bitmap test modules.
--- lib/test_bitmap.c | 20 ++++---------------- lib/test_printf.c | 23 +++++------------------ 2 files changed, 9 insertions(+), 34 deletions(-)
lib/test_bitmap.c +4 -16
@@ -12,6 +12,8 @@#include <linux/slab.h> #include <linux/string.h> +#include "../tools/testing/selftests/kselftest_module.h" +static unsigned total_tests__initdata ;static unsigned failed_tests__initdata ;
@@ -361,7 +363,7 @@ static void noinline __init test_mem_optimisations(void) } } -static int __init test_bitmap_init (void ) +static void __init selftest (void ) {test_zero_clear ();test_fill_set ();
@@ -369,22 +371,8 @@ static int __init test_bitmap_init(void)test_bitmap_arr32 ();test_bitmap_parselist ();test_mem_optimisations (); - -if (failed_tests ==0 ) -pr_info ("all %u tests passed\n" , total_tests); -else -pr_warn ("failed %u out of %u tests\n" , - failed_tests, total_tests); - -return failed_tests ? -EINVAL :0 ; } -static void __exit test_bitmap_cleanup(void) -{ -} - -module_init (test_bitmap_init); -module_exit (test_bitmap_cleanup); - +KSTM_MODULE_LOADERS (test_bitmap);MODULE_AUTHOR ("david decotigny <[email protected]>" );MODULE_LICENSE ("GPL" );
lib/test_printf.c +5 -18
@@ -21,6 +21,8 @@#include <linux/gfp.h> #include <linux/mm.h> +#include "../tools/testing/selftests/kselftest_module.h" +#define BUF_SIZE 256#define PAD_SIZE 16#define FILL_CHAR '$'
@@ -590,12 +592,11 @@ test_pointer(void)flags (); } -static int __init -test_printf_init (void ) +static void __init selftest (void ) { alloced_buffer =kmalloc (BUF_SIZE +2 *PAD_SIZE ,GFP_KERNEL );if (!alloced_buffer) -return -ENOMEM ; +return ; test_buffer = alloced_buffer +PAD_SIZE ;test_basic ();
@@ -604,22 +605,8 @@ test_printf_init(void)test_pointer ();kfree (alloced_buffer); - -if (failed_tests ==0 ) -pr_info ("all %u tests passed\n" , total_tests); -else -pr_warn ("failed %u out of %u tests\n" , failed_tests, total_tests); - -return failed_tests ? -EINVAL :0 ; } -module_init (test_printf_init); - -static void __exit test_printf_exit(void) -{ -} - -module_exit (test_printf_exit); - +KSTM_MODULE_LOADERS (test_printf);MODULE_AUTHOR ("Rasmus Villemoes <[email protected]>" );MODULE_LICENSE ("GPL" );
Signature · 1 line
2.21.0
PATCH v4 5/6 lib/string: Add strscpy_pad() function
In reply to Tobin C. HardingWe have a function to copy strings safely and we have a function to copy strings and zero the tail of the destination (if source string is shorter than destination buffer) but we do not have a function to do both at once. This means developers must write this themselves if they desire this functionality. This is a chore, and also leaves us open to off by one errors unnecessarily.
Add a function that calls strscpy() then memset()s the tail to zero if the source string is shorter than the destination buffer.
--- include/linux/string.h | 4 ++++ lib/string.c | 47 +++++++++++++++++++++++++++++++++++------- 2 files changed, 44 insertions(+), 7 deletions(-)
include/linux/string.h +4 -0
@@ -31,6 +31,10 @@ size_t strlcpy(char *, const char *, size_t);#ifndef __HAVE_ARCH_STRSCPYssize_t strscpy (char *,const char *,size_t );#endif + +/* Wraps calls to strscpy()/memset(), no arch specific code required */ +ssize_t strscpy_pad (char *dest,const char *src,size_t count); +#ifndef __HAVE_ARCH_STRCATextern char *strcat (char *,const char *);#endif
lib/string.c +40 -7
65 lines not on this page · raw message
Signature · 1 line
2.21.0
PATCH v4 6/6 lib: Add test module for strscpy_pad
In reply to Tobin C. HardingAdd a test module for the new strscpy_pad() function. Tie it into the kselftest infrastructure for lib/ tests.
--- lib/Kconfig.debug | 3 + lib/Makefile | 1 + lib/test_strscpy.c | 150 +++++++++++++++++++++++++ tools/testing/selftests/lib/Makefile | 2 +- tools/testing/selftests/lib/config | 1 + tools/testing/selftests/lib/strscpy.sh | 3 + 6 files changed, 159 insertions(+), 1 deletion(-) create mode 100644 lib/test_strscpy.c create mode 100755 tools/testing/selftests/lib/strscpy.sh
lib/Kconfig.debug +3 -0
@@ -1769,6 +1769,9 @@ config TEST_HEXDUMP config TEST_STRING_HELPERS tristate "Test functions located in the string_helpers module at runtime" +config TEST_STRSCPY + tristate "Test strscpy*() family of functions at runtime" + config TEST_KSTRTOX tristate "Test kstrto*() family of functions at runtime"
lib/Makefile +1 -0
@@ -70,6 +70,7 @@ obj-$(CONFIG_TEST_STATIC_KEYS) += test_static_keys.o obj-$(CONFIG_TEST_STATIC_KEYS) += test_static_key_base.o obj-$(CONFIG_TEST_PRINTF) += test_printf.o obj-$(CONFIG_TEST_BITMAP) += test_bitmap.o +obj-$(CONFIG_TEST_STRSCPY) += test_strscpy.o obj-$(CONFIG_TEST_BITFIELD) += test_bitfield.o obj-$(CONFIG_TEST_UUID) += test_uuid.o obj-$(CONFIG_TEST_XARRAY) += test_xarray.o
lib/test_strscpy.c new file +150 -0
150 lines not on this page · raw message
tools/testing/selftests/lib/Makefile +1 -1
@@ -3,6 +3,6 @@ # No binaries, but make sure arg-less "make" doesn't trigger "run_tests" all: -TEST_PROGS := printf.sh bitmap.sh prime_numbers.sh +TEST_PROGS := printf.sh bitmap.sh prime_numbers.sh strscpy.sh include ../lib.mk
tools/testing/selftests/lib/config +1 -0
@@ -1,3 +1,4 @@ CONFIG_TEST_PRINTF=m CONFIG_TEST_BITMAP=m CONFIG_PRIME_NUMBERS=m +CONFIG_TEST_STRSCPY=m
tools/testing/selftests/lib/strscpy.sh new file +3 -0
@@ -0,0 +1,3 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0+ +$(dirname $0)/../kselftest_module.sh "strscpy*" test_strscpy
Signature · 1 line
2.21.0
Quoted 1 line · Tobin C. Harding
Hi Shua,
Apologies for continually leaving off the 'h' from your name Shuah.
Tobin
shuah
maintainerQuoted 28 lines · Tobin C. Harding
Hi Shua,
Here is the set with cleanup as suggested by Kees on v3.
Configured, built, and tested all modules loaded by
tools/testing/selftests/lib/*.shQuoted 1 line
Quoted 1 line
From previous cover letters ...
While doing the testing for
strscpy_pad()it was noticed that there is duplication in how test modules are being fed to kselftest and also in the test modules themselves.This set makes an attempt at adding a framework to kselftest for writing kernel test modules. It also adds a script for use in creating script test runners for kselftest. My macro-foo is not great, all criticism and suggestions very much appreciated. The design is based on test modules
lib/test_printf.c,lib/test_bitmap.c,lib/test_xarray.c.Changes since last version:
- Remove dependency on Bash (thanks Kees)
- Use oneliner to implement kselftest test runners (thanks Kees)
- Squash patch that adds kselftest script creator script with patch that uses it.
- Fix typos (thanks Randy)
- Add Kees' Acked-by tags to all patches
Quoted 4 lines
thanks,
Tobin.
Hi Tobin,
Thanks for this restructuring work and adding the framework. Thanks Kees for the reviews.
The patch is series in now in linux-kselftest next for 5.2
thanks,
-- Shuah
Quoted 1 line · shuah
The patch is series in now in linux-kselftest next for 5.2
Yay, awesome! :) Thanks!
Signature · 1 line
Kees Cook