public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] printf: add tests for generic FourCCs
@ 2025-03-14  3:45 Aditya Garg
  2025-03-21 14:10 ` Andy Shevchenko
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Aditya Garg @ 2025-03-14  3:45 UTC (permalink / raw)
  To: Kees Cook, tamird@gmail.com, Petr Mladek, Steven Rostedt,
	Andy Shevchenko, Rasmus Villemoes, Sergey Senozhatsky
  Cc: Linux Kernel Mailing List

From: Aditya Garg <gargaditya08@live.com>

Format specifiers for printing generic 32-bit FourCCs were recently added
to vsprintf. They are going through the DRM tree alongwith the appletbdrm
driver. Since the printf tests are being converted to kunit, this separate
patch for the tests should make it easier to rebase when the merge window
opens.

Link: https://lore.kernel.org/dri-devel/79FA3F41-FD7A-41D9-852B-D32606AF5EB4@live.com/T/#u
Signed-off-by: Aditya Garg <gargaditya08@live.com>
---
 lib/tests/printf_kunit.c | 39 ++++++++++++++++++++++++++++++++-------
 1 file changed, 32 insertions(+), 7 deletions(-)

diff --git a/lib/tests/printf_kunit.c b/lib/tests/printf_kunit.c
index 2c9f6170b..b1fa0dcea 100644
--- a/lib/tests/printf_kunit.c
+++ b/lib/tests/printf_kunit.c
@@ -701,21 +701,46 @@ static void fwnode_pointer(struct kunit *kunittest)
 	software_node_unregister_node_group(group);
 }
 
+struct fourcc_struct {
+	u32 code;
+	const char *str;
+};
+
+static void fourcc_pointer_test(struct kunit *kunittest, const struct fourcc_struct *fc,
+				size_t n, const char *fmt)
+{
+	size_t i;
+
+	for (i = 0; i < n; i++)
+		test(fc[i].str, fmt, &fc[i].code);
+}
+
 static void fourcc_pointer(struct kunit *kunittest)
 {
-	struct {
-		u32 code;
-		char *str;
-	} const try[] = {
+	static const struct fourcc_struct try_cc[] = {
 		{ 0x3231564e, "NV12 little-endian (0x3231564e)", },
 		{ 0xb231564e, "NV12 big-endian (0xb231564e)", },
 		{ 0x10111213, ".... little-endian (0x10111213)", },
 		{ 0x20303159, "Y10  little-endian (0x20303159)", },
 	};
-	unsigned int i;
+	static const struct fourcc_struct try_ch[] = {
+		{ 0x41424344, "ABCD (0x41424344)", },
+	};
+	static const struct fourcc_struct try_cn[] = {
+		{ 0x41424344, "DCBA (0x44434241)", },
+	};
+	static const struct fourcc_struct try_cl[] = {
+		{ (__force u32)cpu_to_le32(0x41424344), "ABCD (0x41424344)", },
+	};
+	static const struct fourcc_struct try_cb[] = {
+		{ (__force u32)cpu_to_be32(0x41424344), "ABCD (0x41424344)", },
+	};
 
-	for (i = 0; i < ARRAY_SIZE(try); i++)
-		test(try[i].str, "%p4cc", &try[i].code);
+	fourcc_pointer_test(kunittest, try_cc, ARRAY_SIZE(try_cc), "%p4cc");
+	fourcc_pointer_test(kunittest, try_ch, ARRAY_SIZE(try_ch), "%p4ch");
+	fourcc_pointer_test(kunittest, try_cn, ARRAY_SIZE(try_cn), "%p4cn");
+	fourcc_pointer_test(kunittest, try_cl, ARRAY_SIZE(try_cl), "%p4cl");
+	fourcc_pointer_test(kunittest, try_cb, ARRAY_SIZE(try_cb), "%p4cb");
 }
 
 static void
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] printf: add tests for generic FourCCs
  2025-03-14  3:45 [PATCH] printf: add tests for generic FourCCs Aditya Garg
@ 2025-03-21 14:10 ` Andy Shevchenko
  2025-03-21 14:16 ` Tamir Duberstein
  2025-03-25 19:48 ` Kees Cook
  2 siblings, 0 replies; 10+ messages in thread
From: Andy Shevchenko @ 2025-03-21 14:10 UTC (permalink / raw)
  To: Aditya Garg
  Cc: Kees Cook, tamird@gmail.com, Petr Mladek, Steven Rostedt,
	Rasmus Villemoes, Sergey Senozhatsky, Linux Kernel Mailing List

On Fri, Mar 14, 2025 at 03:45:01AM +0000, Aditya Garg wrote:
> From: Aditya Garg <gargaditya08@live.com>
> 
> Format specifiers for printing generic 32-bit FourCCs were recently added
> to vsprintf. They are going through the DRM tree alongwith the appletbdrm
> driver. Since the printf tests are being converted to kunit, this separate
> patch for the tests should make it easier to rebase when the merge window
> opens.

