Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[infra] Indicate coverage run failure when libFuzzer reports an error #13103

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion infra/base-images/base-runner/coverage
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,14 @@ function run_fuzz_target {

export LLVM_PROFILE_FILE=$profraw_file
timeout $TIMEOUT $OUT/$target $args &> $LOGS_DIR/$target.log
if (( $? != 0 )); then
cov_retcode=$?

target_error_log="$LOGS_DIR/${target}_error.log"
grep -E "==[0-9]+== ERROR: libFuzzer:" "$LOGS_DIR/$target.log" > "$target_error_log"
grep_retcode=$?

echo "Cov returncode: $cov_retcode, grep returncode: $grep_retcode"
if (( $cov_retcode != 0 || $grep_retcode == 0 )); then
echo "Error occured while running $target:"
cat $LOGS_DIR/$target.log
fi
Expand All @@ -126,6 +133,12 @@ function run_fuzz_target {
llvm-cov export -summary-only -instr-profile=$profdata_file -object=$target \
$shared_libraries $LLVM_COV_COMMON_ARGS > $FUZZER_STATS_DIR/$target.json

# If grep returned zero an error was matched.
echo "Coverage error, creating log file: $FUZZER_STATS_DIR/${target}_error.log"
if (( $cov_retcode != 0 || $grep_retcode == 0 )); then
mv "$target_error_log" "$FUZZER_STATS_DIR/${target}_error.log";
fi

# For introspector.
llvm-cov show -instr-profile=$profdata_file -object=$target -line-coverage-gt=0 $shared_libraries $BRANCH_COV_ARGS $LLVM_COV_COMMON_ARGS > ${TEXTCOV_REPORT_DIR}/$target.covreport
}
Expand Down
Loading