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