I am always for the additional test cases!
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] printf: add tests for generic FourCCs
  2025-03-14  3:45 [PATCH] printf: add tests for generic FourCCs Aditya Garg
  2025-03-21 14:10 ` Andy Shevchenko
@ 2025-03-21 14:16 ` Tamir Duberstein
  2025-03-21 14:23   ` Aditya Garg
  2025-03-25 19:48 ` Kees Cook
  2 siblings, 1 reply; 10+ messages in thread
From: Tamir Duberstein @ 2025-03-21 14:16 UTC (permalink / raw)
  To: Aditya Garg
  Cc: Kees Cook, Petr Mladek, Steven Rostedt, Andy Shevchenko,
	Rasmus Villemoes, Sergey Senozhatsky, Linux Kernel Mailing List

On Thu, Mar 13, 2025 at 11:45 PM Aditya Garg <gargaditya08@live.com> wrote:
>
> From: Aditya Garg <gargaditya08@live.com>
>
> Format specifiers for printing generic 32-bit FourCCs were recently added
> to vsprintf. They are going through the DRM tree alongwith the appletbdrm
> driver. Since the printf tests are being converted to kunit, this separate
> patch for the tests should make it easier to rebase when the merge window
> opens.
>
> Link: https://lore.kernel.org/dri-devel/79FA3F41-FD7A-41D9-852B-D32606AF5EB4@live.com/T/#u
> Signed-off-by: Aditya Garg <gargaditya08@live.com>
> ---
>  lib/tests/printf_kunit.c | 39 ++++++++++++++++++++++++++++++++-------
>  1 file changed, 32 insertions(+), 7 deletions(-)
>
> diff --git a/lib/tests/printf_kunit.c b/lib/tests/printf_kunit.c
> index 2c9f6170b..b1fa0dcea 100644
> --- a/lib/tests/printf_kunit.c
> +++ b/lib/tests/printf_kunit.c
> @@ -701,21 +701,46 @@ static void fwnode_pointer(struct kunit *kunittest)
>         software_node_unregister_node_group(group);
>  }
>
> +struct fourcc_struct {
> +       u32 code;
> +       const char *str;
> +};
> +
> +static void fourcc_pointer_test(struct kunit *kunittest, const struct fourcc_struct *fc,
> +                               size_t n, const char *fmt)
> +{
> +       size_t i;
> +
> +       for (i = 0; i < n; i++)
> +               test(fc[i].str, fmt, &fc[i].code);
> +}
> +
>  static void fourcc_pointer(struct kunit *kunittest)
>  {
> -       struct {
> -               u32 code;
> -               char *str;
> -       } const try[] = {
> +       static const struct fourcc_struct try_cc[] = {
>                 { 0x3231564e, "NV12 little-endian (0x3231564e)", },
>                 { 0xb231564e, "NV12 big-endian (0xb231564e)", },
>                 { 0x10111213, ".... little-endian (0x10111213)", },
>                 { 0x20303159, "Y10  little-endian (0x20303159)", },
>         };
> -       unsigned int i;
> +       static const struct fourcc_struct try_ch[] = {
> +               { 0x41424344, "ABCD (0x41424344)", },
> +       };
> +       static const struct fourcc_struct try_cn[] = {
> +               { 0x41424344, "DCBA (0x44434241)", },
> +       };
> +       static const struct fourcc_struct try_cl[] = {
> +               { (__force u32)cpu_to_le32(0x41424344), "ABCD (0x41424344)", },
> +       };
> +       static const struct fourcc_struct try_cb[] = {
> +               { (__force u32)cpu_to_be32(0x41424344), "ABCD (0x41424344)", },
> +       };
>
> -       for (i = 0; i < ARRAY_SIZE(try); i++)
> -               test(try[i].str, "%p4cc", &try[i].code);
> +       fourcc_pointer_test(kunittest, try_cc, ARRAY_SIZE(try_cc), "%p4cc");
> +       fourcc_pointer_test(kunittest, try_ch, ARRAY_SIZE(try_ch), "%p4ch");
> +       fourcc_pointer_test(kunittest, try_cn, ARRAY_SIZE(try_cn), "%p4cn");
> +       fourcc_pointer_test(kunittest, try_cl, ARRAY_SIZE(try_cl), "%p4cl");
> +       fourcc_pointer_test(kunittest, try_cb, ARRAY_SIZE(try_cb), "%p4cb");
>  }
>
>  static void
> --
> 2.43.0
>

This code looks fine to me. I would appreciate a preview of the output
of these tests when they fail; a lot of effort went into making the
printf tests produce actionable failure messages, and we should
continue to invest in that IMO.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] printf: add tests for generic FourCCs
  2025-03-21 14:16 ` Tamir Duberstein
@ 2025-03-21 14:23   ` Aditya Garg
  2025-03-21 14:52     ` Tamir Duberstein
  0 siblings, 1 reply; 10+ messages in thread
From: Aditya Garg @ 2025-03-21 14:23 UTC (permalink / raw)
  To: Tamir Duberstein
  Cc: Kees Cook, Petr Mladek, Steven Rostedt, Andy Shevchenko,
	Rasmus Villemoes, Sergey Senozhatsky, Linux Kernel Mailing List



> On 21 Mar 2025, at 7:47 PM, Tamir Duberstein <tamird@gmail.com> wrote:
> 
> On Thu, Mar 13, 2025 at 11:45 PM Aditya Garg <gargaditya08@live.com> wrote:
>> 
>> From: Aditya Garg <gargaditya08@live.com>
>> 
>> Format specifiers for printing generic 32-bit FourCCs were recently added
>> to vsprintf. They are going through the DRM tree alongwith the appletbdrm
>> driver. Since the printf tests are being converted to kunit, this separate
>> patch for the tests should make it easier to rebase when the merge window
>> opens.
>> 
>> Link: https://lore.kernel.org/dri-devel/79FA3F41-FD7A-41D9-852B-D32606AF5EB4@live.com/T/#u
>> Signed-off-by: Aditya Garg <gargaditya08@live.com>
>> ---
>> lib/tests/printf_kunit.c | 39 ++++++++++++++++++++++++++++++++-------
>> 1 file changed, 32 insertions(+), 7 deletions(-)
>> 
>> diff --git a/lib/tests/printf_kunit.c b/lib/tests/printf_kunit.c
>> index 2c9f6170b..b1fa0dcea 100644
>> --- a/lib/tests/printf_kunit.c
>> +++ b/lib/tests/printf_kunit.c
>> @@ -701,21 +701,46 @@ static void fwnode_pointer(struct kunit *kunittest)
>>        software_node_unregister_node_group(group);
>> }
>> 
>> +struct fourcc_struct {
>> +       u32 code;
>> +       const char *str;
>> +};
>> +
>> +static void fourcc_pointer_test(struct kunit *kunittest, const struct fourcc_struct *fc,
>> +                               size_t n, const char *fmt)
>> +{
>> +       size_t i;
>> +
>> +       for (i = 0; i < n; i++)
>> +               test(fc[i].str, fmt, &fc[i].code);
>> +}
>> +
>> static void fourcc_pointer(struct kunit *kunittest)
>> {
>> -       struct {
>> -               u32 code;
>> -               char *str;
>> -       } const try[] = {
>> +       static const struct fourcc_struct try_cc[] = {
>>                { 0x3231564e, "NV12 little-endian (0x3231564e)", },
>>                { 0xb231564e, "NV12 big-endian (0xb231564e)", },
>>                { 0x10111213, ".... little-endian (0x10111213)", },
>>                { 0x20303159, "Y10  little-endian (0x20303159)", },
>>        };
>> -       unsigned int i;
>> +       static const struct fourcc_struct try_ch[] = {
>> +               { 0x41424344, "ABCD (0x41424344)", },
>> +       };
>> +       static const struct fourcc_struct try_cn[] = {
>> +               { 0x41424344, "DCBA (0x44434241)", },
>> +       };
>> +       static const struct fourcc_struct try_cl[] = {
>> +               { (__force u32)cpu_to_le32(0x41424344), "ABCD (0x41424344)", },
>> +       };
>> +       static const struct fourcc_struct try_cb[] = {
>> +               { (__force u32)cpu_to_be32(0x41424344), "ABCD (0x41424344)", },
>> +       };
>> 
>> -       for (i = 0; i < ARRAY_SIZE(try); i++)
>> -               test(try[i].str, "%p4cc", &try[i].code);
>> +       fourcc_pointer_test(kunittest, try_cc, ARRAY_SIZE(try_cc), "%p4cc");
>> +       fourcc_pointer_test(kunittest, try_ch, ARRAY_SIZE(try_ch), "%p4ch");
>> +       fourcc_pointer_test(kunittest, try_cn, ARRAY_SIZE(try_cn), "%p4cn");
>> +       fourcc_pointer_test(kunittest, try_cl, ARRAY_SIZE(try_cl), "%p4cl");
>> +       fourcc_pointer_test(kunittest, try_cb, ARRAY_SIZE(try_cb), "%p4cb");
>> }
>> 
>> static void
>> --
>> 2.43.0
>> 
> 
> This code looks fine to me. I would appreciate a preview of the output
> of these tests when they fail; a lot of effort went into making the
> printf tests produce actionable failure messages, and we should
> continue to invest in that IMO.

Can you give me some docs for running the Kunit tests? The patch is basically a port of the original version.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] printf: add tests for generic FourCCs
  2025-03-21 14:23   ` Aditya Garg
