diff --git a/.travis.yml b/.travis.yml index 205c3cef1..c598783f4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,6 +10,8 @@ before_script: - sudo apt-get install -y python3.4 python3 gcc-4.7 gcc-multilib gcc-arm-none-eabi qemu-system mingw32 # For teensy build - sudo apt-get install realpath + # For coverage testing + - sudo pip install cpp-coveralls script: - make -C minimal test @@ -25,8 +27,17 @@ script: - make -C cc3200 BTARGET=bootloader BTYPE=release - make -C windows CROSS_COMPILE=i586-mingw32msvc- - - (cd tests && MICROPY_CPYTHON3=python3.4 ./run-tests) - - (cd tests && MICROPY_CPYTHON3=python3.4 ./run-tests --emit native) + # run tests without coverage info + #- (cd tests && MICROPY_CPYTHON3=python3.4 ./run-tests) + #- (cd tests && MICROPY_CPYTHON3=python3.4 ./run-tests --emit native) + + # run tests with coverage info + - make -C unix CC=gcc-4.7 coverage + - (cd tests && MICROPY_CPYTHON3=python3.4 MICROPY_MICROPYTHON=../unix/micropython_coverage ./run-tests) + - (cd tests && MICROPY_CPYTHON3=python3.4 MICROPY_MICROPYTHON=../unix/micropython_coverage ./run-tests --emit native) + +after_success: + - (cd unix && coveralls --root .. --build-root . --gcov $(which gcov-4.7) --gcov-options '\-o build-coverage/' --include py --include extmod) after_failure: - (cd tests && for exp in *.exp; do testbase=$(basename $exp .exp); echo -e "\nFAILURE $testbase"; diff -u $testbase.exp $testbase.out; done) diff --git a/README.md b/README.md index 1eec21257..bbbe6a032 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ -[![Build Status][travis-img]][travis-repo] +[![Build Status][travis-img]][travis-repo] [![Coverage Status][coveralls-img]][coveralls-repo] [travis-img]: https://travis-ci.org/micropython/micropython.png?branch=master [travis-repo]: https://travis-ci.org/micropython/micropython +[coveralls-img]: https://coveralls.io/repos/micropython/micropython/badge.png?branch=travis-testing +[coveralls-repo]: https://coveralls.io/r/micropython/micropython?branch=travis-testing The Micro Python project ======================== diff --git a/unix/Makefile b/unix/Makefile index 509c48ddf..43b5bf2dd 100644 --- a/unix/Makefile +++ b/unix/Makefile @@ -136,6 +136,8 @@ minimal: coverage: @echo Make sure to run make -B $(MAKE) COPT="-O0" CFLAGS_EXTRA='-fprofile-arcs -ftest-coverage' LDFLAGS_EXTRA='-fprofile-arcs -ftest-coverage' BUILD=build-coverage PROG=micropython_coverage + +coverage_test: coverage $(eval DIRNAME=$(notdir $(CURDIR))) cd ../tests && MICROPY_MICROPYTHON=../$(DIRNAME)/micropython_coverage ./run-tests gcov -o build-coverage/py ../py/*.c