forked from Netflix/spectator-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun-build.sh
executable file
·54 lines (42 loc) · 1.04 KB
/
run-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
#!/bin/bash
set -e
RED='\033[0;31m' # Red
BB='\033[0;34m' # Blue
NC='\033[0m' # No Color
BG='\033[0;32m' # Green
error() { >&2 echo -e "${RED}$1${NC}"; }
showinfo() { echo -e "${BG}$1${NC}"; }
workingprocess() { echo -e "${BB}$1${NC}"; }
allert () { echo -e "${RED}$1${NC}"; }
# Building project
mkdir -p build
cd build
if [ "$CC" = gcc ] ; then
export CC=gcc-5
export CXX=g++-5
fi
if [ "$CC" = gcc-5 ] ; then
cmake -DCMAKE_BUILD_TYPE=Debug ..
else
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DASAN=ON ..
fi
make -j4
# Checks if last comand didn't output 0
# $? checks what last command outputed
# If output is 0 then command is succesfuly executed
# If command fails it outputs number between 0 to 255
if [ $? -ne 0 ]; then
error "Error: there are compile errors!"
# Terminate script and outputs 3
exit 3
fi
showinfo "Running tests ..."
if [ "$CC" = gcc-5 ]; then
make -j4 libatlasclient_coverage
fi
./runtests
if [ $? -ne 0 ]; then
error "Error: there are failed tests!"
exit 4
fi
workingprocess "All tests compile and pass."