Merge pull request #17599 from yuwata/meson-fuzz-tests

meson: do not build fuzzers when -Dfuzz-tests=false
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2020-11-17 10:16:47 +01:00 committed by GitHub
commit ffe3533eb7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 10 additions and 10 deletions

View file

@ -103,7 +103,7 @@ for args in "${ARGS[@]}"; do
SECONDS=0
info "Checking build with $args"
if ! AR="$AR" CC="$CC" CXX="$CXX" CFLAGS="-Werror" CXXFLAGS="-Werror" meson -Dtests=unsafe -Dslow-tests=true --werror $args build; then
if ! AR="$AR" CC="$CC" CXX="$CXX" CFLAGS="-Werror" CXXFLAGS="-Werror" meson -Dtests=unsafe -Dslow-tests=true -Dfuzz-tests=true --werror $args build; then
fatal "meson failed with $args"
fi

View file

@ -3438,7 +3438,7 @@ endif
fuzzer_exes = []
if get_option('tests') != 'false'
if fuzz_tests or fuzzer_build
foreach tuple : fuzzers
sources = tuple[0]
link_with = tuple[1].length() > 0 ? tuple[1] : [libshared]
@ -3560,7 +3560,7 @@ foreach tuple : sanitizers
if name != prev
if want_tests == 'false'
message('Not compiling @0@ because tests is set to false'.format(name))
elif slow_tests or fuzz_tests
elif fuzz_tests
exe = custom_target(
name,
output : name,
@ -3570,12 +3570,12 @@ foreach tuple : sanitizers
'@OUTPUT@'],
build_by_default : true)
else
message('Not compiling @0@ because slow-tests/fuzz-tests is set to false'.format(name))
message('Not compiling @0@ because fuzz-tests is set to false'.format(name))
endif
endif
prev = name
if want_tests != 'false' and (slow_tests or fuzz_tests)
if fuzz_tests
test('@0@:@1@:@2@'.format(b, c, sanitizer),
env,
env : ['UBSAN_OPTIONS=print_stacktrace=1:print_summary=1:halt_on_error=1'],

View file

@ -86,7 +86,7 @@ EOF
# disable autopkgtests which are not for upstream
sed -i '/# NOUPSTREAM/ q' debian/tests/control
# enable more unit tests
sed -i '/^CONFFLAGS =/ s/=/= --werror -Dtests=unsafe -Dsplit-usr=true -Dslow-tests=true -Dman=true /' debian/rules
sed -i '/^CONFFLAGS =/ s/=/= --werror -Dtests=unsafe -Dsplit-usr=true -Dslow-tests=true -Dfuzz-tests=true -Dman=true /' debian/rules
# no orig tarball
echo '1.0' > debian/source/format

View file

@ -15,7 +15,7 @@ sanitize_address_undefined = custom_target(
project_source_root,
'@OUTPUT@',
'fuzzers',
'-Db_lundef=false -Db_sanitize=address,undefined @0@'.format(optimization),
'-Dfuzz-tests=true -Db_lundef=false -Db_sanitize=address,undefined @0@'.format(optimization),
' '.join(cc.cmd_array()),
cxx_cmd])

View file

@ -61,7 +61,7 @@ for phase in "${PHASES[@]}"; do
ENV_VARS="-e CC=clang -e CXX=clang++"
MESON_ARGS="--optimization=1"
fi
docker exec $ENV_VARS -it $CONT_NAME meson --werror -Dtests=unsafe -Dslow-tests=true -Dsplit-usr=true -Dman=true $MESON_ARGS build
docker exec $ENV_VARS -it $CONT_NAME meson --werror -Dtests=unsafe -Dslow-tests=true -Dfuzz-tests=true -Dsplit-usr=true -Dman=true $MESON_ARGS build
$DOCKER_EXEC ninja -v -C build
docker exec -e "TRAVIS=$TRAVIS" -it $CONT_NAME ninja -C build test
;;

View file

@ -83,12 +83,12 @@ for phase in "${PHASES[@]}"; do
RUN)
info "Run phase"
# Build systemd
$DOCKER_EXEC meson --werror -Dtests=unsafe -Dslow-tests=true build
$DOCKER_EXEC meson --werror -Dtests=unsafe -Dslow-tests=true -Dfuzz-tests=true build
$DOCKER_EXEC ninja -v -C build
$DOCKER_EXEC ninja -C build test
;;
RUN_CLANG)
docker exec -e CC=clang -e CXX=clang++ -it $CONT_NAME meson --werror -Dtests=unsafe -Dslow-tests=true -Dman=true build
docker exec -e CC=clang -e CXX=clang++ -it $CONT_NAME meson --werror -Dtests=unsafe -Dslow-tests=true -Dfuzz-tests=true -Dman=true build
$DOCKER_EXEC ninja -v -C build
$DOCKER_EXEC ninja -C build test
;;