@@ -35,9 +35,15 @@ before_install:
35
35
36
36
addons :
37
37
apt :
38
+ sources :
39
+ - sourceline : ' deb https://apt.kitware.com/ubuntu/ focal main'
40
+ key_url : ' https://apt.kitware.com/keys/kitware-archive-latest.asc'
38
41
packages :
39
- - ninja-build
40
- - libncursesw5
42
+ - cmake
43
+ - ninja-build
44
+ - gcovr
45
+ - libncursesw5
46
+ - g++-7
41
47
42
48
matrix :
43
49
include :
@@ -279,3 +285,22 @@ matrix:
279
285
| while read file; do python ./hal/tests/pinvalidate/pinvalidate.py -vfp "${file}"; done
280
286
- git diff --exit-code --diff-filter=d --color
281
287
288
+ # ## Mbed OS unittest ###
289
+ - &cmake-build-run-unittest
290
+ stage : " CMake"
291
+ name : " CMake unittest build"
292
+ env : NAME=cmake_unittest
293
+ install :
294
+ # Hide Travis-preinstalled CMake
295
+ # The Travis-preinstalled CMake is unfortunately not installed via apt, so we
296
+ # can't replace it with an apt-supplied version very easily. Additionally, we
297
+ # can't permit the Travis-preinstalled copy to survive, as the Travis default
298
+ # path lists the Travis CMake install location ahead of any place where apt
299
+ # would install CMake to. Instead of apt removing or upgrading to a new CMake
300
+ # version, we must instead delete the Travis copy of CMake.
301
+ - sudo rm -rf /usr/local/cmake*
302
+ script :
303
+ - echo ctest --build-and-test . build --build-generator Ninja --build-options -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Debug -DCOVERAGE=ON -DCMAKE_CXX_COMPILER=g++-7 -DCMAKE_C_COMPILER=gcc-7 --test-command ctest
304
+ - ctest --build-and-test . build --build-generator Ninja --build-options -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Debug -DCOVERAGE=ON -DCMAKE_CXX_COMPILER=g++-7 -DCMAKE_C_COMPILER=gcc-7 --test-command ctest
305
+ - gcovr --gcov-executable gcov-7 -r . ./build -s -e ".*\.h" --exclude-directories=$TRAVIS_BUILD_DIR/build/UNITTESTS --exclude-directories=$TRAVIS_BUILD_DIR/build/_deps
306
+ - ccache -s
0 commit comments