2017-07-20 22:26:42 +00:00
|
|
|
#!/usr/bin/env bash
|
2014-12-06 22:59:54 +00:00
|
|
|
#
|
|
|
|
# Ceph distributed storage system
|
|
|
|
#
|
|
|
|
# Copyright (C) 2014 Red Hat <contact@redhat.com>
|
|
|
|
#
|
|
|
|
# Author: Loic Dachary <loic@dachary.org>
|
|
|
|
#
|
|
|
|
# This library is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU Lesser General Public
|
|
|
|
# License as published by the Free Software Foundation; either
|
|
|
|
# version 2.1 of the License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
|
2018-07-09 11:06:44 +00:00
|
|
|
#
|
|
|
|
# To just look at what this script will do, run it like this:
|
|
|
|
#
|
|
|
|
# $ DRY_RUN=echo ./run-make-check.sh
|
|
|
|
#
|
|
|
|
|
2019-09-05 09:58:44 +00:00
|
|
|
source src/script/run-make.sh
|
2018-09-08 15:06:45 +00:00
|
|
|
|
2020-11-26 01:18:02 +00:00
|
|
|
set -e
|
|
|
|
|
2021-03-25 09:08:48 +00:00
|
|
|
function in_jenkins() {
|
|
|
|
test -n "$JENKINS_HOME"
|
|
|
|
}
|
|
|
|
|
2014-12-06 22:59:54 +00:00
|
|
|
function run() {
|
2018-07-05 08:18:45 +00:00
|
|
|
# to prevent OSD EMFILE death on tests, make sure ulimit >= 1024
|
2017-08-30 08:32:49 +00:00
|
|
|
$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
|
2018-08-22 11:49:57 +00:00
|
|
|
|
|
|
|
# increase the aio-max-nr, which is by default 65536. we could reach this
|
|
|
|
# limit while running seastar tests and bluestore tests.
|
2021-03-19 08:18:23 +00:00
|
|
|
local m=16
|
|
|
|
if [ $(nproc) -gt $m ]; then
|
|
|
|
m=$(nproc)
|
|
|
|
fi
|
|
|
|
$DRY_RUN sudo /sbin/sysctl -q -w fs.aio-max-nr=$((65536 * $(nproc)))
|
2018-08-22 11:49:57 +00:00
|
|
|
|
2019-09-05 09:58:44 +00:00
|
|
|
CHECK_MAKEOPTS=${CHECK_MAKEOPTS:-$DEFAULT_MAKEOPTS}
|
2021-03-25 09:08:48 +00:00
|
|
|
if in_jenkins; then
|
2021-08-18 17:30:22 +00:00
|
|
|
if ! ctest $CHECK_MAKEOPTS --no-compress-output --output-on-failure --test-output-size-failed 1024000 -T Test; then
|
2021-03-25 09:08:48 +00:00
|
|
|
# do not return failure, as the jenkins publisher will take care of this
|
|
|
|
rm -fr ${TMPDIR:-/tmp}/ceph-asok.*
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
if ! $DRY_RUN ctest $CHECK_MAKEOPTS --output-on-failure; then
|
|
|
|
rm -fr ${TMPDIR:-/tmp}/ceph-asok.*
|
|
|
|
return 1
|
|
|
|
fi
|
2017-07-20 11:20:04 +00:00
|
|
|
fi
|
2014-12-06 22:59:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function main() {
|
2016-12-27 11:59:29 +00:00
|
|
|
if [[ $EUID -eq 0 ]] ; then
|
|
|
|
echo "For best results, run this script as a normal user configured"
|
|
|
|
echo "with the ability to run commands as root via sudo."
|
|
|
|
fi
|
2016-12-03 22:37:08 +00:00
|
|
|
echo -n "Checking hostname sanity... "
|
2018-07-09 11:06:44 +00:00
|
|
|
if $DRY_RUN hostname --fqdn >/dev/null 2>&1 ; then
|
2016-12-03 22:37:08 +00:00
|
|
|
echo "OK"
|
|
|
|
else
|
|
|
|
echo "NOT OK"
|
|
|
|
echo "Please fix 'hostname --fqdn', otherwise 'make check' will fail"
|
|
|
|
return 1
|
|
|
|
fi
|
2021-08-19 09:00:33 +00:00
|
|
|
# uses run-make.sh to install-deps
|
2019-09-05 09:58:44 +00:00
|
|
|
FOR_MAKE_CHECK=1 prepare
|
2021-08-02 19:26:00 +00:00
|
|
|
local cxx_compiler=g++
|
|
|
|
local c_compiler=gcc
|
|
|
|
for i in $(seq 14 -1 10); do
|
|
|
|
if type -t clang-$i > /dev/null; then
|
|
|
|
cxx_compiler="clang++-$i"
|
|
|
|
c_compiler="clang-$i"
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
2019-09-05 09:58:44 +00:00
|
|
|
# Init defaults after deps are installed.
|
2021-08-02 19:26:00 +00:00
|
|
|
local cmake_opts
|
|
|
|
cmake_opts+=" -DCMAKE_CXX_COMPILER=$cxx_compiler -DCMAKE_C_COMPILER=$c_compiler"
|
2021-08-16 09:36:30 +00:00
|
|
|
cmake_opts+=" -DCMAKE_CXX_FLAGS_DEBUG=-Werror"
|
2021-08-02 19:26:00 +00:00
|
|
|
cmake_opts+=" -DENABLE_GIT_VERSION=OFF"
|
|
|
|
cmake_opts+=" -DWITH_GTEST_PARALLEL=ON"
|
|
|
|
cmake_opts+=" -DWITH_FIO=ON"
|
|
|
|
cmake_opts+=" -DWITH_CEPHFS_SHELL=ON"
|
|
|
|
cmake_opts+=" -DWITH_GRAFANA=ON"
|
|
|
|
cmake_opts+=" -DWITH_SPDK=ON"
|
2020-03-04 14:09:31 +00:00
|
|
|
if [ $WITH_SEASTAR ]; then
|
|
|
|
cmake_opts+=" -DWITH_SEASTAR=ON"
|
|
|
|
fi
|
2020-09-17 06:28:51 +00:00
|
|
|
if [ $WITH_ZBD ]; then
|
2020-09-22 02:17:56 +00:00
|
|
|
cmake_opts+=" -DWITH_ZBD=ON"
|
2020-09-17 06:28:51 +00:00
|
|
|
fi
|
2021-04-08 09:12:38 +00:00
|
|
|
if [ $WITH_PMEM ]; then
|
|
|
|
cmake_opts+=" -DWITH_RBD_RWL=ON -DWITH_SYSTEM_PMDK=ON"
|
|
|
|
fi
|
2021-08-19 09:00:33 +00:00
|
|
|
configure "$cmake_opts" "$@"
|
2020-11-26 05:30:55 +00:00
|
|
|
build tests
|
|
|
|
echo "make check: successful build on $(git rev-parse HEAD)"
|
2021-09-17 14:09:28 +00:00
|
|
|
FOR_MAKE_CHECK=1 run
|
2014-12-06 22:59:54 +00:00
|
|
|
}
|
|
|
|
|
2014-12-21 08:47:57 +00:00
|
|
|
main "$@"
|