Merge branch 'wip/pwithnall/3458-scan-build' into 'main'

ci: Fix subproject initialisation for scan-build and coverity

Closes #3458

See merge request GNOME/glib!4273
This commit is contained in:
Philip Withnall 2024-09-13 15:24:32 +00:00
commit cf0a969101
2 changed files with 15 additions and 3 deletions

View File

@ -789,9 +789,11 @@ scan-build:
--exclude girepository/cmph/
--exclude glib/libcharset/
--exclude gio/xdgmime/
--exclude meson-private/
-disable-checker deadcode.DeadStores
--status-bugs
before_script:
- !reference [".build-linux", "before_script"]
- !reference [".build-gobject-introspection", "before_script"]
script:
- meson setup ${MESON_COMMON_OPTIONS}
@ -826,6 +828,7 @@ scan-build:
# cov-build doesnt like GLIB_DEPRECATED_ENUMERATOR
CFLAGS: '-DGLIB_DISABLE_DEPRECATION_WARNINGS'
before_script:
- !reference [".build-linux", "before_script"]
- !reference [".build-gobject-introspection", "before_script"]
script:
- meson setup ${MESON_COMMON_OPTIONS}

View File

@ -45,7 +45,11 @@ nop (void)
{
}
static guint n_handlers = 0;
static guint
choose_n_handlers (void)
{
return g_test_perf () ? 500000 : 1;
}
static void
test_connect_many (void)
@ -53,6 +57,7 @@ test_connect_many (void)
MyObj *o;
gdouble time_elapsed;
guint i;
const guint n_handlers = choose_n_handlers ();
o = g_object_new (my_obj_get_type (), NULL);
@ -75,6 +80,7 @@ test_disconnect_many_ordered (void)
gulong *handlers;
gdouble time_elapsed;
guint i;
const guint n_handlers = choose_n_handlers ();
handlers = g_malloc_n (n_handlers, sizeof (*handlers));
o = g_object_new (my_obj_get_type (), NULL);
@ -102,6 +108,7 @@ test_disconnect_many_inverse (void)
gulong *handlers;
gdouble time_elapsed;
guint i;
const guint n_handlers = choose_n_handlers ();
handlers = g_malloc_n (n_handlers, sizeof (*handlers));
o = g_object_new (my_obj_get_type (), NULL);
@ -130,6 +137,7 @@ test_disconnect_many_random (void)
gulong id;
gdouble time_elapsed;
guint i, j;
const guint n_handlers = choose_n_handlers ();
handlers = g_malloc_n (n_handlers, sizeof (*handlers));
o = g_object_new (my_obj_get_type (), NULL);
@ -166,6 +174,7 @@ test_disconnect_2_signals (void)
gulong id;
gdouble time_elapsed;
guint i, j;
const guint n_handlers = choose_n_handlers ();
handlers = g_malloc_n (n_handlers, sizeof (*handlers));
o = g_object_new (my_obj_get_type (), NULL);
@ -208,6 +217,7 @@ test_disconnect_2_objects (void)
gulong id;
gdouble time_elapsed;
guint i, j;
const guint n_handlers = choose_n_handlers ();
handlers = g_malloc_n (n_handlers, sizeof (*handlers));
objects = g_malloc_n (n_handlers, sizeof (*objects));
@ -262,6 +272,7 @@ test_block_many (void)
gulong id;
gdouble time_elapsed;
guint i, j;
const guint n_handlers = choose_n_handlers ();
handlers = g_malloc_n (n_handlers, sizeof (*handlers));
o = g_object_new (my_obj_get_type (), NULL);
@ -298,8 +309,6 @@ main (int argc, char *argv[])
{
g_test_init (&argc, &argv, NULL);
n_handlers = g_test_perf () ? 500000 : 1;
g_test_add_func ("/signal/handler/connect-many", test_connect_many);
g_test_add_func ("/signal/handler/disconnect-many-ordered", test_disconnect_many_ordered);
g_test_add_func ("/signal/handler/disconnect-many-inverse", test_disconnect_many_inverse);