2019-06-28 20:22:51 +08:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -ex
|
|
|
|
|
|
|
|
PROJECT_NAME=jansson
|
|
|
|
|
|
|
|
# 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 jansson project is not expected to exist
|
|
|
|
# on oss-fuzz.
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2019-07-24 17:39:35 +08:00
|
|
|
# Work out which repo to clone from, inside Docker
|
|
|
|
if [[ ${TRAVIS_PULL_REQUEST} != "false" ]]
|
|
|
|
then
|
|
|
|
# Pull-request branch
|
|
|
|
REPO=${TRAVIS_PULL_REQUEST_SLUG}
|
|
|
|
else
|
|
|
|
# Push build.
|
|
|
|
REPO=${TRAVIS_REPO_SLUG}
|
|
|
|
fi
|
|
|
|
|
2019-06-28 20:22:51 +08:00
|
|
|
# Modify the oss-fuzz Dockerfile so that we're checking out the current branch on travis.
|
2019-07-24 17:39:35 +08:00
|
|
|
sed -i "s@https://github.com/akheron/jansson.git@-b ${TRAVIS_BRANCH} https://github.com/${REPO}.git@" /tmp/ossfuzz/projects/${PROJECT_NAME}/Dockerfile
|
2019-06-28 20:22:51 +08:00
|
|
|
|
|
|
|
# Try and build the fuzzers
|
|
|
|
pushd /tmp/ossfuzz
|
|
|
|
python infra/helper.py build_image --pull ${PROJECT_NAME}
|
|
|
|
python infra/helper.py build_fuzzers ${PROJECT_NAME}
|
|
|
|
popd
|