diff mbox series

tests: reset WARN_ON_ONCE() state in the kernel

Message ID 20231212090714.717fa2663ceb.Ifcae9f7f54c2a68f95205714a7778c5b3888860a@changeid
State Accepted
Headers show
Series tests: reset WARN_ON_ONCE() state in the kernel | expand

Commit Message

Johannes Berg Dec. 12, 2023, 8:07 a.m. UTC
From: Johannes Berg <johannes.berg@intel.com>

If a tests hits a WARN_ON_ONCE then the retriggering will
make it appear to pass, since the warning will not happen
again. Make this more reliable by resetting the states at
the beginning of each test.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
 tests/hwsim/run-tests.py | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Jouni Malinen Dec. 12, 2023, 7:31 p.m. UTC | #1
On Tue, Dec 12, 2023 at 09:07:15AM +0100, Johannes Berg wrote:
> If a tests hits a WARN_ON_ONCE then the retriggering will
> make it appear to pass, since the warning will not happen
> again. Make this more reliable by resetting the states at
> the beginning of each test.

Thanks, applied.
diff mbox series

Patch

diff --git a/tests/hwsim/run-tests.py b/tests/hwsim/run-tests.py
index 0d69f303c103..30368a97ab96 100755
--- a/tests/hwsim/run-tests.py
+++ b/tests/hwsim/run-tests.py
@@ -487,6 +487,12 @@  def main():
             log_handler.setFormatter(log_formatter)
             logger.addHandler(log_handler)
 
+        try:
+            with open('/sys/kernel/debug/clear_warn_once', 'w') as f:
+                f.write('1\n')
+        except FileNotFoundError:
+            pass
+
         reset_ok = True
         with DataCollector(args.logdir, name, args):
             count = count + 1