aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMax Dymond <cmeister2@gmail.com>2019-07-24 10:39:35 +0100
committerMax Dymond <cmeister2@gmail.com>2019-07-24 10:43:03 +0100
commita6f436fefca1240da23cfbd9db2a016e81014f0a (patch)
tree61c3d72d2fb0a77dd06fb35187ec2c19677893f1 /test
parent1ac79b2558cfa630157ddfa96f25bbad4b7cdffc (diff)
downloadjansson-a6f436fefca1240da23cfbd9db2a016e81014f0a.zip
jansson-a6f436fefca1240da23cfbd9db2a016e81014f0a.tar.gz
jansson-a6f436fefca1240da23cfbd9db2a016e81014f0a.tar.bz2
Ensure OSS fuzz travis builds work for PRs
Use the correct repository for cloning when doing a push build or a pull-request. Only do one fuzzer build!
Diffstat (limited to 'test')
-rwxr-xr-xtest/ossfuzz/travisoss.sh12
1 files changed, 11 insertions, 1 deletions
diff --git a/test/ossfuzz/travisoss.sh b/test/ossfuzz/travisoss.sh
index e99cc6e..9fdcb2f 100755
--- a/test/ossfuzz/travisoss.sh
+++ b/test/ossfuzz/travisoss.sh
@@ -16,8 +16,18 @@ then
exit 0
fi
+# 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
+
# Modify the oss-fuzz Dockerfile so that we're checking out the current branch on travis.
-sed -i "s@https://github.com/akheron/jansson.git@-b $TRAVIS_BRANCH https://github.com/akheron/jansson.git@" /tmp/ossfuzz/projects/${PROJECT_NAME}/Dockerfile
+sed -i "s@https://github.com/akheron/jansson.git@-b ${TRAVIS_BRANCH} https://github.com/${REPO}.git@" /tmp/ossfuzz/projects/${PROJECT_NAME}/Dockerfile
# Try and build the fuzzers
pushd /tmp/ossfuzz