summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristophe Fergeau <cfergeau@redhat.com>2018-06-20 16:38:26 +0200
committerFrediano Ziglio <fziglio@redhat.com>2018-06-21 07:03:25 +0100
commit0fc3d4209f42d673318996e3fdb8dcdadd9a465a (patch)
tree749eb719268e6013023cc9a191e8de60eb38d284
parent82a5f19d998b88b7e1f7c89672f986f88ff7be31 (diff)
test-logging: Improve debug level tests
These tests were checking that the expected messages were output, but they were not checking that the messages we don't want are not output. This commit adds this to make sure our log implementation does not output unwanted debug messages. Acked-by: Frediano Ziglio <fziglio@redhat.com>
-rw-r--r--tests/test-logging.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/test-logging.c b/tests/test-logging.c
index 9852b13..437e0a1 100644
--- a/tests/test-logging.c
+++ b/tests/test-logging.c
@@ -250,6 +250,12 @@ static void test_log_levels(void)
g_test_trap_subprocess(NULL, 0, 0);
g_test_trap_assert_passed();
g_test_trap_assert_stderr("*spice_warning\n*g_critical\n*g_warning\n*g_message\n*other_critical\n*other_warning\n*other_message\n");
+ g_test_trap_assert_stdout_unmatched("*spice_info*");
+ g_test_trap_assert_stdout_unmatched("*spice_debug*");
+ g_test_trap_assert_stdout_unmatched("*g_info*");
+ g_test_trap_assert_stdout_unmatched("*g_debug*");
+ g_test_trap_assert_stdout_unmatched("*other_info*");
+ g_test_trap_assert_stdout_unmatched("*other_debug*");
}
/* Checks that SPICE_DEBUG_LEVEL impacts spice_debug(), g_debug() but not other_debug() */
@@ -275,6 +281,7 @@ static void test_spice_debug_level(void)
g_test_trap_assert_passed();
g_test_trap_assert_stderr("*SPICE_DEBUG_LEVEL*deprecated*");
g_test_trap_assert_stdout("*spice_info\n*g_debug\n*spice_debug\n");
+ g_test_trap_assert_stdout_unmatched("*other_debug*");
}
/* Checks that raising SPICE_DEBUG_LEVEL allows to only show spice_warning() and spice_critical()
@@ -310,6 +317,14 @@ static void test_spice_debug_level_warning(void)
g_test_trap_assert_stderr("*SPICE_DEBUG_LEVEL*deprecated*");
g_test_trap_assert_stderr("*SPICE_ABORT_LEVEL*deprecated*");
g_test_trap_assert_stderr("*spice_critical\n*g_critical\n*other_message\n*other_warning\n*other_critical\n");
+ g_test_trap_assert_stdout_unmatched("*spice_info*");
+ g_test_trap_assert_stdout_unmatched("*spice_debug*");
+ g_test_trap_assert_stderr_unmatched("*spice_warning*");
+ g_test_trap_assert_stdout_unmatched("*g_debug*");
+ g_test_trap_assert_stdout_unmatched("*g_info*");
+ g_test_trap_assert_stderr_unmatched("*g_message*");
+ g_test_trap_assert_stderr_unmatched("*g_warning*");
+ g_test_trap_assert_stdout_unmatched("*other_info*");
}
/* Checks that setting G_MESSAGES_DEBUG to 'Spice' impacts spice_debug() and
@@ -335,6 +350,8 @@ static void test_spice_g_messages_debug(void)
g_test_trap_assert_passed();
g_test_trap_assert_stdout("*spice_debug\n*spice_info\n*g_debug\n*g_info\n");
g_test_trap_assert_stderr("*g_message\n*other_message\n");
+ g_test_trap_assert_stdout_unmatched("*other_debug*");
+ g_test_trap_assert_stdout_unmatched("*other_info*");
}
/* Checks that setting G_MESSAGES_DEBUG to 'all' impacts spice_debug(),