summary refs log tree commit diff stats
path: root/stubs/error-printf.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2016-10-24 18:31:03 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2016-11-01 16:06:57 +0100
commit28017e010ddf6849cfa830e898da3e44e6610952 (patch)
tree3d2b4bceafd395226e7f183416ebf0eb5ae9264a /stubs/error-printf.c
parent397d30e9401d2da96dbdf0ce49805d6d4bb68833 (diff)
downloadfocaccia-qemu-28017e010ddf6849cfa830e898da3e44e6610952.tar.gz
focaccia-qemu-28017e010ddf6849cfa830e898da3e44e6610952.zip
tests: send error_report to test log
Implement error_vprintf to send the output of error_report to
the test log.  This silences test-vmstate.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <1477326663-67817-3-git-send-email-pbonzini@redhat.com>
Diffstat (limited to 'stubs/error-printf.c')
-rw-r--r--stubs/error-printf.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/stubs/error-printf.c b/stubs/error-printf.c
index 56379e648d..ac6b92aa69 100644
--- a/stubs/error-printf.c
+++ b/stubs/error-printf.c
@@ -4,7 +4,13 @@
 
 void error_vprintf(const char *fmt, va_list ap)
 {
-    vfprintf(stderr, fmt, ap);
+    if (g_test_initialized() && !g_test_subprocess()) {
+        char *msg = g_strdup_vprintf(fmt, ap);
+        g_test_message("%s", msg);
+        g_free(msg);
+    } else {
+        vfprintf(stderr, fmt, ap);
+    }
 }
 
 void error_vprintf_unless_qmp(const char *fmt, va_list ap)