summary refs log tree commit diff
path: root/src/tests/config/test-config.c
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2015-05-05 17:48:57 +0200
committerMichael Biebl <biebl@debian.org>2015-05-05 17:48:57 +0200
commitf408e27bccfacf347605a8d98649975a68f38a17 (patch)
tree654fd6695c31511baf919b1c0870d119a352ed75 /src/tests/config/test-config.c
parent2c032d8f1c6292c1338a615e6ec40252889ba85c (diff)
Imported Upstream version 1.0.2 upstream/1.0.2
Diffstat (limited to 'src/tests/config/test-config.c')
-rw-r--r--src/tests/config/test-config.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/src/tests/config/test-config.c b/src/tests/config/test-config.c
index 808fc670..e027eab8 100644
--- a/src/tests/config/test-config.c
+++ b/src/tests/config/test-config.c
@@ -27,6 +27,10 @@
 #include <nm-config.h>
 #include "nm-test-device.h"
 #include "nm-fake-platform.h"
+#include "nm-logging.h"
+#include "nm-dbus-manager.h"
+
+#include "nm-test-utils.h"
 
 static void
 setup_config (const char *config_file, const char *config_dir, ...)
@@ -108,7 +112,7 @@ static void
 test_config_non_existent (void)
 {
 	NMConfig *config;
-	GError *error = NULL;
+	gs_free_error GError *error = NULL;
 
 	setup_config (SRCDIR "/no-such-file", "/no/such/dir", NULL);
 	config = nm_config_new (&error);
@@ -120,7 +124,7 @@ static void
 test_config_parse_error (void)
 {
 	NMConfig *config;
-	GError *error = NULL;
+	gs_free_error GError *error = NULL;
 
 	setup_config (SRCDIR "/bad.conf", "/no/such/dir", NULL);
 	config = nm_config_new (&error);
@@ -270,7 +274,7 @@ static void
 test_config_confdir_parse_error (void)
 {
 	NMConfig *config;
-	GError *error = NULL;
+	gs_free_error GError *error = NULL;
 
 	/* Using SRCDIR as the conf dir will pick up bad.conf */
 	setup_config (SRCDIR "/NetworkManager.conf", SRCDIR, NULL);
@@ -279,14 +283,19 @@ test_config_confdir_parse_error (void)
 	g_assert_error (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_PARSE);
 }
 
+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");
+
+	/* Initialize the DBus manager singleton explicitly, because it is accessed by
+	 * the class initializer of NMDevice (used by the NMTestDevice stub).
+	 * This way, we skip calling nm_dbus_manager_init_bus() which would
+	 * either fail and/or cause unexpected actions in the test.
+	 * */
+	nm_dbus_manager_setup (g_object_new (NM_TYPE_DBUS_MANAGER, NULL));
 
 	nm_fake_platform_setup ();