aboutsummaryrefslogtreecommitdiff
path: root/tests/unit
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2023-02-21 16:47:50 +0400
committerMarc-André Lureau <marcandre.lureau@redhat.com>2023-03-13 15:23:37 +0400
commit3ffef1a55ca3b55fa64d43cd35af5adb2c260463 (patch)
tree7bb3c98f6ba70acdeaf0b538aaa5cd04517c9a8c /tests/unit
parent6bbee5dbaae1bebf5e37d3d2083584673d439631 (diff)
downloadqemu-3ffef1a55ca3b55fa64d43cd35af5adb2c260463.zip
qemu-3ffef1a55ca3b55fa64d43cd35af5adb2c260463.tar.gz
qemu-3ffef1a55ca3b55fa64d43cd35af5adb2c260463.tar.bz2
error: add global &error_warn destination
This can help debugging issues or develop, when error handling is introduced. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Stefan Berger <stefanb@linux.ibm.com> Message-Id: <20230221124802.4103554-6-marcandre.lureau@redhat.com>
Diffstat (limited to 'tests/unit')
-rw-r--r--tests/unit/test-error-report.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/unit/test-error-report.c b/tests/unit/test-error-report.c
index b096506..54319c8 100644
--- a/tests/unit/test-error-report.c
+++ b/tests/unit/test-error-report.c
@@ -12,6 +12,7 @@
#include <locale.h>
#include "qemu/error-report.h"
+#include "qapi/error.h"
static void
test_error_report_simple(void)
@@ -103,6 +104,22 @@ test_error_report_timestamp(void)
");
}
+static void
+test_error_warn(void)
+{
+ if (g_test_subprocess()) {
+ error_setg(&error_warn, "Testing &error_warn");
+ return;
+ }
+
+ g_test_trap_subprocess(NULL, 0, 0);
+ g_test_trap_assert_passed();
+ g_test_trap_assert_stderr("\
+test-error-report: warning: Testing &error_warn*\
+");
+}
+
+
int
main(int argc, char *argv[])
{
@@ -116,6 +133,7 @@ main(int argc, char *argv[])
g_test_add_func("/error-report/glog", test_error_report_glog);
g_test_add_func("/error-report/once", test_error_report_once);
g_test_add_func("/error-report/timestamp", test_error_report_timestamp);
+ g_test_add_func("/error-report/warn", test_error_warn);
return g_test_run();
}