diff mbox series

[1/1] of: unittest: update text of expected warnings

Message ID 20220127192643.2534941-1-frowand.list@gmail.com
State New
Headers show
Series [1/1] of: unittest: update text of expected warnings | expand

Commit Message

Frank Rowand Jan. 27, 2022, 7:26 p.m. UTC
From: Frank Rowand <frank.rowand@sony.com>

The text of various warning messages triggered by unittest has
changed.  Update the text of expected warnings to match.

The expected vs actual warnings are most easily seen by filtering
the boot console messages with the of_unittest_expect program at
https://github.com/frowand/dt_tools.git.  The filter prefixes
problem lines with '***', and prefixes lines that match expected
errors with 'ok '.  All other lines are prefixed with '   '.
Unrelated lines have been deleted in the following examples.

The mismatch appears as:

-> ### dt-test ### start of unittest - you will see error messages
      OF: /testcase-data/phandle-tests/consumer-a: #phandle-cells = 3 found 1
   ** of_unittest_expect WARNING - not found ---> OF: /testcase-data/phandle-tests/consumer-a: #phandle-cells = 3 found -1
      OF: /testcase-data/phandle-tests/consumer-a: #phandle-cells = 3 found 1
   ** of_unittest_expect WARNING - not found ---> OF: /testcase-data/phandle-tests/consumer-a: #phandle-cells = 3 found -1
      OF: /testcase-data/phandle-tests/consumer-b: #phandle-cells = 2 found 1
   ** of_unittest_expect WARNING - not found ---> OF: /testcase-data/phandle-tests/consumer-b: #phandle-cells = 2 found -1
      platform testcase-data:testcase-device2: error -ENXIO: IRQ index 0 not found
   ** of_unittest_expect WARNING - not found ---> platform testcase-data:testcase-device2: IRQ index 0 not found
   -> ### dt-test ### end of unittest - 254 passed, 0 failed
   ** EXPECT statistics:
   **
   **   EXPECT found          :   42
   **   EXPECT not found      :    4

With this commit applied, the mismatch is resolved:

   -> ### dt-test ### start of unittest - you will see error messages
   ok OF: /testcase-data/phandle-tests/consumer-a: #phandle-cells = 3 found 1
   ok OF: /testcase-data/phandle-tests/consumer-a: #phandle-cells = 3 found 1
   ok OF: /testcase-data/phandle-tests/consumer-b: #phandle-cells = 2 found 1
   ok platform testcase-data:testcase-device2: error -ENXIO: IRQ index 0 not found
   -> ### dt-test ### end of unittest - 254 passed, 0 failed
   ** EXPECT statistics:
   **
   **   EXPECT found          :   46
   **   EXPECT not found      :    0

Fixes: 2043727c2882 ("driver core: platform: Make use of the helper function dev_err_probe()")
Fixes: 94a4950a4acf ("of: base: Fix phandle argument length mismatch error message")
Signed-off-by: Frank Rowand <frank.rowand@sony.com>
---
 drivers/of/unittest.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

Comments

Rob Herring Jan. 31, 2022, 2:35 p.m. UTC | #1
On Thu, 27 Jan 2022 13:26:43 -0600, frowand.list@gmail.com wrote:
> From: Frank Rowand <frank.rowand@sony.com>
> 
> The text of various warning messages triggered by unittest has
> changed.  Update the text of expected warnings to match.
> 
> The expected vs actual warnings are most easily seen by filtering
> the boot console messages with the of_unittest_expect program at
> https://github.com/frowand/dt_tools.git.  The filter prefixes
> problem lines with '***', and prefixes lines that match expected
> errors with 'ok '.  All other lines are prefixed with '   '.
> Unrelated lines have been deleted in the following examples.
> 
> The mismatch appears as:
> 
> -> ### dt-test ### start of unittest - you will see error messages
>       OF: /testcase-data/phandle-tests/consumer-a: #phandle-cells = 3 found 1
>    ** of_unittest_expect WARNING - not found ---> OF: /testcase-data/phandle-tests/consumer-a: #phandle-cells = 3 found -1
>       OF: /testcase-data/phandle-tests/consumer-a: #phandle-cells = 3 found 1
>    ** of_unittest_expect WARNING - not found ---> OF: /testcase-data/phandle-tests/consumer-a: #phandle-cells = 3 found -1
>       OF: /testcase-data/phandle-tests/consumer-b: #phandle-cells = 2 found 1
>    ** of_unittest_expect WARNING - not found ---> OF: /testcase-data/phandle-tests/consumer-b: #phandle-cells = 2 found -1
>       platform testcase-data:testcase-device2: error -ENXIO: IRQ index 0 not found
>    ** of_unittest_expect WARNING - not found ---> platform testcase-data:testcase-device2: IRQ index 0 not found
>    -> ### dt-test ### end of unittest - 254 passed, 0 failed
>    ** EXPECT statistics:
>    **
>    **   EXPECT found          :   42
>    **   EXPECT not found      :    4
> 
> With this commit applied, the mismatch is resolved:
> 
>    -> ### dt-test ### start of unittest - you will see error messages
>    ok OF: /testcase-data/phandle-tests/consumer-a: #phandle-cells = 3 found 1
>    ok OF: /testcase-data/phandle-tests/consumer-a: #phandle-cells = 3 found 1
>    ok OF: /testcase-data/phandle-tests/consumer-b: #phandle-cells = 2 found 1
>    ok platform testcase-data:testcase-device2: error -ENXIO: IRQ index 0 not found
>    -> ### dt-test ### end of unittest - 254 passed, 0 failed
>    ** EXPECT statistics:
>    **
>    **   EXPECT found          :   46
>    **   EXPECT not found      :    0
> 
> Fixes: 2043727c2882 ("driver core: platform: Make use of the helper function dev_err_probe()")
> Fixes: 94a4950a4acf ("of: base: Fix phandle argument length mismatch error message")
> Signed-off-by: Frank Rowand <frank.rowand@sony.com>
> ---
>  drivers/of/unittest.c | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 