@ 2025-03-21 14:52     ` Tamir Duberstein
  2025-03-22 10:04       ` Aditya Garg
  0 siblings, 1 reply; 10+ messages in thread
From: Tamir Duberstein @ 2025-03-21 14:52 UTC (permalink / raw)
  To: Aditya Garg
  Cc: Kees Cook, Petr Mladek, Steven Rostedt, Andy Shevchenko,
	Rasmus Villemoes, Sergey Senozhatsky, Linux Kernel Mailing List

On Fri, Mar 21, 2025 at 10:23 AM Aditya Garg <gargaditya08@live.com> wrote:
>
>
> Can you give me some docs for running the Kunit tests? The patch is basically a port of the original version.

I use:

tools/testing/kunit/kunit.py run --arch arm64 --make_options LLVM=1 printf

You can probably just use:

tools/testing/kunit/kunit.py run printf

It would also be useful to see raw output:

tools/testing/kunit/kunit.py run printf --raw_output

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] printf: add tests for generic FourCCs
  2025-03-21 14:52     ` Tamir Duberstein
@ 2025-03-22 10:04       ` Aditya Garg
  2025-03-22 13:30         ` Tamir Duberstein
  0 siblings, 1 reply; 10+ messages in thread
From: Aditya Garg @ 2025-03-22 10:04 UTC (permalink / raw)
  To: Tamir Duberstein
  Cc: Kees Cook, Petr Mladek, Steven Rostedt, Andy Shevchenko,
	Rasmus Villemoes, Sergey Senozhatsky, Linux Kernel Mailing List

Hi

> On 21 Mar 2025, at 8:22 PM, Tamir Duberstein <tamird@gmail.com> wrote:
> 
> On Fri, Mar 21, 2025 at 10:23 AM Aditya Garg <gargaditya08@live.com> wrote:
>> 
>> 
>> Can you give me some docs for running the Kunit tests? The patch is basically a port of the original version.
> 
> I use:
> 
> tools/testing/kunit/kunit.py run --arch arm64 --make_options LLVM=1 printf
> 
> You can probably just use:
> 
> tools/testing/kunit/kunit.py run printf
> 
> It would also be useful to see raw output:
> 
> tools/testing/kunit/kunit.py run printf —raw_output


Here are the requested outputs:

--------------------------------------------------------------------------------------------------------------------------------
Failed test:

aditya@MacBook:~/kees$ python3 tools/testing/kunit/kunit.py run printf
[15:21:43] Configuring KUnit Kernel ...
Regenerating .config ...
Populating config with:
$ make ARCH=um O=.kunit olddefconfig
[15:22:19] Building KUnit Kernel ...
Populating config with:
$ make ARCH=um O=.kunit olddefconfig
Building with:
$ make all compile_commands.json ARCH=um O=.kunit --jobs=12
../lib/iomap.c:156:5: warning: no previous prototype for ‘ioread64_lo_hi’ [-Wmissing-prototypes]
  156 | u64 ioread64_lo_hi(const void __iomem *addr)
      |     ^~~~~~~~~~~~~~
../lib/iomap.c:163:5: warning: no previous prototype for ‘ioread64_hi_lo’ [-Wmissing-prototypes]
  163 | u64 ioread64_hi_lo(const void __iomem *addr)
      |     ^~~~~~~~~~~~~~
../lib/iomap.c:170:5: warning: no previous prototype for ‘ioread64be_lo_hi’ [-Wmissing-prototypes]
  170 | u64 ioread64be_lo_hi(const void __iomem *addr)
      |     ^~~~~~~~~~~~~~~~
../lib/iomap.c:178:5: warning: no previous prototype for ‘ioread64be_hi_lo’ [-Wmissing-prototypes]
  178 | u64 ioread64be_hi_lo(const void __iomem *addr)
      |     ^~~~~~~~~~~~~~~~
../lib/iomap.c:264:6: warning: no previous prototype for ‘iowrite64_lo_hi’ [-Wmissing-prototypes]
  264 | void iowrite64_lo_hi(u64 val, void __iomem *addr)
      |      ^~~~~~~~~~~~~~~
../lib/iomap.c:272:6: warning: no previous prototype for ‘iowrite64_hi_lo’ [-Wmissing-prototypes]
  272 | void iowrite64_hi_lo(u64 val, void __iomem *addr)
      |      ^~~~~~~~~~~~~~~
../lib/iomap.c:280:6: warning: no previous prototype for ‘iowrite64be_lo_hi’ [-Wmissing-prototypes]
  280 | void iowrite64be_lo_hi(u64 val, void __iomem *addr)
      |      ^~~~~~~~~~~~~~~~~
../lib/iomap.c:288:6: warning: no previous prototype for ‘iowrite64be_hi_lo’ [-Wmissing-prototypes]
  288 | void iowrite64be_hi_lo(u64 val, void __iomem *addr)
      |      ^~~~~~~~~~~~~~~~~

[15:23:28] Starting KUnit Kernel (1/1)...
[15:23:28] ============================================================
Running tests with:
$ .kunit/linux kunit.filter_glob=printf kunit.enable=1 mem=1G console=tty kunit_shutdown=halt
[15:23:28] =================== printf (28 subtests) ===================
[15:23:28] [PASSED] test_basic
[15:23:28] [PASSED] test_number
[15:23:28] [PASSED] test_string
[15:23:28] [PASSED] hash_pointer
[15:23:28] [PASSED] null_pointer
[15:23:28] [PASSED] error_pointer
[15:23:28] [PASSED] invalid_pointer
[15:23:28] [PASSED] symbol_ptr
[15:23:28] [PASSED] kernel_ptr
[15:23:28] [PASSED] struct_resource
[15:23:28] [PASSED] struct_range
[15:23:28] [PASSED] addr
[15:23:28] [PASSED] escaped_str
[15:23:28] [PASSED] hex_string
[15:23:28] [PASSED] mac
[15:23:28] [PASSED] ip4
[15:23:28] [PASSED] ip6
[15:23:28] [PASSED] uuid
[15:23:28] [PASSED] dentry
[15:23:28] [PASSED] struct_va_format
[15:23:28] [PASSED] time_and_date
[15:23:28] [PASSED] struct_clk
[15:23:28] [PASSED] bitmap
[15:23:28] [PASSED] netdev_features
[15:23:28] [PASSED] flags
[15:23:28] [PASSED] errptr
[15:23:28] [PASSED] fwnode_pointer
[15:23:28]     # fourcc_pointer: EXPECTATION FAILED at lib/tests/printf_kunit.c:56
[15:23:28] lib/tests/printf_kunit.c:715: vsnprintf(buf, 256, "%p4ch", ...) returned 6, expected 17
[15:23:28]     # fourcc_pointer: EXPECTATION FAILED at lib/tests/printf_kunit.c:56
[15:23:28] lib/tests/printf_kunit.c:715: vsnprintf(buf, 3, "%p4ch", ...) returned 6, expected 17
[15:23:28]     # fourcc_pointer: EXPECTATION FAILED at lib/tests/printf_kunit.c:56
[15:23:28] lib/tests/printf_kunit.c:715: vsnprintf(buf, 0, "%p4ch", ...) returned 6, expected 17
[15:23:28]     # fourcc_pointer: EXPECTATION FAILED at lib/tests/printf_kunit.c:141
[15:23:28] lib/tests/printf_kunit.c:715: kvasprintf(..., "%p4ch", ...) returned '(%p4?)', expected 'ABCD (0x41424344)'
[15:23:28]     # fourcc_pointer: EXPECTATION FAILED at lib/tests/printf_kunit.c:56
[15:23:28] lib/tests/printf_kunit.c:715: vsnprintf(buf, 256, "%p4cn", ...) returned 6, expected 17
[15:23:28]     # fourcc_pointer: EXPECTATION FAILED at lib/tests/printf_kunit.c:56
[15:23:28] lib/tests/printf_kunit.c:715: vsnprintf(buf, 5, "%p4cn", ...) returned 6, expected 17
[15:23:28]     # fourcc_pointer: EXPECTATION FAILED at lib/tests/printf_kunit.c:56
[15:23:28] lib/tests/printf_kunit.c:715: vsnprintf(buf, 0, "%p4cn", ...) returned 6, expected 17
[15:23:28]     # fourcc_pointer: EXPECTATION FAILED at lib/tests/printf_kunit.c:141
[15:23:28] lib/tests/printf_kunit.c:715: kvasprintf(..., "%p4cn", ...) returned '(%p4?)', expected 'DCBA (0x44434241)'
[15:23:28]     # fourcc_pointer: EXPECTATION FAILED at lib/tests/printf_kunit.c:56
[15:23:28] lib/tests/printf_kunit.c:715: vsnprintf(buf, 256, "%p4cl", ...) returned 6, expected 17
[15:23:28]     # fourcc_pointer: EXPECTATION FAILED at lib/tests/printf_kunit.c:56
[15:23:28] lib/tests/printf_kunit.c:715: vsnprintf(buf, 11, "%p4cl", ...) returned 6, expected 17
[15:23:28]     # fourcc_pointer: EXPECTATION FAILED at lib/tests/printf_kunit.c:56
[15:23:28] lib/tests/printf_kunit.c:715: vsnprintf(buf, 0, "%p4cl", ...) returned 6, expected 17
[15:23:28]     # fourcc_pointer: EXPECTATION FAILED at lib/tests/printf_kunit.c:141
[15:23:28] lib/tests/printf_kunit.c:715: kvasprintf(..., "%p4cl", ...) returned '(%p4?)', expected 'ABCD (0x41424344)'
[15:23:28]     # fourcc_pointer: EXPECTATION FAILED at lib/tests/printf_kunit.c:56
[15:23:28] lib/tests/printf_kunit.c:715: vsnprintf(buf, 256, "%p4cb", ...) returned 6, expected 17
[15:23:28]     # fourcc_pointer: EXPECTATION FAILED at lib/tests/printf_kunit.c:56
[15:23:28] lib/tests/printf_kunit.c:715: vsnprintf(buf, 16, "%p4cb", ...) returned 6, expected 17
[15:23:28]     # fourcc_pointer: EXPECTATION FAILED at lib/tests/printf_kunit.c:56
[15:23:28] lib/tests/printf_kunit.c:715: vsnprintf(buf, 0, "%p4cb", ...) returned 6, expected 17
[15:23:28]     # fourcc_pointer: EXPECTATION FAILED at lib/tests/printf_kunit.c:141
[15:23:28] lib/tests/printf_kunit.c:715: kvasprintf(..., "%p4cb", ...) returned '(%p4?)', expected 'ABCD (0x41424344)'
[15:23:28] [FAILED] fourcc_pointer
[15:23:28]     # module: printf_kunit
[15:23:28]     # printf: ran 464 tests
[15:23:28] # printf: pass:27 fail:1 skip:0 total:28
[15:23:28] # Totals: pass:27 fail:1 skip:0 total:28
[15:23:28] ===================== [FAILED] printf ======================
[15:23:28] ============================================================
[15:23:28] Testing complete. Ran 28 tests: passed: 27, failed: 1
[15:23:28] Elapsed time: 105.305s total, 36.071s configuring, 69.026s building, 0.110s running


----------------------------------------------------------------------------------------------------------------------------
Raw output

aditya@MacBook:~/kees$ tools/testing/kunit/kunit.py run printf --raw_output
[15:26:21] Configuring KUnit Kernel ...
[15:26:21] Building KUnit Kernel ...
Populating config with:
$ make ARCH=um O=.kunit olddefconfig
Building with:
$ make all compile_commands.json ARCH=um O=.kunit --jobs=12
[15:26:24] Starting KUnit Kernel (1/1)...
Running tests with:
$ .kunit/linux kunit.filter_glob=printf kunit.enable=1 mem=1G console=tty kunit_shutdown=halt
KTAP version 1
1..1
    KTAP version 1
    # Subtest: printf
    # module: printf_kunit
    1..28
    ok 1 test_basic
    ok 2 test_number
    ok 3 test_string
    ok 4 hash_pointer
    ok 5 null_pointer
    ok 6 error_pointer
    ok 7 invalid_pointer
    ok 8 symbol_ptr
    ok 9 kernel_ptr
    ok 10 struct_resource
    ok 11 struct_range
    ok 12 addr
    ok 13 escaped_str
    ok 14 hex_string
    ok 15 mac
    ok 16 ip4
    ok 17 ip6
    ok 18 uuid
    ok 19 dentry
    ok 20 struct_va_format
    ok 21 time_and_date
    ok 22 struct_clk
    ok 23 bitmap
    ok 24 netdev_features
    ok 25 flags
    ok 26 errptr
    ok 27 fwnode_pointer
    # fourcc_pointer: EXPECTATION FAILED at lib/tests/printf_kunit.c:56
lib/tests/printf_kunit.c:715: vsnprintf(buf, 256, "%p4ch", ...) returned 6, expected 17
    # fourcc_pointer: EXPECTATION FAILED at lib/tests/printf_kunit.c:56
lib/tests/printf_kunit.c:715: vsnprintf(buf, 14, "%p4ch", ...) returned 6, expected 17
    # fourcc_pointer: EXPECTATION FAILED at lib/tests/printf_kunit.c:56
lib/tests/printf_kunit.c:715: vsnprintf(buf, 0, "%p4ch", ...) returned 6, expected 17
    # fourcc_pointer: EXPECTATION FAILED at lib/tests/printf_kunit.c:141
lib/tests/printf_kunit.c:715: kvasprintf(..., "%p4ch", ...) returned '(%p4?)', expected 'ABCD (0x41424344)'
    # fourcc_pointer: EXPECTATION FAILED at lib/tests/printf_kunit.c:56
lib/tests/printf_kunit.c:715: vsnprintf(buf, 256, "%p4cn", ...) returned 6, expected 17
    # fourcc_pointer: EXPECTATION FAILED at lib/tests/printf_kunit.c:56
lib/tests/printf_kunit.c:715: vsnprintf(buf, 11, "%p4cn", ...) returned 6, expected 17
    # fourcc_pointer: EXPECTATION FAILED at lib/tests/printf_kunit.c:56
lib/tests/printf_kunit.c:715: vsnprintf(buf, 0, "%p4cn", ...) returned 6, expected 17
    # fourcc_pointer: EXPECTATION FAILED at lib/tests/printf_kunit.c:141
lib/tests/printf_kunit.c:715: kvasprintf(..., "%p4cn", ...) returned '(%p4?)', expected 'DCBA (0x44434241)'
    # fourcc_pointer: EXPECTATION FAILED at lib/tests/printf_kunit.c:56
lib/tests/printf_kunit.c:715: vsnprintf(buf, 256, "%p4cl", ...) returned 6, expected 17
    # fourcc_pointer: EXPECTATION FAILED at lib/tests/printf_kunit.c:56
lib/tests/printf_kunit.c:715: vsnprintf(buf, 3, "%p4cl", ...) returned 6, expected 17
    # fourcc_pointer: EXPECTATION FAILED at lib/tests/printf_kunit.c:56
lib/tests/printf_kunit.c:715: vsnprintf(buf, 0, "%p4cl", ...) returned 6, expected 17
    # fourcc_pointer: EXPECTATION FAILED at lib/tests/printf_kunit.c:141
lib/tests/printf_kunit.c:715: kvasprintf(..., "%p4cl", ...) returned '(%p4?)', expected 'ABCD (0x41424344)'
    # fourcc_pointer: EXPECTATION FAILED at lib/tests/printf_kunit.c:56
lib/tests/printf_kunit.c:715: vsnprintf(buf, 256, "%p4cb", ...) returned 6, expected 17
    # fourcc_pointer: EXPECTATION FAILED at lib/tests/printf_kunit.c:56
lib/tests/printf_kunit.c:715: vsnprintf(buf, 9, "%p4cb", ...) returned 6, expected 17
    # fourcc_pointer: EXPECTATION FAILED at lib/tests/printf_kunit.c:56
lib/tests/printf_kunit.c:715: vsnprintf(buf, 0, "%p4cb", ...) returned 6, expected 17
    # fourcc_pointer: EXPECTATION FAILED at lib/tests/printf_kunit.c:141
lib/tests/printf_kunit.c:715: kvasprintf(..., "%p4cb", ...) returned '(%p4?)', expected 'ABCD (0x41424344)'
    not ok 28 fourcc_pointer
    # printf: ran 464 tests
# printf: pass:27 fail:1 skip:0 total:28
# Totals: pass:27 fail:1 skip:0 total:28
not ok 1 printf
[15:26:24] Elapsed time: 2.649s total, 0.001s configuring, 2.583s building, 0.060s running


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] printf: add tests for generic FourCCs
  2025-03-22 10:04       ` Aditya Garg
