diff mbox series

kunit: tool: catch warnings generated by the kernel

Message ID 0-v1-60207444aa55+22-kunit_panic_warn_jgg@nvidia.com (mailing list archive)
State New
Delegated to: Brendan Higgins
Headers show
Series kunit: tool: catch warnings generated by the kernel | expand

Commit Message

Jason Gunthorpe Oct. 18, 2024, 4:31 p.m. UTC
If the kunit being run generates a WARN for some reason kunit.py ignores it
and declares the tested PASSED. This is very much not desirable, as tests that
are hitting WARN's are probably actually failing.

Take the simple approach to reducing this by setting panic_on_warn when
running the kernel. The kernel crashes and kunit.py shows the WARN and reports
the test fails.

Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
---
 tools/testing/kunit/kunit_kernel.py | 2 ++
 1 file changed, 2 insertions(+)

I saw there was an earlier series working to make tests that deliberately made
WARNs not do that, so this would be consistent with that idea, tests should not
make WARNs, and WARNs should not be ignored..


base-commit: 2872987b1d009df556c0061ecdeede6a5f9bf42c
diff mbox series

Patch

diff --git a/tools/testing/kunit/kunit_kernel.py b/tools/testing/kunit/kunit_kernel.py
index 61931c4926fd66..7a4228568dd73c 100644
--- a/tools/testing/kunit/kunit_kernel.py
+++ b/tools/testing/kunit/kunit_kernel.py
@@ -342,6 +342,8 @@  class LinuxSourceTree:
 		if filter_action:
 			args.append('kunit.filter_action=' + filter_action)
 		args.append('kunit.enable=1')
+		args.append('panic_on_warn=1')
+		args.append('panic=-1')
 
 		process = self._ops.start(args, build_dir)
 		assert process.stdout is not None  # tell mypy it's set