On Mon, Jun 02, 2025 at 10:24:17AM +0300, Dan Carpenter wrote:
I like suppressing warning messages but there are still many cases, such as mm/kasan/kasan_test_c.c where printing the warning message is the whole point.
We should create a standard way that test bots can filter out deliberate errors from unintentional errors. This would also help humans who have to look at test results.
#define intentional_warning_marker(type) do { \ pr_err("Triggering intentional %s warning!", type); \ } while (0)
intentional_warning_marker("KASAN");
I understand what your usecase is, and would definitely appreciate something like that too, but I don't think this is the right way to do it.
Once we have the basic infrastructure in place to flag which warnings are legitimate and which aren't, I believe a better way to achieve what you're asking for would be to treat as failures any warning with a WARN, and any test expecting a warn that didn't trigger any.
This would bring kunit on par with pretty much every other unit test frameworks out there, and would make it pretty obvious to any users (CI and humans) when it works and when it doesn't.
Maxime