@ 2025-03-22 13:30         ` Tamir Duberstein
  0 siblings, 0 replies; 10+ messages in thread
From: Tamir Duberstein @ 2025-03-22 13:30 UTC (permalink / raw)
  To: Aditya Garg
  Cc: Kees Cook, Petr Mladek, Steven Rostedt, Andy Shevchenko,
	Rasmus Villemoes, Sergey Senozhatsky, Linux Kernel Mailing List

On Sat, Mar 22, 2025 at 6:04 AM Aditya Garg <gargaditya08@live.com> wrote:
>
> Hi
>
> > On 21 Mar 2025, at 8:22 PM, Tamir Duberstein <tamird@gmail.com> wrote:
> >
> > On Fri, Mar 21, 2025 at 10:23 AM Aditya Garg <gargaditya08@live.com> wrote:
> >>
> >>
> >> Can you give me some docs for running the Kunit tests? The patch is basically a port of the original version.
> >
> > I use:
> >
> > tools/testing/kunit/kunit.py run --arch arm64 --make_options LLVM=1 printf
> >
> > You can probably just use:
> >
> > tools/testing/kunit/kunit.py run printf
> >
> > It would also be useful to see raw output:
> >
> > tools/testing/kunit/kunit.py run printf —raw_output
>
>
> Here are the requested outputs:
>
> --------------------------------------------------------------------------------------------------------------------------------
> Failed test:
>
> [...]

OK, it's not great but no worse than before.

Acked-by: Tamir Duberstein <tamird@gmail.com>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] printf: add tests for generic FourCCs
  2025-03-14  3:45 [PATCH] printf: add tests for generic FourCCs Aditya Garg
  2025-03-21 14:10 ` Andy Shevchenko
  2025-03-21 14:16 ` Tamir Duberstein
@ 2025-03-25 19:48 ` Kees Cook
  2025-03-26  0:26   ` Aditya Garg
  2 siblings, 1 reply; 10+ messages in thread
From: Kees Cook @ 2025-03-25 19:48 UTC (permalink / raw)
  To: Aditya Garg
  Cc: tamird@gmail.com, Petr Mladek, Steven Rostedt, Andy Shevchenko,
	Rasmus Villemoes, Sergey Senozhatsky, Linux Kernel Mailing List

On Fri, Mar 14, 2025 at 03:45:01AM +0000, Aditya Garg wrote:
> From: Aditya Garg <gargaditya08@live.com>
> 
> Format specifiers for printing generic 32-bit FourCCs were recently added
> to vsprintf. They are going through the DRM tree alongwith the appletbdrm
> driver. Since the printf tests are being converted to kunit, this separate
> patch for the tests should make it easier to rebase when the merge window
> opens.
> 
> Link: https://lore.kernel.org/dri-devel/79FA3F41-FD7A-41D9-852B-D32606AF5EB4@live.com/T/#u
> Signed-off-by: Aditya Garg <gargaditya08@live.com>
> ---
>  lib/tests/printf_kunit.c | 39 ++++++++++++++++++++++++++++++++-------

Linus has applied the kunit /lib move tree, so this patch can land via
regular trees now. Who should take it?

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] printf: add tests for generic FourCCs
  2025-03-25 19:48 ` Kees Cook
