On 9/25/25 02:44, Daniel P. Berrangé wrote:
The current unit tests rely on monitor.o not being linked, such
that the monitor stubs get linked instead. Since error_vprintf
is in monitor.o this allows a stub error_vprintf impl to be used
that calls g_test_message.

This takes a different approach, with error_vprintf moving
back to error-report.c such that it is always linked into the
tests. The monitor_vprintf() stub is then changed to use
g_test_message if QTEST_SLENT_ERROS is set, otherwise it will
return -1 and trigger error_vprintf to call vfprintf.

The end result is functionally equivalent for the purposes of
the unit tests.

Signed-off-by: Daniel P. Berrangé <[email protected]>
---
  monitor/monitor.c    | 15 ---------------
  stubs/error-printf.c | 18 ------------------
  stubs/meson.build    |  1 -
  stubs/monitor-core.c | 14 +++++++++++++-
  util/error-report.c  | 15 +++++++++++++++
  5 files changed, 28 insertions(+), 35 deletions(-)
  delete mode 100644 stubs/error-printf.c

Reviewed-by: Richard Henderson <[email protected]>


r~

Reply via email to