Skip to content

Commit

Permalink
[libfuzzer] Resolve source URL at the same time as revision URL
Browse files Browse the repository at this point in the history
  • Loading branch information
pyoor committed Jun 25, 2024
1 parent d8c362e commit 298bd5f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions recipes/linux/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ function apt-install-auto () {
fi
}

# Follow redirects and resolve a url
function resolve-url () {
curl --connect-timeout 25 --fail --location --retry 5 --show-error --silent --head --write-out "%{url_effective}" "$@" -o /dev/null
}

# wrap curl with sane defaults
function retry-curl () {
curl --connect-timeout 25 --fail --location --retry 5 --show-error --silent --write-out "%{stderr}[downloaded %{url_effective}]\n" "$@"
Expand Down
4 changes: 3 additions & 1 deletion services/libfuzzer/coverage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ source ~/.local/bin/common.sh
export COVERAGE=1

export ARTIFACT_ROOT="https://community-tc.services.mozilla.com/api/index/v1/task/project.fuzzing.coverage-revision.latest/artifacts/public"
SOURCE_URL="$(resolve-url "$ARTIFACT_ROOT/source.zip")"
export SOURCE_URL

if [[ -z "$REVISION" ]]; then
REVISION="$(retry-curl --compressed "$ARTIFACT_ROOT/coverage-revision.txt")"
Expand Down Expand Up @@ -65,7 +67,7 @@ timeout --foreground -s 2 -k $((COVRUNTIME + 60)) "$COVRUNTIME" ./libfuzzer.sh |

# %<---[Coverage]-------------------------------------------------------------

retry-curl --compressed -O "$ARTIFACT_ROOT/source.zip"
retry-curl --compressed -O "$SOURCE_URL"
unzip source.zip

# Collect coverage count data.
Expand Down

0 comments on commit 298bd5f

Please sign in to comment.