-
Notifications
You must be signed in to change notification settings - Fork 1
/
build_tests.sh
executable file
·42 lines (34 loc) · 995 Bytes
/
build_tests.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
#!/usr/bin/bash
# Function to test exit status of a command.
# It exits if the command failed.
function testExitStatus()
{
if [ $1 -ne 0 ]
then
echo "$2 failed"
exit 1
else
echo "$2 successed"
fi
}
# Create build directory
mkdir -p build
testExitStatus $? "mkdir"
# Update path into build directory
cd build
testExitStatus $? "cd"
# Install conan dependencies
conan install .. --build=missing -s compiler.libcxx=libstdc++11 -c tools.system.package_manager:mode=install -c tools.system.package_manager:sudo=True
testExitStatus $? "conan install dependencies"
# Configure cmake
cmake -DCMAKE_BUILD_TYPE=Debug -DTESTING=On ..
testExitStatus $? "cmake config"
# Build using cmake
cmake --build .
testExitStatus $? "cmake build"
# Run Ctest
ctest --output-on-failure
testExitStatus $? "run ctest"
# Create coverage html graph
cd ..; mkdir -p coverage; gcovr --html-details coverage/coverage.html --exclude tests
testExitStatus $? "create html coverage"