From 69110e1f33194c09110d2014737a1c754af01d63 Mon Sep 17 00:00:00 2001 From: Mike Aizatsky Date: Sun, 7 Aug 2016 19:53:25 -0700 Subject: [PATCH] [infra] no need to call /env --- boringssl/build.sh | 2 -- expat/build.sh | 2 -- freetype2/build.sh | 2 -- infra/base-images/base-clang/Dockerfile | 2 -- infra/base-images/base-libfuzzer/Dockerfile | 10 +++++----- .../{base-clang/env => base-libfuzzer/run} | 19 ++++++++++--------- infra/libfuzzer-pipeline.groovy | 2 +- 7 files changed, 16 insertions(+), 23 deletions(-) rename infra/base-images/{base-clang/env => base-libfuzzer/run} (70%) mode change 100644 => 100755 diff --git a/boringssl/build.sh b/boringssl/build.sh index 8f8371bd7..a92316227 100755 --- a/boringssl/build.sh +++ b/boringssl/build.sh @@ -15,8 +15,6 @@ # limitations under the License. # ################################################################################ -. /env - mkdir -p /work/boringssl cd /work/boringssl diff --git a/expat/build.sh b/expat/build.sh index 78ab6aa2e..922a35716 100755 --- a/expat/build.sh +++ b/expat/build.sh @@ -1,6 +1,4 @@ #!/bin/bash -eu -. /env - cd /src/expat/expat ./buildconf.sh diff --git a/freetype2/build.sh b/freetype2/build.sh index 578c7c76b..cf6bd669c 100755 --- a/freetype2/build.sh +++ b/freetype2/build.sh @@ -15,8 +15,6 @@ # limitations under the License. # ################################################################################ -. /env - cd /src/freetype2/ ./autogen.sh diff --git a/infra/base-images/base-clang/Dockerfile b/infra/base-images/base-clang/Dockerfile index 99ea4fd6c..4bcc3d757 100644 --- a/infra/base-images/base-clang/Dockerfile +++ b/infra/base-images/base-clang/Dockerfile @@ -59,5 +59,3 @@ ENV CXXFLAGS_EXTRA "-stdlib=libc++" ENV CXXFLAGS "$CFLAGS $CXXFLAGS_EXTRA" ENV LDFLAGS "-Wl,-Bstatic -lc++ -lc++abi -Wl,-Bdynamic" - -COPY env / diff --git a/infra/base-images/base-libfuzzer/Dockerfile b/infra/base-images/base-libfuzzer/Dockerfile index 8fd973242..8f2af3260 100644 --- a/infra/base-images/base-libfuzzer/Dockerfile +++ b/infra/base-images/base-libfuzzer/Dockerfile @@ -23,13 +23,13 @@ VOLUME /src/oss-fuzz RUN mkdir -p /work/libfuzzer -ENV sanitizer_flags="-fsanitize=address" -ENV cov_flags="-fsanitize-coverage=edge,indirect-calls,8bit-counters" +ENV SANITIZER_FLAGS="-fsanitize=address" +ENV COV_FLAGS="-fsanitize-coverage=edge,indirect-calls,8bit-counters" ENV ASAN_OPTIONS="symbolize=1" -ENV CFLAGS "$CFLAGS $sanitizer_flags $cov_flags" -ENV CXXFLAGS "$CFLAGS $CXXFLAGS_EXTRA" - RUN mkdir /out VOLUME /out + +COPY run / +ENTRYPOINT ["/run"] diff --git a/infra/base-images/base-clang/env b/infra/base-images/base-libfuzzer/run old mode 100644 new mode 100755 similarity index 70% rename from infra/base-images/base-clang/env rename to infra/base-images/base-libfuzzer/run index 4cdc2df64..2c0507b9c --- a/infra/base-images/base-clang/env +++ b/infra/base-images/base-libfuzzer/run @@ -15,22 +15,23 @@ # ################################################################################ -echo "CC=$CC" -echo "CXX=$CXX" -echo "CFLAGS=$CFLAGS" -echo "CXXFLAGS=$CXXFLAGS" -pushd $PWD > /dev/null +echo "---------------------------------------------------------------" + echo -n "Compiling libFuzzer..." cd /work/libfuzzer -$CXX -g -std=c++11 -stdlib=libc++ $sanitizer_flags -c /src/libfuzzer/*.cpp -I/src/libfuzzer +$CXX $CXXFLAGS -std=c++11 $SANITIZER_FLAGS -c /src/libfuzzer/*.cpp -I/src/libfuzzer echo "Done." -popd > /dev/null -export LIBCXX_FLAGS="-stdlib=libc++" -export CXXFLAGS="$CFLAGS $LIBCXX_FLAGS" +export CFLAGS="$CFLAGS $SANITIZER_FLAGS $COV_FLAGS" +export CXXFLAGS="$CFLAGS $CXXFLAGS_EXTRA" echo "CC=$CC" echo "CXX=$CXX" echo "CFLAGS=$CFLAGS" echo "CXXFLAGS=$CXXFLAGS" +echo "LDFLAGS=$LDFLAGS" + +echo "---------------------------------------------------------------" + +$* diff --git a/infra/libfuzzer-pipeline.groovy b/infra/libfuzzer-pipeline.groovy index 57aecaf39..619ffdf92 100644 --- a/infra/libfuzzer-pipeline.groovy +++ b/infra/libfuzzer-pipeline.groovy @@ -71,7 +71,7 @@ def call(body) { def zipFile= "$projectName-$sanitizer-${date}.zip" sh "mkdir -p $out" - sh "docker run -v $workspace/$checkoutDir:/src/$checkoutDir -v $workspace/oss-fuzz:/src/oss-fuzz -v $out:/out -e sanitizer_flags=\"-fsanitize=$sanitizer\" -t $dockerTag" + sh "docker run -v $workspace/$checkoutDir:/src/$checkoutDir -v $workspace/oss-fuzz:/src/oss-fuzz -v $out:/out -e SANITIZER_FLAGS=\"-fsanitize=$sanitizer\" -t $dockerTag" sh "zip -j $zipFile $out/*" sh "gsutil cp $zipFile gs://clusterfuzz-builds/$projectName/" }