forked from ceph/ceph
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run-make-check.sh
executable file
·73 lines (67 loc) · 1.93 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
#!/bin/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.
#
#
# Return true if the working tree is after the release that made
# make -j8 check possible
#
function can_parallel_make_check() {
local commit=$(git rev-parse tags/v0.88^{})
git rev-list HEAD | grep --quiet $commit
}
function maybe_parallel_make_check() {
if can_parallel_make_check ; then
echo -j$(get_processors)
fi
}
#
# Return MAX(1, (number of processors / 2)) by default or NPROC
#
function get_processors() {
if test -n "$NPROC" ; then
echo $NPROC
else
if test $(nproc) -ge 2 ; then
expr $(nproc) / 2
else
echo 1
fi
fi
}
function run() {
sudo $(which apt-get yum zypper 2>/dev/null) install -y ccache jq
sudo modprobe rbd
if test -f ./install-deps.sh ; then
$DRY_RUN ./install-deps.sh || return 1
fi
$DRY_RUN ./autogen.sh || return 1
$DRY_RUN ./configure "$@" --disable-static --with-radosgw --with-debug --without-lttng \
CC="ccache gcc" CXX="ccache g++" CFLAGS="-Wall -g" CXXFLAGS="-Wall -g" || return 1
$DRY_RUN make -j$(get_processors) || return 1
$DRY_RUN make $(maybe_parallel_make_check) check || return 1
$DRY_RUN make dist || return 1
}
function main() {
if run "$@" ; then
echo "make check: successful run on $(git rev-parse HEAD)"
return 0
else
find . -name '*.trs' | xargs grep -l FAIL | while read file ; do
log=$(dirname $file)/$(basename $file .trs).log
echo FAIL: $log
cat $log
done
return 1
fi
}
main "$@"