Merge branch 'wip/smcv/deprecated-prop-followup' into 'main'

Run tests with G_ENABLE_DIAGNOSTIC=1

See merge request GNOME/glib!2889
This commit is contained in:
Philip Withnall 2022-10-15 21:31:29 +00:00
commit 4bc284fca6
9 changed files with 30 additions and 16 deletions

View File

@ -193,6 +193,9 @@ main (int argc, char **argv)
g_setenv ("GIO_USE_VFS", "local", TRUE);
g_setenv ("GSETTINGS_BACKEND", "memory", TRUE);
/* Disable deprecation warnings when we poke at deprecated properties */
g_setenv ("G_ENABLE_DIAGNOSTIC", "0", TRUE);
g_test_init (&argc, &argv, NULL);
/* Create one test bus for all tests, as we have a lot of very small

View File

@ -158,7 +158,7 @@ python_tests = [
'codegen.py',
]
test_env = environment()
test_env = environment(common_test_env)
test_env.set('G_TEST_SRCDIR', meson.current_source_dir())
test_env.set('G_TEST_BUILDDIR', meson.current_build_dir())
test_env.set('GIO_MODULE_DIR', '')

View File

@ -258,11 +258,9 @@ if installed_tests_enabled
)
endif
test_env = environment()
test_env = environment(common_test_env)
test_env.set('G_TEST_SRCDIR', meson.current_source_dir())
test_env.set('G_TEST_BUILDDIR', meson.current_build_dir())
test_env.set('G_DEBUG', 'gc-friendly')
test_env.set('MALLOC_CHECK_', '2')
test_deps = [libm, thread_dep, libglib_dep]
test_cargs = ['-DG_LOG_DOMAIN="GLib"', '-UG_DISABLE_ASSERT']

View File

@ -56,11 +56,9 @@ if get_option('default_library') != 'static'
endforeach
endif
test_env = environment()
test_env = environment(common_test_env)
test_env.set('G_TEST_SRCDIR', meson.current_source_dir())
test_env.set('G_TEST_BUILDDIR', meson.current_build_dir())
test_env.set('G_DEBUG', 'gc-friendly')
test_env.set('MALLOC_CHECK_', '2')
test_deps = [libm, thread_dep, libglib_dep, libgmodule_dep]
test_cargs = ['-DG_LOG_DOMAIN="GModule"', '-UG_DISABLE_ASSERT']

View File

@ -128,12 +128,9 @@ python_tests = [
'mkenums.py',
]
# FIXME: put common bits of test environment() in one location
test_env = environment()
test_env = environment(common_test_env)
test_env.set('G_TEST_SRCDIR', meson.current_source_dir())
test_env.set('G_TEST_BUILDDIR', meson.current_build_dir())
test_env.set('G_DEBUG', 'gc-friendly')
test_env.set('MALLOC_CHECK_', '2')
test_deps = [libm, thread_dep, libglib_dep, libgobject_dep]
test_cargs = ['-DG_LOG_DOMAIN="GLib-GObject"', '-UG_DISABLE_ASSERT']

View File

@ -3,12 +3,9 @@ gobject_tests = {
'performance-threaded' : { 'args' : [ '--seconds', '0' ] },
}
# FIXME: put common bits of test environment() in one location
test_env = environment()
test_env = environment(common_test_env)
test_env.set('G_TEST_SRCDIR', meson.current_source_dir())
test_env.set('G_TEST_BUILDDIR', meson.current_build_dir())
test_env.set('G_DEBUG', 'gc-friendly')
test_env.set('MALLOC_CHECK_', '2')
test_deps = [libm, thread_dep, libglib_dep, libgobject_dep]
test_cargs = ['-DG_LOG_DOMAIN="GLib-GObject"', '-UG_DISABLE_ASSERT']

View File

@ -336,6 +336,20 @@ test_initially_unowned (void)
g_assert_cmpint (obj->ref_count, ==, 1);
g_object_unref (obj);
if (g_test_undefined ())
{
obj = g_object_new (G_TYPE_INITIALLY_UNOWNED, NULL);
#ifdef G_ENABLE_DEBUG
g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_CRITICAL,
"A floating object GInitiallyUnowned * was finalized*");
#endif
g_object_unref (obj);
#ifdef G_ENABLE_DEBUG
g_test_assert_expected_messages ();
#endif
}
}
static void
@ -945,6 +959,8 @@ main (int argc, char **argv)
{
g_test_init (&argc, &argv, NULL);
g_setenv ("G_ENABLE_DIAGNOSTIC", "1", TRUE);
g_test_add_func ("/type/fundamentals", test_fundamentals);
g_test_add_func ("/type/qdata", test_type_qdata);
g_test_add_func ("/type/query", test_type_query);

View File

@ -185,7 +185,7 @@ test_interface_check (void)
check_called = 0;
g_type_add_interface_check (&check_called, check_func);
o = g_object_new (bazo_get_type (), NULL);
o = g_object_ref_sink (g_object_new (bazo_get_type (), NULL));
g_object_unref (o);
g_assert_cmpint (check_called, ==, 1);
g_type_remove_interface_check (&check_called, check_func);

View File

@ -2330,6 +2330,11 @@ if want_systemtap and enable_dtrace
enable_systemtap = true
endif
common_test_env = [
'G_DEBUG=gc-friendly',
'G_ENABLE_DIAGNOSTIC=1',
'MALLOC_CHECK_=2',
]
test_timeout = 60
test_timeout_slow = 180