endif
if want_libfuzzer
- fuzzing_engine = meson.get_compiler('cpp').find_library('Fuzzer', required : false)
- if fuzzing_engine.found()
- userspace_c_args += '-fsanitize-coverage=trace-pc-guard,trace-cmp'
- elif cc.has_argument('-fsanitize=fuzzer-no-link')
+ if cc.has_argument('-fsanitize=fuzzer-no-link')
userspace_c_args += '-fsanitize=fuzzer-no-link'
else
- error('Looks like neither libFuzzer nor -fsanitize=fuzzer-no-link is supported')
+ error('Looks like -fsanitize=fuzzer-no-link is not supported')
endif
elif want_ossfuzz
fuzzing_engine = meson.get_compiler('cpp').find_library('FuzzingEngine')
'install' : false,
}
-if want_ossfuzz or (want_libfuzzer and fuzzing_engine.found())
+if want_ossfuzz
fuzz_additional_kwargs = {
'dependencies' : fuzzing_engine,
}
-elif want_libfuzzer and not fuzzing_engine.found()
+elif want_libfuzzer
fuzz_additional_kwargs = {
'link_args' : ['-fsanitize=fuzzer'],
}
if is_fuzz
fuzzer_exes += exe
- if want_tests != 'false'
- # Run the fuzz regression tests without any sanitizers enabled.
- # Additional invocations with sanitizers may get added below.
+ if want_tests != 'false' and want_fuzz_tests
fuzz_ins = fuzz_regression_tests.get(name, {})
foreach directive : fuzz_ins.get('directives', [])
tt = '@0@_@1@'.format(name, fs.name(directive.full_path()))
exe,
suite : 'fuzz',
args : directive.full_path(),
+ env : ['UBSAN_OPTIONS=print_stacktrace=1:print_summary=1:halt_on_error=1'],
+ timeout : 60,
depends : directive)
endforeach
foreach file : fuzz_ins.get('files', [])
test(tt,
exe,
suite : 'fuzz',
+ env : ['UBSAN_OPTIONS=print_stacktrace=1:print_summary=1:halt_on_error=1'],
+ timeout : 60,
args : file)
endforeach
endif
endif
endforeach
-# Enable tests for all supported sanitizers
-foreach tuple : fuzz_sanitizers
- sanitizer = tuple[0]
- build = tuple[1]
-
- if cc.has_link_argument('-fsanitize=@0@'.format(sanitizer))
- foreach fuzzer, fuzz_ins : fuzz_regression_tests
- name = '@0@:@1@'.format(fuzzer, sanitizer)
- if want_tests == 'false'
- message('Not compiling @0@ because tests is set to false'.format(name))
- continue
- endif
- if not want_fuzz_tests
- message('Not compiling @0@ because fuzz-tests is set to false'.format(name))
- continue
- endif
- exe = custom_target(
- name,
- output : name,
- depends : build,
- command : [ln, '-fs',
- build.full_path() / fuzzer,
- '@OUTPUT@'],
- build_by_default : true)
-
- foreach directive : fuzz_ins.get('directives', [])
- test('@0@_@1@_@2@'.format(fuzzer, fs.name(directive.full_path()), sanitizer),
- env,
- suite : 'fuzz+san',
- env : ['UBSAN_OPTIONS=print_stacktrace=1:print_summary=1:halt_on_error=1'],
- timeout : 60,
- args : [exe.full_path(), directive.full_path()],
- depends : directive)
- endforeach
- foreach file : fuzz_ins.get('files', [])
- test('@0@_@1@_@2@'.format(fuzzer, fs.name(file), sanitizer),
- env,
- suite : 'fuzz+san',
- env : ['UBSAN_OPTIONS=print_stacktrace=1:print_summary=1:halt_on_error=1'],
- timeout : 60,
- args : [exe.full_path(), file])
- endforeach
- endforeach
- endif
-endforeach
-
#####################################################################
if git.found()
description : 'enable extra tests with =unsafe')
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 (with sanitizers)')
+option('fuzz-tests', type : 'boolean', value : true,
+ description : 'run the fuzzer regression tests')
option('install-tests', type : 'boolean', value : false,
description : 'install test executables')
option('log-message-verification', type : 'feature', deprecated : { 'true' : 'enabled', 'false' : 'disabled' },
############################################################
-if meson.version().version_compare('>=1.3.0')
- sanitize_auto_features = '@0@'.format(get_option('auto_features'))
-else
- if get_option('auto_features').enabled()
- sanitize_auto_features = 'enabled'
- elif get_option('auto_features').disabled()
- sanitize_auto_features = 'disabled'
- else
- sanitize_auto_features = 'auto'
- endif
-endif
-
-fuzz_c_args = get_option('c_args')
-fuzz_cpp_args = cxx_cmd != '' ? get_option('cpp_args') : []
-
-sanitize_address_undefined = custom_target(
- 'sanitize-address-undefined-fuzzers',
- output : 'sanitize-address-undefined-fuzzers',
- command : [meson_build_sh,
- meson.project_source_root(),
- '@OUTPUT@',
- 'fuzzers',
- ' '.join(fuzz_c_args + '-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION'),
- ' '.join(fuzz_cpp_args + '-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION'),
- '-Dfuzz-tests=true -Db_lundef=false -Db_sanitize=address,undefined --optimization=@0@ @1@ --auto-features=@2@'.format(
- get_option('optimization'),
- get_option('werror') ? '--werror' : '',
- sanitize_auto_features
- ),
- ' '.join(cc.cmd_array()),
- cxx_cmd])
-
-fuzz_sanitizers = [['address,undefined', sanitize_address_undefined]]
fuzz_testsdir = 'test/fuzz'
if git.found() and fs.is_dir(meson.project_source_root() / '.git')