From f78ad5f0467de5066d5fed6c5c61bd740ba82e3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Wed, 19 May 2021 16:44:13 +0200 Subject: [PATCH] test: enable fuzz regression tests by default MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This ensures that the fuzz test code is also built by default. It also increases the test coverage a bit. Compiling the tests *with* sanitizers is painfully slow, so this is not enabled. But just compiling them sauté is hardly noticable. Running the tests increases the test count and runtime: 622 tests, 26 s to 922 tests, 35 s I think this is acceptable. --- meson.build | 20 ++++++++++++++++++-- meson_options.txt | 2 +- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/meson.build b/meson.build index 2111d83870..ebdbc539c1 100644 --- a/meson.build +++ b/meson.build @@ -3440,7 +3440,7 @@ foreach tuple : fuzzers name = sources[0].split('/')[-1].split('.')[0] - fuzzer_exes += executable( + exe = executable( name, sources, include_directories : [incs, include_directories('src/fuzz')], @@ -3449,7 +3449,23 @@ foreach tuple : fuzzers c_args : defs + test_cflags, link_args: link_args, install : false, - build_by_default : fuzz_tests or fuzzer_build) + build_by_default : fuzzer_build) + fuzzer_exes += exe + + if want_tests != 'false' + # Run the fuzz regression tests without any sanitizers enabled. + # Additional invocations with sanitizers may be added below. + foreach p : fuzz_regression_tests + b = p.split('/')[-2] + c = p.split('/')[-1] + + if b == name + test('@0@_@1@'.format(b, c), + exe, + args : [join_paths(project_source_root, p)]) + endif + endforeach + endif endforeach run_target( diff --git a/meson_options.txt b/meson_options.txt index b7f30ce16b..fc58e888d9 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -393,7 +393,7 @@ option('tests', type : 'combo', choices : ['true', 'unsafe', 'false'], option('slow-tests', type : 'boolean', value : 'false', description : 'run the slow tests by default') option('fuzz-tests', type : 'boolean', value : 'false', - description : 'run the fuzzer regression tests by default') + description : 'run the fuzzer regression tests by default (with sanitizers)') option('install-tests', type : 'boolean', value : 'false', description : 'install test executables')