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