[Spice-devel] [PATCH spice-gtk 3/5] test-session: Do not fail on g_warning

Pavel Grunt pgrunt at redhat.com
Fri May 20 12:50:58 UTC 2016


Following commit adds tests for password set in uri which will produce
a runtime warning. Reset fatal mask set by g_test_init() to avoid
failing.
---
 tests/session.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/tests/session.c b/tests/session.c
index a6276c2..549378b 100644
--- a/tests/session.c
+++ b/tests/session.c
@@ -70,8 +70,17 @@ static void test_session_uri(void)
 
 int main(int argc, char* argv[])
 {
+    GLogLevelFlags fatal_mask;
+
+    fatal_mask = (GLogLevelFlags)g_log_set_always_fatal((GLogLevelFlags) G_LOG_FATAL_MASK);
+
     g_test_init(&argc, &argv, NULL);
 
+    /* Reset fatal mask set by g_test_init() as we don't want
+     * warnings/criticals to be fatal by default since this is what some of the
+     * test cases are going to test */
+    g_log_set_always_fatal(fatal_mask & G_LOG_LEVEL_MASK);
+
     g_test_add_func("/session/uri", test_session_uri);
 
     return g_test_run();
-- 
2.8.2



More information about the Spice-devel mailing list