* [PATCH v1 1/2] lib/tests: string_helpers: Decouple unescape and escape cases
2026-04-06 19:32 [PATCH v1 0/2] lib/tests: string_helpers: Slight improvements Andy Shevchenko
@ 2026-04-06 19:32 ` Andy Shevchenko
2026-04-06 19:32 ` [PATCH v1 2/2] lib/tests: string_helpers: Don't use "proxy" headers Andy Shevchenko
2026-04-09 8:54 ` [PATCH v1 0/2] lib/tests: string_helpers: Slight improvements Andy Shevchenko
2 siblings, 0 replies; 4+ messages in thread
From: Andy Shevchenko @ 2026-04-06 19:32 UTC (permalink / raw)
To: Andy Shevchenko, linux-hardening, linux-kernel
Cc: Kees Cook, Andy Shevchenko, Andrew Morton
Currently the escape and unescape test cases go in one step.
Decouple them for the better granularity and understanding test
coverage in the results.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
lib/tests/string_helpers_kunit.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/lib/tests/string_helpers_kunit.c b/lib/tests/string_helpers_kunit.c
index c853046183d2..cd08e79a857d 100644
--- a/lib/tests/string_helpers_kunit.c
+++ b/lib/tests/string_helpers_kunit.c
@@ -601,6 +601,11 @@ static void test_unescape(struct kunit *test)
test_string_unescape(test, "unescape", i, false);
test_string_unescape(test, "unescape inplace",
get_random_u32_below(UNESCAPE_ALL_MASK + 1), true);
+}
+
+static void test_escape(struct kunit *test)
+{
+ unsigned int i;
/* Without dictionary */
for (i = 0; i < ESCAPE_ALL_MASK + 1; i++)
@@ -615,6 +620,7 @@ static struct kunit_case string_helpers_test_cases[] = {
KUNIT_CASE(test_get_size),
KUNIT_CASE(test_upper_lower),
KUNIT_CASE(test_unescape),
+ KUNIT_CASE(test_escape),
{}
};
--
2.50.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH v1 2/2] lib/tests: string_helpers: Don't use "proxy" headers
2026-04-06 19:32 [PATCH v1 0/2] lib/tests: string_helpers: Slight improvements Andy Shevchenko
2026-04-06 19:32 ` [PATCH v1 1/2] lib/tests: string_helpers: Decouple unescape and escape cases Andy Shevchenko
@ 2026-04-06 19:32 ` Andy Shevchenko
2026-04-09 8:54 ` [PATCH v1 0/2] lib/tests: string_helpers: Slight improvements Andy Shevchenko
2 siblings, 0 replies; 4+ messages in thread
From: Andy Shevchenko @ 2026-04-06 19:32 UTC (permalink / raw)
To: Andy Shevchenko, linux-hardening, linux-kernel
Cc: Kees Cook, Andy Shevchenko, Andrew Morton
Update header inclusions to follow IWYU (Include What You Use) principle.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
lib/tests/string_helpers_kunit.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/lib/tests/string_helpers_kunit.c b/lib/tests/string_helpers_kunit.c
index cd08e79a857d..9fbe91079c7e 100644
--- a/lib/tests/string_helpers_kunit.c
+++ b/lib/tests/string_helpers_kunit.c
@@ -5,11 +5,16 @@
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <kunit/test.h>
+
#include <linux/array_size.h>
-#include <linux/kernel.h>
+#include <linux/bug.h>
+#include <linux/limits.h>
+#include <linux/module.h>
#include <linux/random.h>
-#include <linux/string.h>
+#include <linux/slab.h>
+#include <linux/sprintf.h>
#include <linux/string_helpers.h>
+#include <linux/types.h>
static void test_string_check_buf(struct kunit *test,
const char *name, unsigned int flags,
--
2.50.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v1 0/2] lib/tests: string_helpers: Slight improvements
2026-04-06 19:32 [PATCH v1 0/2] lib/tests: string_helpers: Slight improvements Andy Shevchenko
2026-04-06 19:32 ` [PATCH v1 1/2] lib/tests: string_helpers: Decouple unescape and escape cases Andy Shevchenko
2026-04-06 19:32 ` [PATCH v1 2/2] lib/tests: string_helpers: Don't use "proxy" headers Andy Shevchenko
@ 2026-04-09 8:54 ` Andy Shevchenko
2 siblings, 0 replies; 4+ messages in thread
From: Andy Shevchenko @ 2026-04-09 8:54 UTC (permalink / raw)
To: linux-hardening, linux-kernel; +Cc: Kees Cook, Andy Shevchenko, Andrew Morton
On Mon, Apr 06, 2026 at 09:32:46PM +0200, Andy Shevchenko wrote:
> There are two ad-hoc patches to improve the test module. It was induced
> by another patch that poorly tried to add (existing) test cases and make
> me revisit the string_helpers_kunit.c.
Kees, I assume you can take it? In any case I'm find with you or Andrew taking them.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 4+ messages in thread