Skip to content
This repository was archived by the owner on Aug 30, 2022. It is now read-only.

Commit b7a5fc3

Browse files
authored
Add missing exit to build script (#69)
* Add missing exit to build script Signed-off-by: Isaac Hier <[email protected]> * Use set -e Signed-off-by: Isaac Hier <[email protected]>
1 parent f324d85 commit b7a5fc3

File tree

1 file changed

+13
-26
lines changed

1 file changed

+13
-26
lines changed

scripts/build.sh

Lines changed: 13 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,13 @@
22

33
# Based on https://github.com/codecov/example-cpp11-cmake/blob/master/run_build.sh.
44

5+
set -e
6+
57
RED='\033[0;31m'
68
BLUE='\033[0;34m'
79
NO_COLOR='\033[0m'
810
GREEN='\033[0;32m'
911

10-
function error() {
11-
>&2 echo -e "${RED}$1${NO_COLOR}"
12-
}
13-
1412
function info() {
1513
echo -e "${GREEN}$1${NO_COLOR}"
1614
}
@@ -19,26 +17,15 @@ function working() {
1917
echo -e "${BLUE}$1${NO_COLOR}"
2018
}
2119

22-
mkdir -p build
23-
cd build || exit
24-
if [ "x$COVERAGE" != "x" ]; then
25-
cmake -DCMAKE_BUILD_TYPE=Debug -DJAEGERTRACING_COVERAGE=ON ..
26-
else
27-
cmake -DCMAKE_BUILD_TYPE=Debug -DJAEGERTRACING_COVERAGE=OFF ..
28-
fi
29-
30-
if make -j3 UnitTest; then
31-
true
32-
else
33-
error "Error: compilation errors"
34-
exit 3
35-
fi
36-
37-
info "Running tests..."
38-
if ./UnitTest; then
39-
true
40-
else
41-
error "Error: test failure"
42-
fi
20+
function main() {
21+
mkdir -p build
22+
cd build
23+
coverage_option=${COVERAGE:+"-DJAEGERTRACING_COVERAGE=ON"}
24+
cmake -DCMAKE_BUILD_TYPE=Debug "${coverage_option}" ..
25+
make -j3 UnitTest
26+
info "Running tests..."
27+
./UnitTest
28+
working "All tests compiled and passed"
29+
}
4330

44-
working "All tests compiled and passed"
31+
main

0 commit comments

Comments
 (0)