libnm-util/test: use "nm-test-utils.h" in test-setting-dcb
authorThomas Haller <thaller@redhat.com>
Sat, 10 Oct 2015 17:34:06 +0000 (19:34 +0200)
committerThomas Haller <thaller@redhat.com>
Sat, 10 Oct 2015 17:41:42 +0000 (19:41 +0200)
include/nm-test-utils.h
libnm-util/tests/test-setting-dcb.c

index a8f64b4..051da65 100644 (file)
@@ -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__
index 26c4f0c..59eac3c 100644 (file)
@@ -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);