File: ci_oss.sh

package info (click to toggle)
libsndfile 1.2.2-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 5,120 kB
  • sloc: ansic: 55,350; cpp: 1,108; python: 791; makefile: 539; sh: 539; cs: 122
file content (30 lines) | stat: -rwxr-xr-x 1,111 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash

set -ex

PROJECT_NAME=libsndfile

# Clone the oss-fuzz repository
git clone https://github.com/google/oss-fuzz.git /tmp/ossfuzz

if [[ ! -d /tmp/ossfuzz/projects/${PROJECT_NAME} ]]
then
    echo "Could not find the ${PROJECT_NAME} project in ossfuzz"

    # Exit with a success code while the libsndfile project is not expected to exist
    # on oss-fuzz.
    exit 0
fi

# Work out which branch to clone from, inside Docker
BRANCH=${GITHUB_REF}

# Modify the oss-fuzz Dockerfile so that we're checking out the current reference on CI.
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

# Try and build the fuzzers
pushd /tmp/ossfuzz
python3 infra/helper.py build_image --pull ${PROJECT_NAME}
python3 infra/helper.py build_fuzzers ${PROJECT_NAME}
python3 infra/helper.py check_build ${PROJECT_NAME} --engine libfuzzer --sanitizer address --architecture x86_64
popd