Skip to content

Commit

Permalink
Merge pull request #486 from cmeister2/cmeister2/osstravis
Browse files Browse the repository at this point in the history
Ensure OSS fuzz travis builds work for PRs
  • Loading branch information
coreyfarrell committed Jul 24, 2019
2 parents 1ac79b2 + 7feae08 commit 0ed750a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ matrix:
exclude:
- compiler: clang
env: JANSSON_BUILD_METHOD=coverage JANSSON_CMAKE_OPTIONS="-DJANSSON_COVERAGE=ON -DJANSSON_COVERALLS=ON -DCMAKE_BUILD_TYPE=Debug" JANSSON_EXTRA_INSTALL="lcov curl"
- compiler: clang
env: JANSSON_BUILD_METHOD=fuzzer
allow_failures:
- env: JANSSON_BUILD_METHOD=coverage JANSSON_CMAKE_OPTIONS="-DJANSSON_COVERAGE=ON -DJANSSON_COVERALLS=ON -DCMAKE_BUILD_TYPE=Debug" JANSSON_EXTRA_INSTALL="lcov curl"
install:
Expand Down
14 changes: 13 additions & 1 deletion test/ossfuzz/travisoss.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,20 @@ 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}
BRANCH=${TRAVIS_PULL_REQUEST_BRANCH}
else
# Push build.
REPO=${TRAVIS_REPO_SLUG}
BRANCH=${TRAVIS_BRANCH}
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 ${BRANCH} https://github.com/${REPO}.git@" /tmp/ossfuzz/projects/${PROJECT_NAME}/Dockerfile

# Try and build the fuzzers
pushd /tmp/ossfuzz
Expand Down

0 comments on commit 0ed750a

Please sign in to comment.