[CI][Fuzz] Fix Travis-CI fuzzer tests
authorNick Terrell <terrelln@fb.com>
Thu, 20 Aug 2020 01:19:11 +0000 (18:19 -0700)
committerNick Terrell <terrelln@fb.com>
Thu, 20 Aug 2020 01:48:10 +0000 (18:48 -0700)
Fixes #781

ossfuzz/travisoss.sh

index 5ea884c..218f4d6 100755 (executable)
@@ -12,7 +12,12 @@ then
 fi
 
 # Modify the oss-fuzz Dockerfile so that we're checking out the current branch on travis.
-sed -i "s@https://github.com/lz4/lz4.git@-b $TRAVIS_BRANCH https://github.com/lz4/lz4.git@" /tmp/ossfuzz/projects/lz4/Dockerfile
+if [ "x${TRAVIS_PULL_REQUEST}" -eq "xfalse" ]
+then
+    sed -i "s@https://github.com/lz4/lz4.git@-b ${TRAVIS_BRANCH} https://github.com/lz4/lz4.git@" /tmp/ossfuzz/projects/lz4/Dockerfile
+else
+    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
+fi
 
 # Try and build the fuzzers
 pushd /tmp/ossfuzz