From 9fdc5e6596df06ef903da643d9b9a549ed8ef2f6 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Sat, 10 Oct 2015 19:34:06 +0200 Subject: [PATCH] libnm-util/test: use "nm-test-utils.h" in test-setting-dcb --- include/nm-test-utils.h | 10 ++++++++++ libnm-util/tests/test-setting-dcb.c | 19 +++++-------------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/include/nm-test-utils.h b/include/nm-test-utils.h index a8f64b437f..051da65d2e 100644 --- a/include/nm-test-utils.h +++ b/include/nm-test-utils.h @@ -454,6 +454,16 @@ __nmtst_init (int *argc, char ***argv, gboolean assert_logging, const char *log_ /* ensure that monotonic timestamp is called (because it initially logs a line) */ nm_utils_get_monotonic_timestamp_s (); #endif + +#ifdef NM_UTILS_H + { + gs_free_error GError *error = NULL; + + if (!nm_utils_init (&error)) + g_assert_not_reached (); + g_assert_no_error (error); + } +#endif } #ifdef __NETWORKMANAGER_LOGGING_H__ diff --git a/libnm-util/tests/test-setting-dcb.c b/libnm-util/tests/test-setting-dcb.c index 26c4f0c6ac..59eac3c5b1 100644 --- a/libnm-util/tests/test-setting-dcb.c +++ b/libnm-util/tests/test-setting-dcb.c @@ -26,6 +26,8 @@ #include "nm-default.h" #include "nm-setting-dcb.h" +#include "nm-test-utils.h" + #define DCB_FLAGS_ALL (NM_SETTING_DCB_FLAG_ENABLE | \ NM_SETTING_DCB_FLAG_ADVERTISE | \ NM_SETTING_DCB_FLAG_WILLING) @@ -299,22 +301,11 @@ test_dcb_bandwidth_sums (void) #define TPATH "/libnm-util/settings/dcb/" +NMTST_DEFINE (); + int main (int argc, char **argv) { - GError *error = NULL; - gboolean success; - - g_test_init (&argc, &argv, NULL); - - nm_g_type_init (); - - success = nm_utils_init (&error); - g_assert_no_error (error); - g_assert (success); - -#if !GLIB_CHECK_VERSION(2,34,0) - g_log_set_always_fatal (G_LOG_LEVEL_CRITICAL); -#endif + nmtst_init (&argc, &argv, TRUE); g_test_add_func (TPATH "flags-valid", test_dcb_flags_valid); g_test_add_func (TPATH "flags-invalid", test_dcb_flags_invalid);