@ 2025-03-26  0:26   ` Aditya Garg
  2025-03-27  9:57     ` Petr Mladek
  0 siblings, 1 reply; 10+ messages in thread
From: Aditya Garg @ 2025-03-26  0:26 UTC (permalink / raw)
  To: Kees Cook
  Cc: tamird@gmail.com, Petr Mladek, Steven Rostedt, Andy Shevchenko,
	Rasmus Villemoes, Sergey Senozhatsky, Linux Kernel Mailing List



> On 26 Mar 2025, at 1:19 AM, Kees Cook <kees@kernel.org> wrote:
> 
> On Fri, Mar 14, 2025 at 03:45:01AM +0000, Aditya Garg wrote:
>> From: Aditya Garg <gargaditya08@live.com>
>> 
>> Format specifiers for printing generic 32-bit FourCCs were recently added
>> to vsprintf. They are going through the DRM tree alongwith the appletbdrm
>> driver. Since the printf tests are being converted to kunit, this separate
>> patch for the tests should make it easier to rebase when the merge window
>> opens.
>> 
>> Link: https://lore.kernel.org/dri-devel/79FA3F41-FD7A-41D9-852B-D32606AF5EB4@live.com/T/#u
>> Signed-off-by: Aditya Garg <gargaditya08@live.com>
>> ---
>> lib/tests/printf_kunit.c | 39 ++++++++++++++++++++++++++++++++-------
> 
> Linus has applied the kunit /lib move tree, so this patch can land via
> regular trees now. Who should take it?

