lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220203211150.2912192-1-frowand.list@gmail.com>
Date:   Thu,  3 Feb 2022 15:11:50 -0600
From:   frowand.list@...il.com
To:     Rob Herring <robh+dt@...nel.org>
Cc:     Naresh Kamboju <naresh.kamboju@...aro.org>,
        Brendan Higgins <brendanhiggins@...gle.com>,
        Anders Roxell <anders.roxell@...aro.org>,
        devicetree@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH 1/1] of: unittest: print pass messages at same loglevel as fail

From: Frank Rowand <frank.rowand@...y.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.

Change default to print the pass messages at the same loglevel as
the fail messages.

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.

Suppressing printing the pass message for each individual test is
available via the kernel command line parameter unittest.hide_pass.

Signed-off-by: Frank Rowand <frank.rowand@...y.com>
---
 Documentation/admin-guide/kernel-parameters.txt |  4 ++++
 drivers/of/unittest.c                           | 17 ++++++++++++++++-
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index f5a27f067db9..045455f9b7e1 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -5997,6 +5997,10 @@
 			Note that genuine overcurrent events won't be
 			reported either.
 
+	unittest.hide_pass
+			Disable printing individual drivers/of/unittest test
+			pass messages.
+
 	unknown_nmi_panic
 			[X86] Cause panic on unknown NMI.
 
diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c
index 70992103c07d..2cfbdc6b29ac 100644
--- a/drivers/of/unittest.c
+++ b/drivers/of/unittest.c
@@ -12,6 +12,7 @@
 #include <linux/errno.h>
 #include <linux/hashtable.h>
 #include <linux/libfdt.h>
+#include <linux/module.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
 #include <linux/of_fdt.h>
@@ -32,6 +33,19 @@
 
 #include "of_private.h"
 
+MODULE_LICENSE("GPL v2");
+static bool hide_pass;
+
+static int __init hide_pass_setup(char *str)
+{
+	hide_pass = true;
+	return 0;
+}
+
+early_param("hide_pass", hide_pass_setup);
+module_param(hide_pass, bool, 0);
+MODULE_PARM_DESC(hide_pass, "Disable printing individual of unittest pass messages");
+
 static struct unittest_results {
 	int passed;
 	int failed;
@@ -44,7 +58,8 @@ 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 (!hide_pass) \
+			pr_err("pass %s():%i\n", __func__, __LINE__); \
 	} \
 	failed; \
 })
-- 
Frank Rowand <frank.rowand@...y.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