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
|
|
|
|
|
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
|
2022-11-01 14:03:31 +00:00
|
|
|
local procs="$(($(get_processors) * 2))"
|
|
|
|
if [ "${procs}" -gt $m ]; then
|
|
|
|
m="${procs}"
|
2021-03-19 08:18:23 +00:00
|
|
|
fi
|
2022-11-01 14:03:31 +00:00
|
|
|
local aiomax="$((65536 * procs))"
|
|
|
|
if [ "$(/sbin/sysctl -n fs.aio-max-nr )" -lt "${aiomax}" ]; then
|
|
|
|
$DRY_RUN sudo /sbin/sysctl -q -w fs.aio-max-nr="${aiomax}"
|
2022-10-31 14:54:53 +00:00
|
|
|
fi
|
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
|
2022-10-31 14:54:53 +00:00
|
|
|
configure "$@"
|
2022-03-25 21:29:44 +00:00
|
|
|
in_jenkins && echo "CI_DEBUG: Running 'build tests'"
|
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
|
|
|
}
|
|
|
|
|
2022-10-31 14:54:53 +00:00
|
|
|
if [ "$0" = "$BASH_SOURCE" ]; then
|
|
|
|
main "$@"
|
|
|
|
fi
|