For some reason DRM has not taken up the patch set yet, even after approvals.
I assume it's partly because gitlab.freedesktop.org was down for a whole week.
Now that merge window is open, I myself dunno what is gonna happen with those patches.
Also, I doubt DRM wants to take this up later. So, I have 2 options:

1. Just wait a bit more, probably till merge window settles so that DRM can take up those patches and then you take this one up.
2. I'll just send you the non DRM patch, and upstream it via you so that atleast you can get free. Then. I'll tell DRM to just upstream the DRM relevant patch, again after merge windows settles. The patch is anyways a bug fix, rather than something new.

Choice is yours :)
> 
> --
> Kees Cook

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] printf: add tests for generic FourCCs
  2025-03-26  0:26   ` Aditya Garg
@ 2025-03-27  9:57     ` Petr Mladek
  0 siblings, 0 replies; 10+ messages in thread
From: Petr Mladek @ 2025-03-27  9:57 UTC (permalink / raw)
  To: Aditya Garg
  Cc: Kees Cook, tamird@gmail.com, Steven Rostedt, Andy Shevchenko,
	Rasmus Villemoes, Sergey Senozhatsky, Linux Kernel Mailing List

On Wed 2025-03-26 00:26:08, Aditya Garg wrote:
> 
> 
> > On 26 Mar 2025, at 1:19 AM, Kees Cook <kees@kernel.org> wrote:
> > 
> > On Fri, Mar 14, 2025 at 03:45:01AM +0000, Aditya Garg wrote:
> >> From: Aditya Garg <gargaditya08@live.com>
> >> 
> >> Format specifiers for printing generic 32-bit FourCCs were recently added
> >> to vsprintf. They are going through the DRM tree alongwith the appletbdrm
> >> driver. Since the printf tests are being converted to kunit, this separate
> >> patch for the tests should make it easier to rebase when the merge window
> >> opens.
> >> 
> >> Link: https://lore.kernel.org/dri-devel/79FA3F41-FD7A-41D9-852B-D32606AF5EB4@live.com/T/#u
> >> Signed-off-by: Aditya Garg <gargaditya08@live.com>
> >> ---
> >> lib/tests/printf_kunit.c | 39 ++++++++++++++++++++++++++++++++-------
> > 
> > Linus has applied the kunit /lib move tree, so this patch can land via
> > regular trees now. Who should take it?
> 
> For some reason DRM has not taken up the patch set yet, even after approvals.
> I assume it's partly because gitlab.freedesktop.org was down for a whole week.
> Now that merge window is open, I myself dunno what is gonna happen with those patches.
> Also, I doubt DRM wants to take this up later. So, I have 2 options:
> 
> 1. Just wait a bit more, probably till merge window settles so that DRM can take up those patches and then you take this one up.
> 2. I'll just send you the non DRM patch, and upstream it via you so that atleast you can get free. Then. I'll tell DRM to just upstream the DRM relevant patch, again after merge windows settles. The patch is anyways a bug fix, rather than something new.

I prefer the first solution. I'll take this patch after the already
queued patches reach the mainline.

Best Regards,
Petr

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2025-03-27  9:57 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-14  3:45 [PATCH] printf: add tests for generic FourCCs Aditya Garg
2025-03-21 14:10 ` Andy Shevchenko
2025-03-21 14:16 ` Tamir Duberstein
2025-03-21 14:23   ` Aditya Garg
2025-03-21 14:52     ` Tamir Duberstein
2025-03-22 10:04       ` Aditya Garg
2025-03-22 13:30         ` Tamir Duberstein
2025-03-25 19:48 ` Kees Cook
2025-03-26  0:26   ` Aditya Garg
2025-03-27  9:57     ` Petr Mladek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox