diff options
author | Thomas Haller <thaller@redhat.com> | 2015-07-03 15:11:17 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2015-07-12 13:56:52 +0200 |
commit | 7a3ab5c02f2b7168e46d0e4a30e8ba1858a52a09 (patch) | |
tree | 7173523018a8cacf7efffe5134f0aefa82a4bfcc | |
parent | 8407a55a5d4dc18a89b9db4e92196a3a44b9869f (diff) | |
download | NetworkManager-7a3ab5c02f2b7168e46d0e4a30e8ba1858a52a09.tar.gz |
test: initialize tests with nmtst_init()
-rw-r--r-- | callouts/tests/test-dispatcher-envp.c | 10 | ||||
-rw-r--r-- | libnm-core/tests/test-setting-dcb.c | 16 | ||||
-rw-r--r-- | libnm-glib/tests/test-nm-client.c | 11 | ||||
-rw-r--r-- | libnm-glib/tests/test-remote-settings-client.c | 11 | ||||
-rw-r--r-- | libnm/tests/test-nm-client.c | 4 | ||||
-rw-r--r-- | libnm/tests/test-remote-settings-client.c | 8 | ||||
-rw-r--r-- | libnm/tests/test-secret-agent.c | 12 | ||||
-rw-r--r-- | src/devices/wifi/tests/test-wifi-ap-utils.c | 11 | ||||
-rw-r--r-- | src/dnsmasq-manager/tests/test-dnsmasq-utils.c | 11 | ||||
-rw-r--r-- | src/settings/plugins/ifupdown/tests/test-ifupdown.c | 11 | ||||
-rw-r--r-- | src/tests/test-dcb.c | 11 | ||||
-rw-r--r-- | src/tests/test-resolvconf-capture.c | 11 | ||||
-rw-r--r-- | src/tests/test-wired-defname.c | 12 |
13 files changed, 62 insertions, 77 deletions
diff --git a/callouts/tests/test-dispatcher-envp.c b/callouts/tests/test-dispatcher-envp.c index ac2a9bd900..023c77a82d 100644 --- a/callouts/tests/test-dispatcher-envp.c +++ b/callouts/tests/test-dispatcher-envp.c @@ -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); diff --git a/libnm-core/tests/test-setting-dcb.c b/libnm-core/tests/test-setting-dcb.c index f7554e81a5..0369ca55f2 100644 --- a/libnm-core/tests/test-setting-dcb.c +++ b/libnm-core/tests/test-setting-dcb.c @@ -24,11 +24,11 @@ #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); diff --git a/libnm-glib/tests/test-nm-client.c b/libnm-glib/tests/test-nm-client.c index af3722eba4..0ec3924d99 100644 --- a/libnm-glib/tests/test-nm-client.c +++ b/libnm-glib/tests/test-nm-client.c @@ -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); diff --git a/libnm-glib/tests/test-remote-settings-client.c b/libnm-glib/tests/test-remote-settings-client.c index a109f8df4a..afaa6fe117 100644 --- a/libnm-glib/tests/test-remote-settings-client.c +++ b/libnm-glib/tests/test-remote-settings-client.c @@ -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); diff --git a/libnm/tests/test-nm-client.c b/libnm/tests/test-nm-client.c index 3541c741e1..1c9bc853a6 100644 --- a/libnm/tests/test-nm-client.c +++ b/libnm/tests/test-nm-client.c @@ -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); diff --git a/libnm/tests/test-remote-settings-client.c b/libnm/tests/test-remote-settings-client.c index 15590fac1a..d723f6ce7d 100644 --- a/libnm/tests/test-remote-settings-client.c +++ b/libnm/tests/test-remote-settings-client.c @@ -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); diff --git a/libnm/tests/test-secret-agent.c b/libnm/tests/test-secret-agent.c index 037b5a8135..3f0095abc0 100644 --- a/libnm/tests/test-secret-agent.c +++ b/libnm/tests/test-secret-agent.c @@ -27,11 +27,11 @@ #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); diff --git a/src/devices/wifi/tests/test-wifi-ap-utils.c b/src/devices/wifi/tests/test-wifi-ap-utils.c index 3c405e264f..b59b5376dd 100644 --- a/src/devices/wifi/tests/test-wifi-ap-utils.c +++ b/src/devices/wifi/tests/test-wifi-ap-utils.c @@ -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); diff --git a/src/dnsmasq-manager/tests/test-dnsmasq-utils.c b/src/dnsmasq-manager/tests/test-dnsmasq-utils.c index f8120ffec3..fae4cae076 100644 --- a/src/dnsmasq-manager/tests/test-dnsmasq-utils.c +++ b/src/dnsmasq-manager/tests/test-dnsmasq-utils.c @@ -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); diff --git a/src/settings/plugins/ifupdown/tests/test-ifupdown.c b/src/settings/plugins/ifupdown/tests/test-ifupdown.c index 1c100ac2e2..d285a464d7 100644 --- a/src/settings/plugins/ifupdown/tests/test-ifupdown.c +++ b/src/settings/plugins/ifupdown/tests/test-ifupdown.c @@ -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 (); diff --git a/src/tests/test-dcb.c b/src/tests/test-dcb.c index dacb1f521f..2fef34ba09 100644 --- a/src/tests/test-dcb.c +++ b/src/tests/test-dcb.c @@ -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); diff --git a/src/tests/test-resolvconf-capture.c b/src/tests/test-resolvconf-capture.c index bf0fff0b1d..313c23f4d7 100644 --- a/src/tests/test-resolvconf-capture.c +++ b/src/tests/test-resolvconf-capture.c @@ -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); diff --git a/src/tests/test-wired-defname.c b/src/tests/test-wired-defname.c index b2933de0e3..7e626ec585 100644 --- a/src/tests/test-wired-defname.c +++ b/src/tests/test-wired-defname.c @@ -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); |