linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] of: unittest: config option - print pass message at same level as fail
@ 2022-02-02 19:45 frowand.list
  2022-02-03 21:23 ` Frank Rowand
  0 siblings, 1 reply; 2+ messages in thread
From: frowand.list @ 2022-02-02 19:45 UTC (permalink / raw)
  To: Rob Herring
  Cc: Naresh Kamboju, Brendan Higgins, Anders Roxell, devicetree, linux-kernel

From: Frank Rowand <frank.rowand@sony.com>

Printing the devicetree unittest pass message for each passed test
creates much console verbosity.  The existing pass messages are
printed at loglevel KERN_DEBUG so they will not print by default.

The test community expects either a pass or a fail message for each
test in a test suite.  The messages are typically post-processed to
report pass/fail results.

The pass messages can currently be reported by enabling KERN_DEBUG
loglevel for the console, but this also results in other additional
messages.  Create OF_UNITTEST_SHOW_PASS to enable printing the pass
messages at the same loglevel as the fail messages.

Signed-off-by: Frank Rowand <frank.rowand@sony.com>
---
 drivers/of/Kconfig    | 10 ++++++++++
 drivers/of/unittest.c |  5 ++++-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig
index 80b5fd44ab1c..6ad05df4f7d4 100644
--- a/drivers/of/Kconfig
+++ b/drivers/of/Kconfig
@@ -25,6 +25,16 @@ config OF_UNITTEST
 
 	  If unsure, say N here, but this option is safe to enable.
 
+config OF_UNITTEST_SHOW_PASS
+	bool "Device Tree runtime unit tests, report each pass"
+	depends on OF_UNITTEST
+	help
+	  The messages reporting an individual test pass are normally
+	  printed at loglevel KERN_DEBUG.  Enable this option to print
+	  the PASS messages at the same loglevel as the FAIL messages.
+
+	  If unsure, say N here, but this option is safe to enable.
+
 config OF_ALL_DTBS
 	bool "Build all Device Tree Blobs"
 	depends on COMPILE_TEST
diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c
index 70992103c07d..efcec1c6c895 100644
--- a/drivers/of/unittest.c
+++ b/drivers/of/unittest.c
@@ -44,7 +44,10 @@ static struct unittest_results {
 		pr_err("FAIL %s():%i " fmt, __func__, __LINE__, ##__VA_ARGS__); \
 	} else { \
 		unittest_results.passed++; \
-		pr_debug("pass %s():%i\n", __func__, __LINE__); \
+		if (IS_ENABLED(CONFIG_OF_UNITTEST_SHOW_PASS)) \
+			pr_err("pass %s():%i\n", __func__, __LINE__); \
+		else \
+			pr_debug("pass %s():%i\n", __func__, __LINE__); \
 	} \
 	failed; \
 })
-- 
Frank Rowand <frank.rowand@sony.com>


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

* Re: [PATCH 1/1] of: unittest: config option - print pass message at same level as fail
  2022-02-02 19:45 [PATCH 1/1] of: unittest: config option - print pass message at same level as fail frowand.list
@ 2022-02-03 21:23 ` Frank Rowand
  0 siblings, 0 replies; 2+ messages in thread
From: Frank Rowand @ 2022-02-03 21:23 UTC (permalink / raw)
  To: Rob Herring
  Cc: Naresh Kamboju, Brendan Higgins, Anders Roxell, devicetree, linux-kernel

On 2/2/22 1:45 PM, frowand.list@gmail.com wrote:
> From: Frank Rowand <frank.rowand@sony.com>
> 
> Printing the devicetree unittest pass message for each passed test
> creates much console verbosity.  The existing pass messages are
> printed at loglevel KERN_DEBUG so they will not print by default.
> 
> The test community expects either a pass or a fail message for each
> test in a test suite.  The messages are typically post-processed to
> report pass/fail results.
> 
> The pass messages can currently be reported by enabling KERN_DEBUG
> loglevel for the console, but this also results in other additional
> messages.  Create OF_UNITTEST_SHOW_PASS to enable printing the pass
> messages at the same loglevel as the fail messages.

This approach was NAKed in the email thread that was discussing the
desire to print pass messages for individual unitttest tests.  The
key reason being that additional kernel CONFIG options have some
downsides.

So consider this patch dead.

Another patch has been submitted using a different approach.

-Frank

> 
> Signed-off-by: Frank Rowand <frank.rowand@sony.com>
> ---
>  drivers/of/Kconfig    | 10 ++++++++++
>  drivers/of/unittest.c |  5 ++++-
>  2 files changed, 14 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig
> index 80b5fd44ab1c..6ad05df4f7d4 100644
> --- a/drivers/of/Kconfig
> +++ b/drivers/of/Kconfig
> @@ -25,6 +25,16 @@ config OF_UNITTEST
>  
>  	  If unsure, say N here, but this option is safe to enable.
>  
> +config OF_UNITTEST_SHOW_PASS
> +	bool "Device Tree runtime unit tests, report each pass"
> +	depends on OF_UNITTEST
> +	help
> +	  The messages reporting an individual test pass are normally
> +	  printed at loglevel KERN_DEBUG.  Enable this option to print
> +	  the PASS messages at the same loglevel as the FAIL messages.
> +
> +	  If unsure, say N here, but this option is safe to enable.
> +
>  config OF_ALL_DTBS
>  	bool "Build all Device Tree Blobs"
>  	depends on COMPILE_TEST
> diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c
> index 70992103c07d..efcec1c6c895 100644
> --- a/drivers/of/unittest.c
> +++ b/drivers/of/unittest.c
> @@ -44,7 +44,10 @@ static struct unittest_results {
>  		pr_err("FAIL %s():%i " fmt, __func__, __LINE__, ##__VA_ARGS__); \
>  	} else { \
>  		unittest_results.passed++; \
> -		pr_debug("pass %s():%i\n", __func__, __LINE__); \
> +		if (IS_ENABLED(CONFIG_OF_UNITTEST_SHOW_PASS)) \
> +			pr_err("pass %s():%i\n", __func__, __LINE__); \
> +		else \
> +			pr_debug("pass %s():%i\n", __func__, __LINE__); \
>  	} \
>  	failed; \
>  })
> 


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

end of thread, other threads:[~2022-02-03 21:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-02 19:45 [PATCH 1/1] of: unittest: config option - print pass message at same level as fail frowand.list
2022-02-03 21:23 ` Frank Rowand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).