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