Skip to content

Commit 81e661f

Browse files
committed
travis: Add automated coverage testing using coveralls.
1 parent b753009 commit 81e661f

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

.travis.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ before_script:
1010
- sudo apt-get install -y python3.4 python3 gcc-4.7 gcc-multilib gcc-arm-none-eabi qemu-system mingw32
1111
# For teensy build
1212
- sudo apt-get install realpath
13+
# For coverage testing
14+
- sudo pip install cpp-coveralls
1315

1416
script:
1517
- make -C minimal test
@@ -25,8 +27,17 @@ script:
2527
- make -C cc3200 BTARGET=bootloader BTYPE=release
2628
- make -C windows CROSS_COMPILE=i586-mingw32msvc-
2729

28-
- (cd tests && MICROPY_CPYTHON3=python3.4 ./run-tests)
29-
- (cd tests && MICROPY_CPYTHON3=python3.4 ./run-tests --emit native)
30+
# run tests without coverage info
31+
#- (cd tests && MICROPY_CPYTHON3=python3.4 ./run-tests)
32+
#- (cd tests && MICROPY_CPYTHON3=python3.4 ./run-tests --emit native)
33+
34+
# run tests with coverage info
35+
- make -C unix CC=gcc-4.7 coverage
36+
- (cd tests && MICROPY_CPYTHON3=python3.4 MICROPY_MICROPYTHON=../unix/micropython_coverage ./run-tests)
37+
- (cd tests && MICROPY_CPYTHON3=python3.4 MICROPY_MICROPYTHON=../unix/micropython_coverage ./run-tests --emit native)
38+
39+
after_success:
40+
- (cd unix && coveralls --root .. --build-root . --gcov $(which gcov-4.7) --gcov-options '\-o build-coverage/' --include py --include extmod)
3041

3142
after_failure:
3243
- (cd tests && for exp in *.exp; do testbase=$(basename $exp .exp); echo -e "\nFAILURE $testbase"; diff -u $testbase.exp $testbase.out; done)

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
[![Build Status][travis-img]][travis-repo]
1+
[![Build Status][travis-img]][travis-repo] [![Coverage Status][coveralls-img]][coveralls-repo]
22
[travis-img]: https://travis-ci.org/micropython/micropython.png?branch=master
33
[travis-repo]: https://travis-ci.org/micropython/micropython
4+
[coveralls-img]: https://coveralls.io/repos/micropython/micropython/badge.png?branch=travis-testing
5+
[coveralls-repo]: https://coveralls.io/r/micropython/micropython?branch=travis-testing
46

57
The Micro Python project
68
========================

unix/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,8 @@ minimal:
136136
coverage:
137137
@echo Make sure to run make -B
138138
$(MAKE) COPT="-O0" CFLAGS_EXTRA='-fprofile-arcs -ftest-coverage' LDFLAGS_EXTRA='-fprofile-arcs -ftest-coverage' BUILD=build-coverage PROG=micropython_coverage
139+
140+
coverage_test: coverage
139141
$(eval DIRNAME=$(notdir $(CURDIR)))
140142
cd ../tests && MICROPY_MICROPYTHON=../$(DIRNAME)/micropython_coverage ./run-tests
141143
gcov -o build-coverage/py ../py/*.c

0 commit comments

Comments
 (0)