File tree Expand file tree Collapse file tree 6 files changed +107
-5
lines changed Expand file tree Collapse file tree 6 files changed +107
-5
lines changed Original file line number Diff line number Diff line change
1
+ dist : xenial
2
+ language : c++
3
+ services :
4
+ - docker
5
+
6
+ addons :
7
+ apt :
8
+ packages :
9
+ - cmake
10
+ - valgrind
11
+ - python-pip
12
+
13
+ homebrew :
14
+ packages :
15
+ - cmake
16
+ - valgrind
17
+
18
+ matrix :
19
+ include :
20
+ - os : linux // travis ubuntu xenial
21
+ env :
22
+ - MYCXX="g++"
23
+ - USE_DOCKER="FALSE"
24
+ - USE_GCOV="TRUE"
25
+
26
+ - os : linux // arch linux docker
27
+ env :
28
+ - MYCXX="g++"
29
+ - USE_DOCKER="TRUE"
30
+ - USE_GCOV="FALSE"
31
+
32
+ - os : osx
33
+ osx_image : xcode10.1
34
+ env :
35
+ - MYCXX="g++"
36
+ - USE_DOCKER="FALSE"
37
+ - USE_GCOV="FALSE"
38
+
39
+ - os : osx
40
+ osx_image : xcode10.1
41
+ env :
42
+ - MYCXX="clang++"
43
+ - USE_DOCKER="FALSE"
44
+ - USE_GCOV="FALSE"
45
+
46
+ before_install :
47
+ - |
48
+ if [[ "$USE_DOCKER" == "TRUE" ]]; then
49
+ docker pull nnvmc/base;
50
+ else
51
+ ${MYCXX} -v;
52
+ fi;
53
+ echo "CXX_COMPILER=${MYCXX}" >> config.sh;
54
+ echo "CXX_FLAGS=\"-O0 -g -Wall -Wno-unused-function ${configopt}\"" >> config.sh;
55
+ if [[ "$USE_GCOV" == "TRUE" ]]; then echo "USE_COVERAGE=1" >> config.sh;
56
+ else
57
+ echo "USE_COVERAGE=0" >> config.sh;
58
+ fi;
59
+
60
+ script :
61
+ - |
62
+ if [[ "$USE_DOCKER" == "TRUE" ]]; then
63
+ docker run -it -v $(pwd):/root/repo nnvmc/base /bin/bash -c "cd /root/repo && ./build.sh" || exit 1;
64
+ else
65
+ ./build.sh || exit 1;
66
+ fi;
67
+ - |
68
+ if [[ "$USE_DOCKER" == "TRUE" ]]; then
69
+ if [[ "$USE_GCOV" == "TRUE" ]]; then
70
+ docker run -it -v $(pwd):/root/repo nnvmc/base /bin/bash -c "cd /root/repo/test && ./run.sh";
71
+ docker run -e TRAVIS=$TRAVIS -e TRAVIS_JOB_ID=$TRAVIS_JOB_ID -it -v $(pwd):/root/repo nnvmc/base /bin/bash -c "pip install cpp-coveralls && cd /root/repo/build && coveralls --verbose -b ./ -r ../ -i include -i src -x .cpp -x .hpp --gcov-options '\-lp'";
72
+ else
73
+ docker run -it -v $(pwd):/root/repo nnvmc/base /bin/bash -c "cd /root/repo/test && ./run.sh";
74
+ fi;
75
+ else
76
+ if [[ "$USE_GCOV" == "TRUE" ]]; then
77
+ cd build && make test && cd .. ;
78
+ pip install --user cpp-coveralls && cd build && coveralls --verbose -b ./ -r ../ -i include -i src -x .cpp -x .hpp --gcov-options '\-lp';
79
+ else
80
+ cd test && ./run.sh && cd .. ;
81
+ fi;
82
+ fi;
83
+
84
+ notifications :
85
+ email :
86
+ on_success : change
87
+ on_failure : change
Original file line number Diff line number Diff line change @@ -8,9 +8,11 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
8
8
set (CMAKE_POSITION_INDEPENDENT_CODE ON )
9
9
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${USER_CXX_FLAGS} " )
10
10
11
+ if (USE_COVERAGE )
12
+ set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage" )
13
+ endif ()
14
+
11
15
# find packages
12
- message (STATUS "Configured CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER} " )
13
- message (STATUS "Configured CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS} " )
14
16
15
17
find_package (MPI )
16
18
if (MPI_FOUND )
@@ -20,6 +22,9 @@ if (MPI_FOUND)
20
22
message (STATUS "MPI_CXX_LIBRARIES: ${MPI_CXX_LIBRARIES} " )
21
23
endif ()
22
24
25
+ message (STATUS "Configured CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER} " )
26
+ message (STATUS "Configured CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS} " )
27
+
23
28
# set header / library paths
24
29
include_directories (include / ) # headers
25
30
@@ -29,4 +34,3 @@ enable_testing()
29
34
add_subdirectory (src )
30
35
add_subdirectory (test )
31
36
add_subdirectory (examples )
32
-
Original file line number Diff line number Diff line change 2
2
. ./config.sh
3
3
mkdir -p build
4
4
cd build
5
- cmake -DCMAKE_CXX_COMPILER=" ${CXX_COMPILER} " -DUSER_CXX_FLAGS=" ${CXX_FLAGS} " ..
5
+ cmake -DCMAKE_CXX_COMPILER=" ${CXX_COMPILER} " -DUSER_CXX_FLAGS=" ${CXX_FLAGS} " -DUSE_COVERAGE= " ${USE_COVERAGE} " ..
6
6
make
Original file line number Diff line number Diff line change 1
- #! /bin/bash
1
+ #! /bin/sh
2
2
3
3
# C++ compiler
4
4
CXX_COMPILER=" g++"
5
5
6
6
# C++ flags
7
7
CXX_FLAGS=" -O3 -flto -Wall -Wno-unused-function"
8
8
9
+ # add coverage flags
10
+ USE_COVERAGE=0
Original file line number Diff line number Diff line change @@ -6,3 +6,8 @@ if (MPI_FOUND)
6
6
target_link_libraries (mci ${MPI_CXX_LIBRARIES} )
7
7
target_link_libraries (mci_static ${MPI_CXX_LIBRARIES} )
8
8
endif ()
9
+
10
+ if (USE_COVERAGE )
11
+ target_link_libraries (mci --coverage )
12
+ target_link_libraries (mci_static --coverage )
13
+ endif ()
Original file line number Diff line number Diff line change 1
1
include_directories (common/ )
2
2
link_libraries (mci )
3
+ if (USE_COVERAGE )
4
+ link_libraries (--coverage )
5
+ endif ()
6
+
3
7
add_executable (check main.cpp )
4
8
add_executable (ut1.exe ut1/main.cpp )
5
9
add_executable (ut2.exe ut2/main.cpp )
You can’t perform that action at this time.
0 commit comments