]>
Commit | Line | Data |
---|---|---|
11fdf7f2 | 1 | #!/usr/bin/env bash |
7c673cae FG |
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 | # | |
f64942e4 | 16 | # To just look at what this script will do, run it like this: |
7c673cae | 17 | # |
f64942e4 AA |
18 | # $ DRY_RUN=echo ./run-make-check.sh |
19 | # | |
20 | ||
9f95a23c | 21 | source src/script/run-make.sh |
11fdf7f2 | 22 | |
f91f0fd5 TL |
23 | set -e |
24 | ||
f67539c2 TL |
25 | function in_jenkins() { |
26 | test -n "$JENKINS_HOME" | |
27 | } | |
28 | ||
7c673cae | 29 | function run() { |
f64942e4 AA |
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 | ||
11fdf7f2 TL |
37 | # increase the aio-max-nr, which is by default 65536. we could reach this |
38 | # limit while running seastar tests and bluestore tests. | |
20effc67 TL |
39 | local m=16 |
40 | if [ $(nproc) -gt $m ]; then | |
41 | m=$(nproc) | |
42 | fi | |
43 | $DRY_RUN sudo /sbin/sysctl -q -w fs.aio-max-nr=$((65536 * $(nproc))) | |
11fdf7f2 | 44 | |
9f95a23c | 45 | CHECK_MAKEOPTS=${CHECK_MAKEOPTS:-$DEFAULT_MAKEOPTS} |
f67539c2 | 46 | if in_jenkins; then |
522d829b | 47 | if ! ctest $CHECK_MAKEOPTS --no-compress-output --output-on-failure --test-output-size-failed 1024000 -T Test; then |
f67539c2 TL |
48 | # do not return failure, as the jenkins publisher will take care of this |
49 | rm -fr ${TMPDIR:-/tmp}/ceph-asok.* | |
50 | fi | |
51 | else | |
52 | if ! $DRY_RUN ctest $CHECK_MAKEOPTS --output-on-failure; then | |
53 | rm -fr ${TMPDIR:-/tmp}/ceph-asok.* | |
54 | return 1 | |
55 | fi | |
c07f9fc5 | 56 | fi |
7c673cae FG |
57 | } |
58 | ||
59 | function main() { | |
60 | if [[ $EUID -eq 0 ]] ; then | |
61 | echo "For best results, run this script as a normal user configured" | |
62 | echo "with the ability to run commands as root via sudo." | |
63 | fi | |
64 | echo -n "Checking hostname sanity... " | |
f64942e4 | 65 | if $DRY_RUN hostname --fqdn >/dev/null 2>&1 ; then |
7c673cae FG |
66 | echo "OK" |
67 | else | |
68 | echo "NOT OK" | |
69 | echo "Please fix 'hostname --fqdn', otherwise 'make check' will fail" | |
70 | return 1 | |
71 | fi | |
20effc67 | 72 | # uses run-make.sh to install-deps |
9f95a23c | 73 | FOR_MAKE_CHECK=1 prepare |
20effc67 TL |
74 | local cxx_compiler=g++ |
75 | local c_compiler=gcc | |
76 | for i in $(seq 14 -1 10); do | |
77 | if type -t clang-$i > /dev/null; then | |
78 | cxx_compiler="clang++-$i" | |
79 | c_compiler="clang-$i" | |
80 | break | |
81 | fi | |
82 | done | |
9f95a23c | 83 | # Init defaults after deps are installed. |
20effc67 TL |
84 | local cmake_opts |
85 | cmake_opts+=" -DCMAKE_CXX_COMPILER=$cxx_compiler -DCMAKE_C_COMPILER=$c_compiler" | |
86 | cmake_opts+=" -DCMAKE_CXX_FLAGS_DEBUG=-Werror" | |
87 | cmake_opts+=" -DENABLE_GIT_VERSION=OFF" | |
88 | cmake_opts+=" -DWITH_GTEST_PARALLEL=ON" | |
89 | cmake_opts+=" -DWITH_FIO=ON" | |
90 | cmake_opts+=" -DWITH_CEPHFS_SHELL=ON" | |
91 | cmake_opts+=" -DWITH_GRAFANA=ON" | |
92 | cmake_opts+=" -DWITH_SPDK=ON" | |
1e59de90 | 93 | cmake_opts+=" -DWITH_RBD_MIRROR=ON" |
9f95a23c TL |
94 | if [ $WITH_SEASTAR ]; then |
95 | cmake_opts+=" -DWITH_SEASTAR=ON" | |
96 | fi | |
f67539c2 TL |
97 | if [ $WITH_ZBD ]; then |
98 | cmake_opts+=" -DWITH_ZBD=ON" | |
99 | fi | |
33c7a0ef TL |
100 | if [ $WITH_RBD_RWL ]; then |
101 | cmake_opts+=" -DWITH_RBD_RWL=ON" | |
20effc67 | 102 | fi |
33c7a0ef | 103 | cmake_opts+=" -DWITH_RBD_SSD_CACHE=ON" |
1e59de90 TL |
104 | in_jenkins && echo "CI_DEBUG: Our cmake_opts are: $cmake_opts |
105 | CI_DEBUG: Running ./configure" | |
20effc67 | 106 | configure "$cmake_opts" "$@" |
1e59de90 | 107 | in_jenkins && echo "CI_DEBUG: Running 'build tests'" |
f91f0fd5 TL |
108 | build tests |
109 | echo "make check: successful build on $(git rev-parse HEAD)" | |
20effc67 | 110 | FOR_MAKE_CHECK=1 run |
7c673cae FG |
111 | } |
112 | ||
113 | main "$@" |