diff options
author | Xavier Claessens <xclaesse@gmail.com> | 2018-07-13 15:46:21 +0000 |
---|---|---|
committer | Xavier Claessens <xclaesse@gmail.com> | 2018-07-13 15:46:21 +0000 |
commit | c96f987f0ddffcf4707afc5e3ede347a1f2c08e4 (patch) | |
tree | 7fb0017b8157f3dfcf4e95900f5dbe649d57b8d1 | |
parent | b9d390dc442deb9ce2a92bc25c13c781d219240c (diff) | |
parent | 3e74d587cfc9969094512d3f5e4a6d39e2cd0b8f (diff) | |
download | glib-c96f987f0ddffcf4707afc5e3ede347a1f2c08e4.tar.gz |
Merge branch '786-gio-test-leaks' into 'master'
Fix memory leaks in libgio tests and ensure tests are run under Meson
Closes #786
See merge request GNOME/glib!151
-rw-r--r-- | gio/tests/gdbus-connection-loss.c | 3 | ||||
-rw-r--r-- | gio/tests/gdbus-export.c | 10 | ||||
-rw-r--r-- | gio/tests/meson.build | 26 | ||||
-rw-r--r-- | glib/tests/meson.build | 1 | ||||
-rw-r--r-- | tests/refcount/meson.build | 2 |
5 files changed, 30 insertions, 12 deletions
diff --git a/gio/tests/gdbus-connection-loss.c b/gio/tests/gdbus-connection-loss.c index 6f0140986..9dbbeb2a4 100644 --- a/gio/tests/gdbus-connection-loss.c +++ b/gio/tests/gdbus-connection-loss.c @@ -136,7 +136,10 @@ main (int argc, ret = g_test_run(); + session_bus_down (); + g_object_unref (c); + g_main_loop_unref (loop); return ret; } diff --git a/gio/tests/gdbus-export.c b/gio/tests/gdbus-export.c index ef0dddeee..4d6d3a43e 100644 --- a/gio/tests/gdbus-export.c +++ b/gio/tests/gdbus-export.c @@ -813,7 +813,7 @@ test_dispatch_thread_func (gpointer user_data) NULL, &error); g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS); - g_assert_cmpstr (error->message, ==, "GDBus.Error:org.freedesktop.DBus.Error.InvalidArgs: Type of message, '(s)', does not match expected type '()'"); + g_assert_cmpstr (error->message, ==, "GDBus.Error:org.freedesktop.DBus.Error.InvalidArgs: Type of message, “(s)”, does not match expected type “()”"); g_error_free (error); g_assert (value == NULL); @@ -826,7 +826,7 @@ test_dispatch_thread_func (gpointer user_data) NULL, &error); g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD); - g_assert_cmpstr (error->message, ==, "GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: No such method 'NonExistantMethod'"); + g_assert_cmpstr (error->message, ==, "GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: No such method “NonExistantMethod”"); g_error_free (error); g_assert (value == NULL); @@ -874,7 +874,7 @@ test_dispatch_thread_func (gpointer user_data) &error); g_assert (value == NULL); g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS); - g_assert_cmpstr (error->message, ==, "GDBus.Error:org.freedesktop.DBus.Error.InvalidArgs: No such property 'ThisDoesntExist'"); + g_assert_cmpstr (error->message, ==, "GDBus.Error:org.freedesktop.DBus.Error.InvalidArgs: No such property “ThisDoesntExist”"); g_error_free (error); error = NULL; @@ -889,7 +889,7 @@ test_dispatch_thread_func (gpointer user_data) &error); g_assert (value == NULL); g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS); - g_assert_cmpstr (error->message, ==, "GDBus.Error:org.freedesktop.DBus.Error.InvalidArgs: Property 'NotReadable' is not readable"); + g_assert_cmpstr (error->message, ==, "GDBus.Error:org.freedesktop.DBus.Error.InvalidArgs: Property “NotReadable” is not readable"); g_error_free (error); error = NULL; @@ -926,7 +926,7 @@ test_dispatch_thread_func (gpointer user_data) &error); g_assert (value == NULL); g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS); - g_assert_cmpstr (error->message, ==, "GDBus.Error:org.freedesktop.DBus.Error.InvalidArgs: Property 'NotWritable' is not writable"); + g_assert_cmpstr (error->message, ==, "GDBus.Error:org.freedesktop.DBus.Error.InvalidArgs: Property “NotWritable” is not writable"); g_error_free (error); error = NULL; diff --git a/gio/tests/meson.build b/gio/tests/meson.build index b3edc7c82..41770e47c 100644 --- a/gio/tests/meson.build +++ b/gio/tests/meson.build @@ -64,6 +64,14 @@ gio_tests = [ 'glistmodel', 'testfilemonitor', 'thumbnail-verification', + 'tls-certificate', + 'tls-interaction', +] +slow_tests = [ + 'actions', + 'gdbus-export', + 'gdbus-threading', + 'testfilemonitor', ] test_extra_programs = [ @@ -197,7 +205,7 @@ if host_machine.system() != 'windows' ] if not glib_have_cocoa - gio_dbus_tests = [['dbus-appinfo', [], []]] + gio_dbus_tests += [['dbus-appinfo', [], []]] endif # separate loop because extra source files for each test @@ -210,7 +218,12 @@ if host_machine.system() != 'windows' install : false, c_args : test_c_args, dependencies : common_gio_tests_deps + extra_deps) - test(test_name, exe, env : test_env, suite : ['gio']) + # These tests may take more than 30 seconds to run on the CI infrastructure + if slow_tests.contains(test_name) + test(test_name, exe, env : test_env, timeout : 120, suite : ['gio', 'slow']) + else + test(test_name, exe, env : test_env, suite : ['gio']) + endif endforeach exe = executable('gdbus-test-codegen-old', 'gdbus-test-codegen.c', @@ -293,13 +306,16 @@ foreach test_name : gio_tests # This is peer to peer so it doesn't need a session bus, so we can run # it automatically as a test by default extra_deps = [libgdbus_example_objectmanager_dep] + elif test_name == 'tls-certificate' or test_name == 'tls-interaction' + srcs += ['gtesttlsbackend.c'] endif exe = executable(test_name, srcs, install : false, c_args : test_c_args, dependencies : common_gio_tests_deps + extra_deps) - if test_name == 'testfilemonitor' - test(test_name, exe, env : test_env, timeout : 45, suite : ['gio', 'slow']) + # These tests may take more than 30 seconds to run on the CI infrastructure + if slow_tests.contains(test_name) + test(test_name, exe, env : test_env, timeout : 120, suite : ['gio', 'slow']) else test(test_name, exe, env : test_env, suite : ['gio']) endif @@ -332,8 +348,6 @@ uninstalled_test_extra_programs = [ ['send-data'], ['socket-server'], ['socket-client', ['gtlsconsoleinteraction.c']], - ['tls-certificate', ['gtesttlsbackend.c']], - ['tls-interaction', ['gtesttlsbackend.c']], # These three are manual-run tests because they need a session bus but don't bring one up themselves # FIXME: these build but don't seem to work! ['gdbus-example-objectmanager-client', [], [libgdbus_example_objectmanager_dep]], diff --git a/glib/tests/meson.build b/glib/tests/meson.build index 7c49d579c..a2c6973a0 100644 --- a/glib/tests/meson.build +++ b/glib/tests/meson.build @@ -18,6 +18,7 @@ glib_tests = [ 'error', 'fileutils', 'gdatetime', + 'guuid', 'gvariant', 'hash', 'hmac', diff --git a/tests/refcount/meson.build b/tests/refcount/meson.build index 246bd12e7..9046bf7c7 100644 --- a/tests/refcount/meson.build +++ b/tests/refcount/meson.build @@ -3,7 +3,7 @@ refcount_tests = [ ['objects', 'objects.c', []], ['objects2', 'objects2.c', [], 90], ['properties', 'properties.c', []], - ['properties2', 'properties2.c', []], + ['properties2', 'properties2.c', [], 90], ['properties3', 'properties3.c', [], 90], # extra long timeout ['properties4', 'properties4.c', []], ['signal1', 'signals.c', ['-DTESTNUM=1']], |