2020-11-09 05:23:58 +01:00
|
|
|
# SPDX-License-Identifier: LGPL-2.1-or-later
|
2018-01-19 07:54:30 +01:00
|
|
|
|
2020-05-26 23:47:49 +02:00
|
|
|
# The 'optimization' option was introduced in meson 0.48.0, so let's keep
|
|
|
|
# the code compatible with older versions as well
|
|
|
|
if meson.version().version_compare('>=0.48.0')
|
|
|
|
optimization = '--optimization=@0@'.format(get_option('optimization'))
|
|
|
|
else
|
|
|
|
optimization = ''
|
|
|
|
endif
|
|
|
|
|
2020-05-20 11:33:12 +02:00
|
|
|
sanitize_address_undefined = custom_target(
|
|
|
|
'sanitize-address-undefined-fuzzers',
|
|
|
|
output : 'sanitize-address-undefined-fuzzers',
|
2018-01-19 07:54:30 +01:00
|
|
|
command : [meson_build_sh,
|
2019-02-27 17:19:07 +01:00
|
|
|
project_source_root,
|
2018-01-19 07:54:30 +01:00
|
|
|
'@OUTPUT@',
|
|
|
|
'fuzzers',
|
2020-11-13 07:22:07 +01:00
|
|
|
'-Dfuzz-tests=true -Db_lundef=false -Db_sanitize=address,undefined @0@'.format(optimization),
|
2018-10-03 21:52:44 +02:00
|
|
|
' '.join(cc.cmd_array()),
|
2018-10-10 11:50:57 +02:00
|
|
|
cxx_cmd])
|
2018-01-19 07:54:30 +01:00
|
|
|
|
2020-05-20 11:33:12 +02:00
|
|
|
sanitizers = [['address,undefined', sanitize_address_undefined]]
|
2018-03-14 14:27:04 +01:00
|
|
|
|
2018-08-10 17:15:05 +02:00
|
|
|
if git.found()
|
|
|
|
out = run_command(
|
2021-01-08 20:27:48 +01:00
|
|
|
'env', '-u', 'GIT_WORK_TREE',
|
2018-08-10 17:15:05 +02:00
|
|
|
git,
|
2019-02-27 17:19:07 +01:00
|
|
|
'--git-dir=@0@/.git'.format(project_source_root),
|
2021-01-08 20:27:48 +01:00
|
|
|
'ls-files', ':/test/fuzz/*/*')
|
2018-08-10 17:15:05 +02:00
|
|
|
else
|
|
|
|
out = run_command(
|
2019-02-27 17:19:07 +01:00
|
|
|
'sh', '-c', 'ls @0@/test/fuzz/*/*'.format(project_source_root))
|
2018-08-10 17:15:05 +02:00
|
|
|
endif
|
|
|
|
|
|
|
|
fuzz_regression_tests = []
|
|
|
|
foreach p : out.stdout().split()
|
|
|
|
# Remove the last entry which is ''.
|
|
|
|
#
|
|
|
|
# Also, backslashes get mangled, so skip test. See
|
|
|
|
# https://github.com/mesonbuild/meson/issues/1564.
|
|
|
|
if not p.contains('\\')
|
|
|
|
fuzz_regression_tests += p
|
|
|
|
endif
|
|
|
|
endforeach
|