]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: enable fuzz regression tests by default
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 19 May 2021 14:44:13 +0000 (16:44 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 20 May 2021 07:30:43 +0000 (09:30 +0200)
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
meson_options.txt

index 2111d838707e59d9e5b35f6f1f41f83949e5fcba..ebdbc539c1154f1069deb7f1884e2e7e9ec59635 100644 (file)
@@ -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(
index b7f30ce16bf54907bf65441bcc3dad8fcee49b15..fc58e888d9390a9343524659b04835215bde4b3c 100644 (file)
@@ -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')