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
This commit is contained in:
Xavier Claessens 2018-07-13 15:46:21 +00:00
commit c96f987f0d
5 changed files with 30 additions and 12 deletions

View File

@ -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;
}

View File

@ -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;

View File

@ -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)
# 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]],

View File

@ -18,6 +18,7 @@ glib_tests = [
'error',
'fileutils',
'gdatetime',
'guuid',
'gvariant',
'hash',
'hmac',

View File

@ -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']],