mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-05 07:38:20 +02:00
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 373d09b042)
This commit is contained in:
parent
fec4e68f4d
commit
fd10ed1e71
1 changed files with 14 additions and 2 deletions
|
|
@ -135,8 +135,9 @@ struct __nmtst_internal __nmtst_internal = { 0 }; \
|
||||||
__attribute__ ((destructor)) static void \
|
__attribute__ ((destructor)) static void \
|
||||||
_nmtst_exit (void) \
|
_nmtst_exit (void) \
|
||||||
{ \
|
{ \
|
||||||
nmtst_free (); \
|
__nmtst_internal.assert_logging = FALSE; \
|
||||||
g_test_assert_expected_messages (); \
|
g_test_assert_expected_messages (); \
|
||||||
|
nmtst_free (); \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -434,13 +435,24 @@ nmtst_is_debug (void)
|
||||||
G_STMT_START { \
|
G_STMT_START { \
|
||||||
g_assert (nmtst_initialized ()); \
|
g_assert (nmtst_initialized ()); \
|
||||||
if (__nmtst_internal.assert_logging && __nmtst_internal.no_expect_message) { \
|
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 { \
|
} else { \
|
||||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS \
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS \
|
||||||
g_test_expect_message (__VA_ARGS__); \
|
g_test_expect_message (__VA_ARGS__); \
|
||||||
G_GNUC_END_IGNORE_DEPRECATIONS \
|
G_GNUC_END_IGNORE_DEPRECATIONS \
|
||||||
} \
|
} \
|
||||||
} G_STMT_END
|
} 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
|
#endif
|
||||||
|
|
||||||
inline static GRand *
|
inline static GRand *
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue