diff options
author | Thomas Haller <thaller@redhat.com> | 2015-02-16 15:31:05 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2015-02-16 16:14:46 +0100 |
commit | d5cb66a937fa98f24b430d1412ac81b9fcd74785 (patch) | |
tree | d25b46918290ac945e05628b3e0e7e221c1edfac | |
parent | f88386a245477ff91c83ab42a46c6ea1ca31483d (diff) | |
download | NetworkManager-th/test.tar.gz |
config/tests: inject NMDBusManager for tests in NMDevice stubth/test
We don't need the bus for the tests and the manager may warn when it
is not available.
$ (cd src/tests/config/; env -i DBUS_SYSTEM_BUS_ADDRESS=meow ./test-config)
/config/parse-error: OK
/config/no-auto-default: NetworkManager-Message: <info> Could not connect to the system bus; only the private D-Bus socket will be available.
/bin/sh: line 5: 29997 Trace/breakpoint trap ${dir}$tst
FAIL: test-config
This reverts commit 6994454461100d45a7e2f063bd1f473652d4839d for the
most part.
-rw-r--r-- | src/tests/config/test-config.c | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/src/tests/config/test-config.c b/src/tests/config/test-config.c index fc73d5bdd0..453894dcd1 100644 --- a/src/tests/config/test-config.c +++ b/src/tests/config/test-config.c @@ -289,28 +289,18 @@ test_config_confdir_parse_error (void) NMTST_DEFINE (); - -static void -ignore_log (const gchar *log_domain, - GLogLevelFlags log_level, - const gchar *message, - gpointer user_data) -{ -} - int main (int argc, char **argv) { - /* Initialize the DBus manager singleton in advance, ignoring the warnings. - * Otherwise it would attempt to initialize as soon as nm_test_device_new() - * would cause NMDevice class to register its type on the bus. We don't care - * about that and the warnings would mess up with the testing. - * */ - g_log_set_default_handler (ignore_log, NULL); - nm_dbus_manager_get (); - nmtst_init_assert_logging (&argc, &argv); + /* Initialize the DBus manager singleton because it is accessed by the + * class initializer of NMDevice (which is used by our 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 (); g_test_add_func ("/config/simple", test_config_simple); |