# version 2.1 of the License, or (at your option) any later version.
#
-#
-# Return MAX(1, (number of processors / 2)) by default or NPROC
-#
+set -e
+
+trap clean_up_after_myself EXIT
+
+ORIGINAL_CCACHE_CONF="$HOME/.ccache/ccache.conf"
+SAVED_CCACHE_CONF="$HOME/.run-make-check-saved-ccache-conf"
+
+function save_ccache_conf() {
+ test -f $ORIGINAL_CCACHE_CONF && cp $ORIGINAL_CCACHE_CONF $SAVED_CCACHE_CONF || true
+}
+
+function restore_ccache_conf() {
+ test -f $SAVED_CCACHE_CONF && mv $SAVED_CCACHE_CONF $ORIGINAL_CCACHE_CONF || true
+}
+
+function clean_up_after_myself() {
+ rm -fr ${CEPH_BUILD_VIRTUALENV:-/tmp}/*virtualenv*
+ restore_ccache_conf
+}
+
function get_processors() {
if test -n "$NPROC" ; then
echo $NPROC
echo "This probably means distribution $ID is not supported by run-make-check.sh" >&2
fi
+ if ! type ccache > /dev/null 2>&1 ; then
+ echo "ERROR: ccache could not be installed"
+ exit 1
+ fi
+
if test -f ./install-deps.sh ; then
$DRY_RUN source ./install-deps.sh || return 1
fi
CMAKE_BUILD_OPTS="-DWITH_FIO=ON -DWITH_GTEST_PARALLEL=ON"
- # Are we in the CI ?
+ cat <<EOM
+Note that the binaries produced by this script do not contain correct time
+and git version information, which may make them unsuitable for debugging
+and production use.
+EOM
+ save_ccache_conf
+ # remove 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="946684800"
+ ccache -o sloppiness=time_macros
+ ccache -o run_second_cpp=true
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
+ # 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
+ else
+ echo "Current ccache max_size setting:"
+ ccache -p | grep max_size
fi
+ ccache -z # Reset the ccache statistics
+
$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
+
+ ccache -s # print the ccache statistics to evaluate the efficiency
+
# prevent OSD EMFILE death on tests, make sure large than 1024
$DRY_RUN ulimit -n $(ulimit -Hn)
if [ $(ulimit -n) -lt 1024 ];then
echo "Please fix 'hostname --fqdn', otherwise 'make check' will fail"
return 1
fi
- if run "$@" ; then
- rm -fr ${CEPH_BUILD_VIRTUALENV:-/tmp}/*virtualenv*
- echo "cmake check: successful run on $(git rev-parse HEAD)"
- return 0
- else
- rm -fr ${CEPH_BUILD_VIRTUALENV:-/tmp}/*virtualenv*
- return 1
- fi
+ run "$@" && echo "make check: successful run on $(git rev-parse HEAD)"
}
main "$@"