test: initialize tests with nmtst_init()
authorThomas Haller <thaller@redhat.com>
Fri, 3 Jul 2015 13:11:17 +0000 (15:11 +0200)
committerThomas Haller <thaller@redhat.com>
Sun, 12 Jul 2015 11:56:52 +0000 (13:56 +0200)
13 files changed:
callouts/tests/test-dispatcher-envp.c
libnm-core/tests/test-setting-dcb.c
libnm-glib/tests/test-nm-client.c
libnm-glib/tests/test-remote-settings-client.c
libnm/tests/test-nm-client.c
libnm/tests/test-remote-settings-client.c
libnm/tests/test-secret-agent.c
src/devices/wifi/tests/test-wifi-ap-utils.c
src/dnsmasq-manager/tests/test-dnsmasq-utils.c
src/settings/plugins/ifupdown/tests/test-ifupdown.c
src/tests/test-dcb.c
src/tests/test-resolvconf-capture.c
src/tests/test-wired-defname.c

index ac2a9bd..023c77a 100644 (file)
@@ -30,6 +30,8 @@
 #include "nm-dispatcher-utils.h"
 #include "nm-dispatcher-api.h"
 
+#include "nm-test-utils.h"
+
 /*******************************************/
 
 static gboolean
@@ -605,14 +607,12 @@ test_up_empty_vpn_iface (void)
 
 /*******************************************/
 
