]> git.proxmox.com Git - ceph.git/blob - ceph/run-make-check.sh
import Ceph Pacific 16.2.4
[ceph.git] / ceph / run-make-check.sh
1 #!/usr/bin/env bash
2 #
3 # Ceph distributed storage system
4 #
5 # Copyright (C) 2014 Red Hat <contact@redhat.com>
6 #
7 # Author: Loic Dachary <loic@dachary.org>
8 #
9 # This library is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU Lesser General Public
11 # License as published by the Free Software Foundation; either
12 # version 2.1 of the License, or (at your option) any later version.
13 #
14
15 #
16 # To just look at what this script will do, run it like this:
17 #
18 # $ DRY_RUN=echo ./run-make-check.sh
19 #
20
21 source src/script/run-make.sh
22
23 set -e
24
25 function in_jenkins() {
26 test -n "$JENKINS_HOME"
27 }
28
29 function run() {
30 # to prevent OSD EMFILE death on tests, make sure ulimit >= 1024
31 $DRY_RUN ulimit -n $(ulimit -Hn)
32 if [ $(ulimit -n) -lt 1024 ];then
33 echo "***ulimit -n too small, better bigger than 1024 for test***"
34 return 1
35 fi
36
37 # increase the aio-max-nr, which is by default 65536. we could reach this
38 # limit while running seastar tests and bluestore tests.
39 $DRY_RUN sudo /sbin/sysctl -q -w fs.aio-max-nr=$((65536 * 16))
40
41 CHECK_MAKEOPTS=${CHECK_MAKEOPTS:-$DEFAULT_MAKEOPTS}
42 if in_jenkins; then
43 if ! ctest $CHECK_MAKEOPTS --no-compress-output --output-on-failure -T Test; then
44 # do not return failure, as the jenkins publisher will take care of this
45 rm -fr ${TMPDIR:-/tmp}/ceph-asok.*
46 fi
47 else
48 if ! $DRY_RUN ctest $CHECK_MAKEOPTS --output-on-failure; then
49 rm -fr ${TMPDIR:-/tmp}/ceph-asok.*
50 return 1
51 fi
52 fi
53 }
54
55 function main() {
56 if [[ $EUID -eq 0 ]] ; then
57 echo "For best results, run this script as a normal user configured"
58 echo "with the ability to run commands as root via sudo."
59 fi
60 echo -n "Checking hostname sanity... "
61 if $DRY_RUN hostname --fqdn >/dev/null 2>&1 ; then
62 echo "OK"
63 else
64 echo "NOT OK"
65 echo "Please fix 'hostname --fqdn', otherwise 'make check' will fail"
66 return 1
67 fi
68 FOR_MAKE_CHECK=1 prepare
69 # Init defaults after deps are installed.
70 local cmake_opts=" -DWITH_PYTHON3=3 -DWITH_GTEST_PARALLEL=ON -DWITH_FIO=ON -DWITH_CEPHFS_SHELL=ON -DWITH_SPDK=ON -DENABLE_GIT_VERSION=OFF"
71 if [ $WITH_SEASTAR ]; then
72 cmake_opts+=" -DWITH_SEASTAR=ON"
73 fi
74 if [ $WITH_ZBD ]; then
75 cmake_opts+=" -DWITH_ZBD=ON"
76 fi
77 configure $cmake_opts $@
78 build tests
79 echo "make check: successful build on $(git rev-parse HEAD)"
80 run
81 }
82
83 main "$@"