Applied, thanks!
Frank Rowand Feb. 1, 2022, 6:23 p.m. UTC | #2
On 1/31/22 9:04 AM, Rob Herring wrote:
> On Thu, Jan 27, 2022 at 1:26 PM <frowand.list@gmail.com> wrote:
>>
>> From: Frank Rowand <frank.rowand@sony.com>
>>
>> The text of various warning messages triggered by unittest has
>> changed.  Update the text of expected warnings to match.
>>
>> The expected vs actual warnings are most easily seen by filtering
>> the boot console messages with the of_unittest_expect program at
>> https://github.com/frowand/dt_tools.git.  The filter prefixes
> 
> News to me there's such a tool. Normally, I just give up staring at
> the wall of text spewed out and check failures. Can we add this tool
> to the kernel tree? Then there might be some hope that I'll run it.

I cleaned it up and submitted a patch.

-Frank

> 
> Rob
>
diff mbox series

Patch

diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c
index 70992103c07d..2c2fb161b572 100644
--- a/drivers/of/unittest.c
+++ b/drivers/of/unittest.c
@@ -513,24 +513,24 @@  static void __init of_unittest_parse_phandle_with_args(void)
 	memset(&args, 0, sizeof(args));
 
 	EXPECT_BEGIN(KERN_INFO,
-		     "OF: /testcase-data/phandle-tests/consumer-a: #phandle-cells = 3 found -1");
+		     "OF: /testcase-data/phandle-tests/consumer-a: #phandle-cells = 3 found 1");
 
 	rc = of_parse_phandle_with_args(np, "phandle-list-bad-args",
 					"#phandle-cells", 1, &args);
 
 	EXPECT_END(KERN_INFO,
-		   "OF: /testcase-data/phandle-tests/consumer-a: #phandle-cells = 3 found -1");
+		   "OF: /testcase-data/phandle-tests/consumer-a: #phandle-cells = 3 found 1");
 
 	unittest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc);
 
 	EXPECT_BEGIN(KERN_INFO,
-		     "OF: /testcase-data/phandle-tests/consumer-a: #phandle-cells = 3 found -1");
+		     "OF: /testcase-data/phandle-tests/consumer-a: #phandle-cells = 3 found 1");
 
 	rc = of_count_phandle_with_args(np, "phandle-list-bad-args",
 					"#phandle-cells");
 
 	EXPECT_END(KERN_INFO,
-		   "OF: /testcase-data/phandle-tests/consumer-a: #phandle-cells = 3 found -1");
+		   "OF: /testcase-data/phandle-tests/consumer-a: #phandle-cells = 3 found 1");
 
 	unittest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc);
 }
@@ -670,12 +670,12 @@  static void __init of_unittest_parse_phandle_with_args_map(void)
 	memset(&args, 0, sizeof(args));
 
 	EXPECT_BEGIN(KERN_INFO,
-		     "OF: /testcase-data/phandle-tests/consumer-b: #phandle-cells = 2 found -1");
+		     "OF: /testcase-data/phandle-tests/consumer-b: #phandle-cells = 2 found 1");
 
 	rc = of_parse_phandle_with_args_map(np, "phandle-list-bad-args",
 					    "phandle", 1, &args);
 	EXPECT_END(KERN_INFO,
-		   "OF: /testcase-data/phandle-tests/consumer-b: #phandle-cells = 2 found -1");
+		   "OF: /testcase-data/phandle-tests/consumer-b: #phandle-cells = 2 found 1");
 
 	unittest(rc == -EINVAL, "expected:%i got:%i\n", -EINVAL, rc);
 }
@@ -1257,12 +1257,12 @@  static void __init of_unittest_platform_populate(void)
 		unittest(pdev, "device 2 creation failed\n");
 
 		EXPECT_BEGIN(KERN_INFO,
-			     "platform testcase-data:testcase-device2: IRQ index 0 not found");
+			     "platform testcase-data:testcase-device2: error -ENXIO: IRQ index 0 not found");
 
 		irq = platform_get_irq(pdev, 0);
 
 		EXPECT_END(KERN_INFO,
-			   "platform testcase-data:testcase-device2: IRQ index 0 not found");
+			   "platform testcase-data:testcase-device2: error -ENXIO: IRQ index 0 not found");
 
 		unittest(irq < 0 && irq != -EPROBE_DEFER,
 			 "device parsing error failed - %d\n", irq);