diff options
Diffstat (limited to 'infra/base-images/base-runner/bad_build_check')
-rwxr-xr-x | infra/base-images/base-runner/bad_build_check | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/infra/base-images/base-runner/bad_build_check b/infra/base-images/base-runner/bad_build_check index 284d29b76..c3fa68c01 100755 --- a/infra/base-images/base-runner/bad_build_check +++ b/infra/base-images/base-runner/bad_build_check @@ -23,6 +23,10 @@ MIN_NUMBER_OF_RUNS=4 # Mercurial's bdiff_fuzzer has 116 PCs when built with ASan. THRESHOLD_FOR_NUMBER_OF_EDGES=100 +# A fuzz target is supposed to have at least two functions, such as +# LLVMFuzzerTestOneInput and an API that is being called from there. +THRESHOLD_FOR_NUMBER_OF_FUNCTIONS=2 + # Threshold values for different sanitizers used by instrumentation checks. ASAN_CALLS_THRESHOLD_FOR_ASAN_BUILD=1000 ASAN_CALLS_THRESHOLD_FOR_NON_ASAN_BUILD=0 @@ -95,8 +99,14 @@ function check_engine { return 1 fi elif [[ "$FUZZING_ENGINE" == dataflow ]]; then - # TODO(https://github.com/google/oss-fuzz/issues/1632): add check for - # binaries compiled with dataflow engine when the interface becomes stable. + $FUZZER &> $FUZZER_OUTPUT + local NUMBER_OF_FUNCTIONS=$(grep -Po "INFO:\s+\K[[:digit:]]+(?=\s+instrumented function.*)" $FUZZER_OUTPUT) + [[ -z "$NUMBER_OF_FUNCTIONS" ]] && NUMBER_OF_FUNCTIONS=0 + if (( $NUMBER_OF_FUNCTIONS < $THRESHOLD_FOR_NUMBER_OF_FUNCTIONS )); then + echo "BAD BUILD: $FUZZER does not seem to be properly built in 'dataflow' config." + cat $FUZZER_OUTPUT + return 1 + fi return 0 fi @@ -330,7 +340,7 @@ function check_seed_corpus { # Set up common fuzzing arguments, otherwise "run_fuzzer" errors out. if [ -z "$FUZZER_ARGS" ]; then - export FUZZER_ARGS="-rss_limit_mb=2048 -timeout=25" + export FUZZER_ARGS="-rss_limit_mb=2560 -timeout=25" fi bash -c "run_fuzzer $FUZZER_NAME -runs=0" &> $FUZZER_OUTPUT |