From d33e93b83367ea4dfabeed9cda03bc06a1ff0f6a Mon Sep 17 00:00:00 2001 From: Josh Haberman Date: Thu, 18 Feb 2016 19:13:07 -0800 Subject: Added ccache support. --- tools/docker/Dockerfile | 9 +++++++++ tools/run_tests/jenkins.sh | 4 ++++ tools/run_tests/tests.sh | 8 ++++---- tools/run_tests/travis.sh | 7 +++++-- 4 files changed, 22 insertions(+), 6 deletions(-) diff --git a/tools/docker/Dockerfile b/tools/docker/Dockerfile index b5e26f9a..b1d0c682 100644 --- a/tools/docker/Dockerfile +++ b/tools/docker/Dockerfile @@ -36,6 +36,7 @@ RUN apt-get update && apt-get install -y \ autotools-dev \ build-essential \ bzip2 \ + ccache \ curl \ gcc \ git \ @@ -53,5 +54,13 @@ RUN apt-get update && apt-get install -y \ wget \ zip && apt-get clean +# Prepare ccache +RUN ln -s /usr/bin/ccache /usr/local/bin/gcc +RUN ln -s /usr/bin/ccache /usr/local/bin/g++ +RUN ln -s /usr/bin/ccache /usr/local/bin/cc +RUN ln -s /usr/bin/ccache /usr/local/bin/c++ +RUN ln -s /usr/bin/ccache /usr/local/bin/clang +RUN ln -s /usr/bin/ccache /usr/local/bin/clang++ + # Define the default command. CMD ["bash"] diff --git a/tools/run_tests/jenkins.sh b/tools/run_tests/jenkins.sh index 34a16829..b90c099f 100755 --- a/tools/run_tests/jenkins.sh +++ b/tools/run_tests/jenkins.sh @@ -5,9 +5,13 @@ BUILD_DIR=/tmp/protobuf source $MY_DIR/tests.sh +# Set value used in tests.sh. +PARALLELISM=-j8 + rm -rf $BUILD_DIR mkdir -p $BUILD_DIR cd $BUILD_DIR git clone /var/local/jenkins/protobuf cd protobuf + build_cpp diff --git a/tools/run_tests/tests.sh b/tools/run_tests/tests.sh index f1c7e969..a6ba1405 100644 --- a/tools/run_tests/tests.sh +++ b/tools/run_tests/tests.sh @@ -4,7 +4,7 @@ # For when some other test needs the C++ main build, including protoc and # libprotobuf. internal_build_cpp() { - if [ $(uname -s) == "Linux" && "$TRAVIS" == "true" ]; then + if [[ $(uname -s) == "Linux" && "$TRAVIS" == "true" ]]; then # Install GCC 4.8 to replace the default GCC 4.6. We need 4.8 for more # decent C++ 11 support in order to compile conformance tests. sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y @@ -15,19 +15,19 @@ internal_build_cpp() { ./autogen.sh ./configure - make -j2 + make $PARALLELISM } build_cpp() { internal_build_cpp - make check -j2 + make check $PARALLELISM cd conformance && make test_cpp && cd .. } build_cpp_distcheck() { ./autogen.sh ./configure - make distcheck -j2 + make distcheck $PARALLELISM } build_csharp() { diff --git a/tools/run_tests/travis.sh b/tools/run_tests/travis.sh index 8c87a47b..f7045f1b 100755 --- a/tools/run_tests/travis.sh +++ b/tools/run_tests/travis.sh @@ -1,8 +1,8 @@ #!/usr/bin/env bash -my_dir="$(dirname "$0")" +MY_DIR="$(dirname "$0")" -source $my_dir/tests.sh +source $MY_DIR/tests.sh # Note: travis currently does not support testing more than one language so the # .travis.yml cheats and claims to only be cpp. If they add multiple language @@ -14,6 +14,9 @@ source $my_dir/tests.sh # -------- main -------- +# Set value used in tests.sh. +PARALLELISM=-j2 + if [ "$#" -ne 1 ]; then echo " Usage: $0 { cpp | -- cgit v1.2.3