forked from fluffos/fluffos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis_build.sh
executable file
·106 lines (91 loc) · 3.18 KB
/
.travis_build.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#!/bin/bash
setup () {
sudo apt-get install -qq bison autoconf expect telnet
# clang needs the updated libstdc++
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt-get update -qq
sudo apt-get install -qq gcc-4.8 g++-4.8
case $COMPILER in
gcc)
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 100 --slave /usr/bin/g++ g++ /usr/bin/g++-4.8
sudo update-alternatives --auto gcc
sudo update-alternatives --query gcc
export CXX="/usr/bin/g++"
$CXX -v
;;
clang)
sudo wget -q http://llvm.org/releases/3.5.2/clang+llvm-3.5.2-x86_64-linux-gnu-ubuntu-14.04.tar.xz
sudo tar axvf clang+llvm-3.5.2-x86_64-linux-gnu-ubuntu-14.04.tar.xz
export CXX="$PWD/clang+llvm-3.5.2-x86_64-linux-gnu/bin/clang++ -Wno-error=unused-command-line-argument"
$CXX -v
;;
esac
if [ "$BUILD" = "i386" ]; then
sudo apt-get remove libevent-dev libevent-* libssl-dev
sudo apt-get -f --no-install-recommends install g++-multilib g++-4.8-multilib valgrind:i386 libevent-dev:i386 libz-dev:i386
else
sudo apt-get install valgrind
sudo apt-get install libevent-dev libmysqlclient-dev libsqlite3-dev libpq-dev libz-dev libssl-dev libpcre3-dev
fi
}
if [[ "$(git branch | grep coverity_scan)" =~ ^.+coverity_scan$ ]]; then
if [ -z "$COVERITY" ]; then
echo "Only doing coverity scan in this branch, skipping this build"
exit 0
fi
else
if [ -n "$COVERITY" ]; then
echo "Skipping coverity on this branch."
exit 0
fi
fi
# do setup
setup
# stop on first error down below
set -eo pipefail
# testing part
cd src
./autogen.sh
cp local_options local_options.default
cp local_options.$CONFIG local_options
if [ -n "$GCOV" ]; then
./build.FluffOS $TYPE --enable-gcov=yes
else
./build.FluffOS $TYPE
fi
# For coverity, we don't need to actually run tests, just build
if [ -n "$COVERITY" ]; then
if [[ "$(git branch | grep coverity_scan)" =~ ^.+coverity_scan$ ]]; then
wget https://scan.coverity.com/download/linux-64 --post-data "token=DW98q3VnP4QKLy4wwLwReQ&project=fluffos%2Ffluffos" -O coverity_tool.tgz
tar zxvf coverity_tool.tgz
$PWD/cov-analysis-linux64-*/bin/cov-build --dir cov-int make -j 2
tar czvf cov.tgz cov-int
curl --form token=DW98q3VnP4QKLy4wwLwReQ \
--form [email protected] \
--form [email protected] \
--form version="$(git describe --always)" \
--form description="FluffOS Autobuild" \
https://scan.coverity.com/builds?project=fluffos%2Ffluffos
exit 0
fi
fi
# Otherwise, continue
make -j 2
cd testsuite
# FIXME: currently RELEASE build would report leak on valgrind, thus ignoring it for now.
if [ "$TYPE" = "develop" ]; then
VALGRIND="valgrind --error-exitcode=255 --suppressions=../valgrind.supp"
else
VALGRIND="valgrind"
fi
( sleep 30 ; expect telnet_test.expect localhost 4000 ) &
( $VALGRIND --malloc-fill=0x75 --free-fill=0x73 --track-origins=yes --leak-check=full ../driver etc/config.test -d ) &
wait $!
if [ $? -ne 0 ]; then
exit $?
fi
if [ -n "$GCOV" ]; then
cd ..
sudo pip install cpp-coveralls
coveralls --exclude packages --exclude thirdparty --exclude testsuite --exclude-pattern '.*.tab.+$' --gcov /usr/bin/gcov-4.8 --gcov-options '\-lp' -r $PWD -b $PWD
fi