2016-10-24 19:31:02 +03:00
|
|
|
#include "qemu/osdep.h"
|
|
|
|
#include "qemu-common.h"
|
|
|
|
#include "qemu/error-report.h"
|
|
|
|
|
2019-04-17 22:06:36 +03:00
|
|
|
int error_vprintf(const char *fmt, va_list ap)
|
2016-10-24 19:31:02 +03:00
|
|
|
{
|
2019-04-17 22:06:36 +03:00
|
|
|
int ret;
|
|
|
|
|
2018-07-18 11:34:47 +03:00
|
|
|
if (g_test_initialized() && !g_test_subprocess() &&
|
|
|
|
getenv("QTEST_SILENT_ERRORS")) {
|
2016-10-24 19:31:03 +03:00
|
|
|
char *msg = g_strdup_vprintf(fmt, ap);
|
|
|
|
g_test_message("%s", msg);
|
2019-04-17 22:06:36 +03:00
|
|
|
ret = strlen(msg);
|
2016-10-24 19:31:03 +03:00
|
|
|
g_free(msg);
|
2019-04-17 22:06:36 +03:00
|
|
|
return ret;
|
2016-10-24 19:31:03 +03:00
|
|
|
}
|
2019-04-17 22:06:36 +03:00
|
|
|
return vfprintf(stderr, fmt, ap);
|
2016-10-24 19:31:02 +03:00
|
|
|
}
|
|
|
|
|
2019-04-17 22:06:36 +03:00
|
|
|
int error_vprintf_unless_qmp(const char *fmt, va_list ap)
|
2016-10-24 19:31:02 +03:00
|
|
|
{
|
2019-04-17 22:06:36 +03:00
|
|
|
return error_vprintf(fmt, ap);
|
2016-10-24 19:31:02 +03:00
|
|
|
}
|