From fd10ed1e71b294ce16cf61bbdee56c8d8ee49662 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 9 Apr 2015 15:35:00 +0200 Subject: [PATCH] test: log message at g_test_assert_expected_messages() When disabling assert-logging with no-expect-message, print a line at every g_test_assert_expected_messages() invocation. (cherry picked from commit 373d09b0425c6dfb699ee4b6615ded0177d0e344) --- include/nm-test-utils.h | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/include/nm-test-utils.h b/include/nm-test-utils.h index 69a5d441d7..c529de7ac6 100644 --- a/include/nm-test-utils.h +++ b/include/nm-test-utils.h @@ -135,8 +135,9 @@ struct __nmtst_internal __nmtst_internal = { 0 }; \ __attribute__ ((destructor)) static void \ _nmtst_exit (void) \ { \ - nmtst_free (); \ + __nmtst_internal.assert_logging = FALSE; \ g_test_assert_expected_messages (); \ + nmtst_free (); \ } @@ -434,13 +435,24 @@ nmtst_is_debug (void) G_STMT_START { \ g_assert (nmtst_initialized ()); \ if (__nmtst_internal.assert_logging && __nmtst_internal.no_expect_message) { \ - g_debug ("nmtst: swallow g_test_expect_message %s", G_STRINGIFY ((__VA_ARGS__))); \ + g_debug ("nmtst: assert-logging: g_test_expect_message %s", G_STRINGIFY ((__VA_ARGS__))); \ } else { \ G_GNUC_BEGIN_IGNORE_DEPRECATIONS \ g_test_expect_message (__VA_ARGS__); \ G_GNUC_END_IGNORE_DEPRECATIONS \ } \ } G_STMT_END +#undef g_test_assert_expected_messages_internal +#define g_test_assert_expected_messages_internal(domain, file, line, func) \ + G_STMT_START { \ + g_assert (nmtst_initialized ()); \ + if (__nmtst_internal.assert_logging && __nmtst_internal.no_expect_message) \ + g_debug ("nmtst: assert-logging: g_test_assert_expected_messages(%s, %s:%d, %s)", domain, file, line, func); \ + \ + G_GNUC_BEGIN_IGNORE_DEPRECATIONS \ + g_test_assert_expected_messages_internal (domain, file, line, func); \ + G_GNUC_END_IGNORE_DEPRECATIONS \ + } G_STMT_END #endif inline static GRand *