diff options
| author | Michael Biebl <biebl@debian.org> | 2019-02-26 19:02:28 +0100 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2019-02-26 19:02:28 +0100 |
| commit | 439c9d76f576ae28c73571d444c59d9e95e5ad11 (patch) | |
| tree | 7591e0b43641131fc049d6d7a0bd19e9e4964a40 /shared/nm-utils/nm-test-utils.h | |
| parent | 12aead6b161a3312673ac62686af0350061c0666 (diff) | |
| parent | 964ae8cc391520440cf5aa13e2b9cc34850ea6c2 (diff) | |
Update upstream source from tag 'upstream/1.14.6'
Update to upstream version '1.14.6' with Debian dir ef09251bb8b7a4afa8e2b004d785517d8a2d973d
Diffstat (limited to 'shared/nm-utils/nm-test-utils.h')
| -rw-r--r-- | shared/nm-utils/nm-test-utils.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/shared/nm-utils/nm-test-utils.h b/shared/nm-utils/nm-test-utils.h index c8139862..7decd363 100644 --- a/shared/nm-utils/nm-test-utils.h +++ b/shared/nm-utils/nm-test-utils.h @@ -1337,6 +1337,42 @@ _nmtst_assert_resolve_relative_path_equals (const char *f1, const char *f2, cons /*****************************************************************************/ +#ifdef __NETWORKMANAGER_LOGGING_H__ +static inline gpointer +nmtst_logging_disable (gboolean always) +{ + gpointer p; + + g_assert (nmtst_initialized ()); + if (!always && __nmtst_internal.no_expect_message) { + /* The caller does not want to @always suppress logging. Instead, + * the caller wants to suppress unexpected log messages that would + * fail assertions (since we possibly assert against all unexpected + * log messages). + * + * If the test is run with no-expect-message, then don't suppress + * the loggings, because they also wouldn't fail assertions. */ + return NULL; + } + + p = g_memdup (_nm_logging_enabled_state, sizeof (_nm_logging_enabled_state)); + memset (_nm_logging_enabled_state, 0, sizeof (_nm_logging_enabled_state)); + return p; +} + +static inline void +nmtst_logging_reenable (gpointer old_state) +{ + g_assert (nmtst_initialized ()); + if (old_state) { + memcpy (_nm_logging_enabled_state, old_state, sizeof (_nm_logging_enabled_state)); + g_free (old_state); + } +} +#endif + +/*****************************************************************************/ + #ifdef NM_SETTING_IP_CONFIG_H static inline void nmtst_setting_ip_config_add_address (NMSettingIPConfig *s_ip, |