BUILD_MAKEOPTS=${BUILD_MAKEOPTS:-$DEFAULT_MAKEOPTS}
CHECK_MAKEOPTS=${CHECK_MAKEOPTS:-$DEFAULT_MAKEOPTS}
- $DRY_RUN ./do_cmake.sh $@ || return 1
+ CMAKE_PYTHON_OPTS=
+ if ! type python2 > /dev/null 2>&1 ; then
+ CMAKE_PYTHON_OPTS="-DWITH_PYTHON2=OFF -DWITH_PYTHON3=ON -DMGR_PYTHON_VERSION=3"
+ fi
+
+ 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
- # prevent OSD EMFILE death on tests
- $DRY_RUN sudo ulimit -n 32768
+ 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
+ echo "***ulimit -n too small, better bigger than 1024 for test***"
+ return 1
+ fi
+
if ! $DRY_RUN ctest $CHECK_MAKEOPTS --output-on-failure; then
rm -f ${TMPDIR:-/tmp}/ceph-asok.*
return 1
rm -fr ${CEPH_BUILD_VIRTUALENV:-/tmp}/*virtualenv*
echo "cmake check: successful run on $(git rev-parse HEAD)"
return 0
- else
+ else
rm -fr ${CEPH_BUILD_VIRTUALENV:-/tmp}/*virtualenv*
return 1
fi