@@ -39,9 +39,11 @@ addons:
39
39
- sourceline : ' deb https://apt.kitware.com/ubuntu/ focal main'
40
40
key_url : ' https://apt.kitware.com/keys/kitware-archive-latest.asc'
41
41
packages :
42
- - cmake
43
- - ninja-build
44
- - libncursesw5
42
+ - cmake
43
+ - ninja-build
44
+ - gcovr
45
+ - libncursesw5
46
+ - g++-7
45
47
46
48
matrix :
47
49
include :
@@ -321,3 +323,23 @@ matrix:
321
323
- mbedtools configure -p ${ROOT} -t ${TOOLCHAIN} -m ${TARGET_NAME} --mbed-os-path .
322
324
- cmake -S ${ROOT} -B ${ROOT}/cmake_build/${TARGET_NAME}/${PROFILE}/${TOOLCHAIN}/ -GNinja -DCMAKE_BUILD_TYPE=${PROFILE}
323
325
- cmake --build ${ROOT}/cmake_build/${TARGET_NAME}/${PROFILE}/${TOOLCHAIN}/
326
+
327
+ # ## Mbed OS unittest ###
328
+ - &cmake-build-run-unittest
329
+ stage : " CMake"
330
+ name : " CMake unittest build"
331
+ env : NAME=cmake_unittest
332
+ install :
333
+ # Hide Travis-preinstalled CMake
334
+ # The Travis-preinstalled CMake is unfortunately not installed via apt, so we
335
+ # can't replace it with an apt-supplied version very easily. Additionally, we
336
+ # can't permit the Travis-preinstalled copy to survive, as the Travis default
337
+ # path lists the Travis CMake install location ahead of any place where apt
338
+ # would install CMake to. Instead of apt removing or upgrading to a new CMake
339
+ # version, we must instead delete the Travis copy of CMake.
340
+ - sudo rm -rf /usr/local/cmake*
341
+ script :
342
+ - 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
343
+ - 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
344
+ - gcovr --gcov-executable gcov-7 -r . ./build -s -e ".*\.h" --exclude-directories=$TRAVIS_BUILD_DIR/build/UNITTESTS --exclude-directories=$TRAVIS_BUILD_DIR/build/_deps
345
+ - ccache -s
0 commit comments