]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
run-make-check.sh: Adding ccache tuning for the CI 22847/head
authorErwan Velu <erwan@redhat.com>
Wed, 4 Jul 2018 07:47:56 +0000 (09:47 +0200)
committerErwan Velu <erwan@redhat.com>
Wed, 4 Jul 2018 09:55:43 +0000 (11:55 +0200)
When run-make-check is run by the CI, some tuning can be performed to
speedup the build.

This commit :
- Detect jenkins by searching JENKINS_HOME env variable
- Defines the SOURCE_DATE_EPOCH to enforce a stable date across builds
- Ask cmake not to use the git versioning which adds useless entropy for a temporary build (ENABLE_GIT_VERSION=OFF)
- Define the ccache slopiness to increase efficiency
- Increase the ccache size to save multiple builds to maximise cache hit between PRs
- Print ccache statistics to evaluate ccache efficiency

Signed-off-by: Erwan Velu <erwan@redhat.com>
run-make-check.sh

index 70f0d49eb1aac4ecde5bcbe9af1248ba39220ada..0f1988196b6baca39a24d18f3a0408eecb478deb 100755 (executable)
@@ -74,9 +74,30 @@ function run() {
         CMAKE_PYTHON_OPTS="-DWITH_PYTHON2=OFF -DWITH_PYTHON3=ON -DMGR_PYTHON_VERSION=3"
     fi
 
-    $DRY_RUN ./do_cmake.sh -DWITH_FIO=ON -DWITH_GTEST_PARALLEL=ON $CMAKE_PYTHON_OPTS $@ || return 1
+    CMAKE_BUILD_OPTS="-DWITH_FIO=ON -DWITH_GTEST_PARALLEL=ON"
+
+    # Are we in the CI ?
+    if [ -n "$JENKINS_HOME" ]; then
+      echo "Jenkins got detected, let's tune the build"
+      # The following settings are made for improving ccache efficiency
+      # by removing the entropy generated by the date/time embedded in the build
+      CMAKE_BUILD_OPTS="$CMAKE_BUILD_OPTS -D ENABLE_GIT_VERSION=OFF"
+      export SOURCE_DATE_EPOCH=$(date +%D |date -f- +%s)
+      ccache -o sloppiness=time_macros
+      ccache -o run_second_cpp=true
+
+      # Build host has plenty of space available, let's use it to keep
+      # various versions of the built objects. This could increase the cache hit
+      # if the same or similar PRs are running several times
+      ccache -o max_size=100G
+      ccache -z # Reset the ccache statistics
+    fi
+    $DRY_RUN ./do_cmake.sh $CMAKE_BUILD_OPTS $CMAKE_PYTHON_OPTS $@ || return 1
     $DRY_RUN cd build
     $DRY_RUN make $BUILD_MAKEOPTS tests || return 1
+    if [ -n "$JENKINS_HOME" ]; then
+      ccache -s # print the ccache statistics to evaluate the efficiency
+    fi
     # prevent OSD EMFILE death on tests, make sure large than 1024
     $DRY_RUN ulimit -n $(ulimit -Hn)
     if [ $(ulimit -n) -lt 1024 ];then