Skip to content

Commit 30421e8

Browse files
committed
CMake: Run the unit tests in travis CI
1 parent 1887d53 commit 30421e8

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

.travis.yml

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,15 @@ before_install:
3535

3636
addons:
3737
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'
3841
packages:
39-
- ninja-build
40-
- libncursesw5
42+
- cmake
43+
- ninja-build
44+
- gcovr
45+
- libncursesw5
46+
- g++-7
4147

4248
matrix:
4349
include:
@@ -279,3 +285,22 @@ matrix:
279285
| while read file; do python ./hal/tests/pinvalidate/pinvalidate.py -vfp "${file}"; done
280286
- git diff --exit-code --diff-filter=d --color
281287

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

Comments
 (0)