mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-03 17:56:17 +01:00
build: Use add_test_setup() to allow tests to be run under valgrind
This means we can specify the standard options for testing GLib under valgrind consistently, so that developers can use `meson test --setup=valgrind` to run them. Port the existing valgrind CI to use them (this will not change its functional behaviour). Suggested by Marco Trevisan at https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2717#note_1478891. Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
This commit is contained in:
parent
594a70bf5f
commit
f5baecdb36
@ -225,8 +225,7 @@ valgrind:
|
|||||||
# See https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2710
|
# See https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2710
|
||||||
- ulimit -Sn 1024
|
- ulimit -Sn 1024
|
||||||
- bash -x ./.gitlab-ci/run-tests.sh
|
- bash -x ./.gitlab-ci/run-tests.sh
|
||||||
--wrap "valgrind --tool=memcheck --error-exitcode=1 --track-origins=yes --leak-check=full --leak-resolution=high --num-callers=50 --show-leak-kinds=definite,possible --show-error-list=yes --suppressions=${CI_PROJECT_DIR}/tools/glib.supp"
|
--setup valgrind
|
||||||
--no-suite no-valgrind
|
|
||||||
--no-suite slow
|
--no-suite slow
|
||||||
# FIXME: Remove this when we have zero valgrind leaks.
|
# FIXME: Remove this when we have zero valgrind leaks.
|
||||||
# https://gitlab.gnome.org/GNOME/glib/issues/333
|
# https://gitlab.gnome.org/GNOME/glib/issues/333
|
||||||
|
24
meson.build
24
meson.build
@ -102,6 +102,30 @@ installed_tests_template_tap = files('tests/template-tap.test.in')
|
|||||||
# Don’t build the tests unless we can run them (either natively, in an exe wrapper, or by installing them for later use)
|
# Don’t build the tests unless we can run them (either natively, in an exe wrapper, or by installing them for later use)
|
||||||
build_tests = get_option('tests') and (meson.can_run_host_binaries() or installed_tests_enabled)
|
build_tests = get_option('tests') and (meson.can_run_host_binaries() or installed_tests_enabled)
|
||||||
|
|
||||||
|
# Allow the tests to be easily run under valgrind using --setup=valgrind
|
||||||
|
valgrind = find_program('valgrind', required: false)
|
||||||
|
if valgrind.found()
|
||||||
|
suppression_file = files('tools' / 'glib.supp')
|
||||||
|
|
||||||
|
add_test_setup('valgrind',
|
||||||
|
exclude_suites: [ 'no-valgrind' ],
|
||||||
|
exe_wrapper: [
|
||||||
|
valgrind,
|
||||||
|
'--tool=memcheck',
|
||||||
|
'--error-exitcode=1',
|
||||||
|
'--track-origins=yes',
|
||||||
|
'--leak-check=full',
|
||||||
|
'--leak-resolution=high',
|
||||||
|
'--num-callers=50',
|
||||||
|
'--show-leak-kinds=definite,possible',
|
||||||
|
'--show-error-list=yes',
|
||||||
|
'--suppressions=@0@'.format(meson.project_source_root() /
|
||||||
|
'@0@'.format(suppression_file[0])),
|
||||||
|
],
|
||||||
|
timeout_multiplier: 10,
|
||||||
|
)
|
||||||
|
endif
|
||||||
|
|
||||||
add_project_arguments('-D_GNU_SOURCE', language: 'c')
|
add_project_arguments('-D_GNU_SOURCE', language: 'c')
|
||||||
|
|
||||||
if host_system == 'qnx'
|
if host_system == 'qnx'
|
||||||
|
Loading…
Reference in New Issue
Block a user