diff options
author | Philip Withnall <pwithnall@endlessos.org> | 2022-06-16 11:01:04 +0100 |
---|---|---|
committer | Philip Withnall <pwithnall@endlessos.org> | 2022-06-20 11:54:10 +0100 |
commit | f5baecdb362efb6afc3f2cfa6baad3cd324267f8 (patch) | |
tree | 99ce75b96ae816e566039542900ab64a1c5d013c /meson.build | |
parent | 594a70bf5f6c5f21ca10bc5a5daecce0fd594319 (diff) | |
download | glib-f5baecdb362efb6afc3f2cfa6baad3cd324267f8.tar.gz |
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>
Diffstat (limited to 'meson.build')
-rw-r--r-- | meson.build | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/meson.build b/meson.build index ee0a6234c..7f4bae4a0 100644 --- a/meson.build +++ b/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) 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') if host_system == 'qnx' |