+NMTST_DEFINE ();
+
 int
 main (int argc, char **argv)
 {
-       g_test_init (&argc, &argv, NULL);
-
-#if !GLIB_CHECK_VERSION (2, 35, 0)
-       g_type_init ();
-#endif
+       nmtst_init (&argc, &argv, TRUE);
 
        g_test_add_func ("/dispatcher/up", test_up);
        g_test_add_func ("/dispatcher/down", test_down);
index f7554e8..0369ca5 100644 (file)
 #include <glib.h>
 #include <string.h>
 #include <nm-utils.h>
-#include <nm-glib-compat.h>
 #include "nm-setting-dcb.h"
 #include "nm-connection.h"
 #include "nm-errors.h"
-#include "gsystem-local-alloc.h"
+
+#include "nm-test-utils.h"
 
 #define DCB_FLAGS_ALL (NM_SETTING_DCB_FLAG_ENABLE | \
                        NM_SETTING_DCB_FLAG_ADVERTISE | \
@@ -303,18 +303,12 @@ test_dcb_bandwidth_sums (void)
 
 #define TPATH "/libnm/settings/dcb/"
 
+NMTST_DEFINE ();
+
 int
 main (int argc, char **argv)
 {
-       g_test_init (&argc, &argv, NULL);
-
-#if !GLIB_CHECK_VERSION (2, 35, 0)
-       g_type_init ();
-#endif
-
-#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);
index af3722e..0ec3924 100644 (file)
@@ -33,7 +33,8 @@
 #include "nm-device-wifi.h"
 #include "nm-device-ethernet.h"
 #include "nm-device-wimax.h"
-#include "nm-glib-compat.h"
+
+#include "nm-test-utils.h"
 
 #include "common.h"
 
@@ -880,14 +881,12 @@ test_client_manager_running (void)
 
 /*******************************************************************/
 
+NMTST_DEFINE ();
+
 int
 main (int argc, char **argv)
 {
-#if !GLIB_CHECK_VERSION (2, 35, 0)
-       g_type_init ();
-#endif
-
-       g_test_init (&argc, &argv, NULL);
+       nmtst_init (&argc, &argv, TRUE);
 
        loop = g_main_loop_new (NULL, FALSE);
 
index a109f8d..afaa6fe 100644 (file)
@@ -36,7 +36,8 @@
 
 #include "nm-remote-settings.h"
 #include "common.h"
-#include "gsystem-local-alloc.h"
+
+#include "nm-test-utils.h"
 
 static NMTestServiceInfo *sinfo;
 static NMRemoteSettings *settings = NULL;
@@ -422,17 +423,15 @@ test_service_running (void)
 
 /*******************************************************************/
 
+NMTST_DEFINE ();
+
 int
 main (int argc, char **argv)
 {
        int ret;
        GError *error = NULL;
 
-#if !GLIB_CHECK_VERSION (2, 35, 0)
-       g_type_init ();
-#endif
-       
-       g_test_init (&argc, &argv, NULL);
+       nmtst_init (&argc, &argv, TRUE);
 
        bus = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
        g_assert_no_error (error);
index 3541c74..1c9bc85 100644 (file)
@@ -1170,10 +1170,6 @@ main (int argc, char **argv)
 {
        g_setenv ("LIBNM_USE_SESSION_BUS", "1", TRUE);
 
-#if !GLIB_CHECK_VERSION (2, 35, 0)
-       g_type_init ();
-#endif
-
        nmtst_init (&argc, &argv, TRUE);
 
        loop = g_main_loop_new (NULL, FALSE);
index 15590fa..d723f6c 100644 (file)
@@ -502,6 +502,8 @@ test_save_hostname (void)
 
 /*******************************************************************/
 
+NMTST_DEFINE ();
+
 int
 main (int argc, char **argv)
 {
@@ -510,11 +512,7 @@ main (int argc, char **argv)
 
        g_setenv ("LIBNM_USE_SESSION_BUS", "1", TRUE);
 
-#if !GLIB_CHECK_VERSION (2, 35, 0)
-       g_type_init ();
-#endif
-       
-       g_test_init (&argc, &argv, NULL);
+       nmtst_init (&argc, &argv, TRUE);
 
        bus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error);
        g_assert_no_error (error);
index 037b5a8..3f0095a 100644 (file)
 
 #include <NetworkManager.h>
 #include <nm-secret-agent-old.h>
-#include "nm-glib-compat.h"
-#include "nm-test-utils.h"
 
 #include "common.h"
 
+#include "nm-test-utils.h"
+
 /*******************************************************************/
 
 enum {
@@ -624,6 +624,8 @@ test_secret_agent_auto_register (void)
 
 /*******************************************************************/
 
+NMTST_DEFINE ();
+
 int
 main (int argc, char **argv)
 {
@@ -631,11 +633,7 @@ main (int argc, char **argv)
 
        g_setenv ("LIBNM_USE_SESSION_BUS", "1", TRUE);
 
-#if !GLIB_CHECK_VERSION (2, 35, 0)
-       g_type_init ();
-#endif
-
-       g_test_init (&argc, &argv, NULL);
+       nmtst_init (&argc, &argv, TRUE);
 
        g_test_add ("/libnm/secret-agent/none", TestSecretAgentData, NULL,
                    test_setup, test_secret_agent_none, test_cleanup);
index 3c405e2..b59b537 100644 (file)
@@ -27,6 +27,9 @@
 #include "nm-dbus-glib-types.h"
 
 #include "nm-core-internal.h"
+#include "nm-logging.h"
+
+#include "nm-test-utils.h"
 
 #define DEBUG 1
 
@@ -1336,16 +1339,14 @@ test_strength_wext (void)
 
 /*******************************************/
 
+NMTST_DEFINE ();
+
 int
 main (int argc, char **argv)
 {
        gsize i;
 
-#if !GLIB_CHECK_VERSION (2, 35, 0)
-       g_type_init ();
-#endif
-
-       g_test_init (&argc, &argv, NULL);
+       nmtst_init_assert_logging (&argc, &argv, "INFO", "DEFAULT");
 
        g_test_add_func ("/wifi/lock_bssid",
                         test_lock_bssid);
index f8120ff..fae4cae 100644 (file)
@@ -24,6 +24,9 @@
 #include <arpa/inet.h>
 
 #include "nm-dnsmasq-utils.h"
+#include "nm-logging.h"
+
+#include "nm-test-utils.h"
 
 static guint32
 addr_to_num (const char *addr)
@@ -101,14 +104,12 @@ test_address_ranges (void)
 
 /*******************************************/
 
+NMTST_DEFINE ();
+
 int
 main (int argc, char **argv)
 {
-       g_test_init (&argc, &argv, NULL);
-
-#if !GLIB_CHECK_VERSION (2, 35, 0)
-       g_type_init ();
-#endif
+       nmtst_init_assert_logging (&argc, &argv, "INFO", "DEFAULT");
 
        g_test_add_func ("/dnsmasq-manager/address-ranges", test_address_ranges);
 
index 1c100ac..d285a46 100644 (file)
@@ -27,6 +27,7 @@
 #include "nm-logging.h"
 #include "interface_parser.h"
 #include "parser.h"
+#include "nm-logging.h"
 
 #include "nm-test-utils.h"
 
@@ -844,16 +845,12 @@ test20_source_stanza (const char *path)
        expected_free (e);
 }
 
+NMTST_DEFINE ();
+
 int
 main (int argc, char **argv)
 {
-#if !GLIB_CHECK_VERSION (2, 35, 0)
-       g_type_init ();
-#endif
-
-       nm_logging_setup ("WARN", "DEFAULT", NULL, NULL);
-
-       g_test_init (&argc, &argv, NULL);
+       nmtst_init_assert_logging (&argc, &argv, "WARN", "DEFAULT");
 
        if (0)
                dump_blocks ();
index dacb1f5..2fef34b 100644 (file)
@@ -24,6 +24,9 @@
 #include <string.h>
 
 #include "nm-dcb.h"
+#include "nm-logging.h"
+
+#include "nm-test-utils.h"
 
 typedef struct {
        guint num;
@@ -335,14 +338,12 @@ test_fcoe_cleanup (void)
 
 /*******************************************/
 
+NMTST_DEFINE ();
+
 int
 main (int argc, char **argv)
 {
-       g_test_init (&argc, &argv, NULL);
-
-#if !GLIB_CHECK_VERSION (2, 35, 0)
-       g_type_init ();
-#endif
+       nmtst_init_assert_logging (&argc, &argv, "INFO", "DEFAULT");
 
        g_test_add_func ("/dcb/fcoe", test_dcb_fcoe);
        g_test_add_func ("/dcb/iscsi", test_dcb_iscsi);
index bf0fff0..313c23f 100644 (file)
@@ -28,6 +28,9 @@
 #include "nm-ip4-config.h"
 #include "nm-ip6-config.h"
 #include "nm-platform.h"
+#include "nm-logging.h"
+
+#include "nm-test-utils.h"
 
 static void
 test_capture_empty (void)
@@ -288,14 +291,12 @@ test_capture_dns_options_valid6 (void)
 }
 /*******************************************/
 
+NMTST_DEFINE ();
+
 int
 main (int argc, char **argv)
 {
-       g_test_init (&argc, &argv, NULL);
-
-#if !GLIB_CHECK_VERSION (2,35,0)
-       g_type_init ();
-#endif
+       nmtst_init_assert_logging (&argc, &argv, "INFO", "DEFAULT");
 
        g_test_add_func ("/resolvconf-capture/empty", test_capture_empty);
        g_test_add_func ("/resolvconf-capture/basic4", test_capture_basic4);
index b2933de..7e626ec 100644 (file)
@@ -26,7 +26,9 @@
 #include <nm-simple-connection.h>
 #include <nm-setting-connection.h>
 #include "nm-device-ethernet-utils.h"
-#include "gsystem-local-alloc.h"
+#include "nm-logging.h"
+
+#include "nm-test-utils.h"
 
 static NMConnection *
 _new_connection (const char *id)
@@ -112,14 +114,12 @@ test_defname_multiple_conflicts (void)
 
 /*******************************************/
 
+NMTST_DEFINE ();
+
 int
 main (int argc, char **argv)
 {
-#if !GLIB_CHECK_VERSION (2, 35, 0)
-       g_type_init ();
-#endif
-
-       g_test_init (&argc, &argv, NULL);
+       nmtst_init_assert_logging (&argc, &argv, "INFO", "DEFAULT");
 
        g_test_add_func ("/defname/no_connections", test_defname_no_connections);
        g_test_add_func ("/defname/no_conflict", test_defname_no_conflict);