diff options
author | Philip Withnall <philip@tecnocode.co.uk> | 2022-06-20 11:09:55 +0000 |
---|---|---|
committer | Philip Withnall <philip@tecnocode.co.uk> | 2022-06-20 11:09:55 +0000 |
commit | 46a6f49066f5b8a593ed4b5e8fad40077dcaf1c9 (patch) | |
tree | dfd1c0698847634314b0360625857200a0b5cb30 | |
parent | b2f4df95e860673f4d215d953ea96809981b8b0a (diff) | |
parent | f5baecdb362efb6afc3f2cfa6baad3cd324267f8 (diff) | |
download | glib-46a6f49066f5b8a593ed4b5e8fad40077dcaf1c9.tar.gz |
Merge branch 'meson-add-test-setup' into 'main'
build: Use add_test_setup() to allow tests to be run under valgrind
See merge request GNOME/glib!2752
-rw-r--r-- | .gitlab-ci.yml | 3 | ||||
-rw-r--r-- | meson.build | 24 |
2 files changed, 25 insertions, 2 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 518b53e0f..ebcc25120 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -225,8 +225,7 @@ valgrind: # See https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2710 - ulimit -Sn 1024 - 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" - --no-suite no-valgrind + --setup valgrind --no-suite slow # FIXME: Remove this when we have zero valgrind leaks. # https://gitlab.gnome.org/GNOME/glib/issues/333 diff --git a/meson.build b/meson.build index 172a9a038..d886e4e48 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' |