Hi Jerome, On 2026-10-27T16:02:12, Jerome Forissier <[email protected]> wrote: > test: Add helpers to preserve console silence state > > Some tests intentionally trigger diagnostics that the Python console > parser treats as unexpected errors. > > Add helpers that silence these diagnostics while preserving the previous > console state, allowing tests to hide expected errors without accessing > global data directly. > > Signed-off-by: Jerome Forissier <[email protected]> > > include/test/ut.h | 17 +++++++++++++++++ > test/ut.c | 15 +++++++++++++++ > 2 files changed, 32 insertions(+)
> diff --git a/include/test/ut.h b/include/test/ut.h > @@ -549,6 +549,23 @@ long ut_check_delta(ulong last); > +/** > + * ut_silence_console_force() - Unconditionally silence the console > + * > + * This silences the console even when U-Boot is started with the sandbox -v > + * option. > + * > + * Return: true if the console was already silent > + */ > +bool ut_silence_console_force(void); My understanding is that you need the 'force' variant because test/py always starts sandbox with -v (see console_sandbox.py), so ut_silence_console() never takes effect under pytest. The downside is that it also hides the output when someone runs the test by hand with -v to debug it, which is exactly when they want to see it! Expected errors are normally handled on the Python side with ubman.disable_check(), or the test avoids printing a line that matches a bad pattern. If the C test must stay quiet, it would be worth checking the expected output with console recording and ut_assert_nextline(), since recording still works while the console is silent. If we really need this, it might be better to change the signature of the existing ut_silence_console() and ut_unsilence_console() rather than adding a second pair alongside them. What do you think? Regards, Simon
