-
Notifications
You must be signed in to change notification settings - Fork 0
/
run-make-check.sh
executable file
·90 lines (81 loc) · 2.61 KB
/
run-make-check.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/usr/bin/env bash
#
# Ceph distributed storage system
#
# Copyright (C) 2014 Red Hat <[email protected]>
#
# Author: Loic Dachary <[email protected]>
#
# 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.
#
#
# To just look at what this script will do, run it like this:
#
# $ DRY_RUN=echo ./run-make-check.sh
#
source src/script/run-make.sh
set -e
function in_jenkins() {
test -n "$JENKINS_HOME"
}
function run() {
# to prevent OSD EMFILE death on tests, make sure ulimit >= 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
# increase the aio-max-nr, which is by default 65536. we could reach this
# limit while running seastar tests and bluestore tests.
local m=16
if [ $(nproc) -gt $m ]; then
m=$(nproc)
fi
$DRY_RUN sudo /sbin/sysctl -q -w fs.aio-max-nr=$((65536 * $(nproc)))
CHECK_MAKEOPTS=${CHECK_MAKEOPTS:-$DEFAULT_MAKEOPTS}
if in_jenkins; then
if ! ctest $CHECK_MAKEOPTS --no-compress-output --output-on-failure -T Test; then
# 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
fi
}
function main() {
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
echo -n "Checking hostname sanity... "
if $DRY_RUN hostname --fqdn >/dev/null 2>&1 ; then
echo "OK"
else
echo "NOT OK"
echo "Please fix 'hostname --fqdn', otherwise 'make check' will fail"
return 1
fi
FOR_MAKE_CHECK=1 prepare
# Init defaults after deps are installed.
local cmake_opts=" -DWITH_GTEST_PARALLEL=ON -DWITH_FIO=ON -DWITH_CEPHFS_SHELL=ON -DWITH_SPDK=ON -DENABLE_GIT_VERSION=OFF"
if [ $WITH_SEASTAR ]; then
cmake_opts+=" -DWITH_SEASTAR=ON"
fi
if [ $WITH_ZBD ]; then
cmake_opts+=" -DWITH_ZBD=ON"
fi
if [ $WITH_PMEM ]; then
cmake_opts+=" -DWITH_RBD_RWL=ON -DWITH_SYSTEM_PMDK=ON"
fi
configure $cmake_opts $@
build tests
echo "make check: successful build on $(git rev-parse HEAD)"
run
}
main "$@"