Debian Codegraph @

ossfuzz/ci_oss.sh

raw
1 #!/bin/bash
2
3 set -ex
4
5 PROJECT_NAME=libsndfile
6
7 # Clone the oss-fuzz repository
8 git clone https://github.com/google/oss-fuzz.git /tmp/ossfuzz
9
10 if [[ ! -d /tmp/ossfuzz/projects/${PROJECT_NAME} ]]
11 then
12 echo "Could not find the ${PROJECT_NAME} project in ossfuzz"
13
14 # Exit with a success code while the libsndfile project is not expected to exist
15 # on oss-fuzz.
16 exit 0
17 fi
18
19 # Work out which branch to clone from, inside Docker
20 BRANCH=${GITHUB_REF}
21
22 # Modify the oss-fuzz Dockerfile so that we're checking out the current reference on CI.
23 sed -i "s@RUN.*@RUN git config --global remote.origin.fetch '+refs/pull/*:refs/remotes/origin/pull/*' \&\& git clone https://github.com/libsndfile/libsndfile.git /src/libsndfile \&\& cd /src/libsndfile \&\& git checkout -b ${BRANCH}@" /tmp/ossfuzz/projects/${PROJECT_NAME}/Dockerfile
24
25 # Try and build the fuzzers
26 pushd /tmp/ossfuzz
27 python3 infra/helper.py build_image --pull ${PROJECT_NAME}
28 python3 infra/helper.py build_fuzzers ${PROJECT_NAME}
29 python3 infra/helper.py check_build ${PROJECT_NAME} --engine libfuzzer --sanitizer address --architecture x86_64
30 popd