1*27162e4eSAndroid Build Coastguard Worker#!/bin/bash 2*27162e4eSAndroid Build Coastguard Worker 3*27162e4eSAndroid Build Coastguard Workerset -ex 4*27162e4eSAndroid Build Coastguard Worker 5*27162e4eSAndroid Build Coastguard Worker# Clone the oss-fuzz repository 6*27162e4eSAndroid Build Coastguard Workergit clone https://github.com/google/oss-fuzz.git /tmp/ossfuzz 7*27162e4eSAndroid Build Coastguard Worker 8*27162e4eSAndroid Build Coastguard Workerif [[ ! -d /tmp/ossfuzz/projects/lz4 ]] 9*27162e4eSAndroid Build Coastguard Workerthen 10*27162e4eSAndroid Build Coastguard Worker echo "Could not find the lz4 project in ossfuzz" 11*27162e4eSAndroid Build Coastguard Worker exit 1 12*27162e4eSAndroid Build Coastguard Workerfi 13*27162e4eSAndroid Build Coastguard Worker 14*27162e4eSAndroid Build Coastguard Worker# Modify the oss-fuzz Dockerfile so that we're checking out the current branch on travis. 15*27162e4eSAndroid Build Coastguard Workerif [ "x${TRAVIS_PULL_REQUEST}" = "xfalse" ] 16*27162e4eSAndroid Build Coastguard Workerthen 17*27162e4eSAndroid Build Coastguard Worker sed -i "s@https://github.com/lz4/lz4.git@-b ${TRAVIS_BRANCH} https://github.com/lz4/lz4.git@" /tmp/ossfuzz/projects/lz4/Dockerfile 18*27162e4eSAndroid Build Coastguard Workerelse 19*27162e4eSAndroid Build Coastguard Worker sed -i "s@https://github.com/lz4/lz4.git@-b ${TRAVIS_PULL_REQUEST_BRANCH} https://github.com/${TRAVIS_PULL_REQUEST_SLUG}.git@" /tmp/ossfuzz/projects/lz4/Dockerfile 20*27162e4eSAndroid Build Coastguard Workerfi 21*27162e4eSAndroid Build Coastguard Worker 22*27162e4eSAndroid Build Coastguard Worker# Try and build the fuzzers 23*27162e4eSAndroid Build Coastguard Workerpushd /tmp/ossfuzz 24*27162e4eSAndroid Build Coastguard Workerpython infra/helper.py build_image --pull lz4 25*27162e4eSAndroid Build Coastguard Workerpython infra/helper.py build_fuzzers lz4 26*27162e4eSAndroid Build Coastguard Workerpopd 27