diff --git a/.travis.yml b/.travis.yml index bfa08a501..2fe06003b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,10 +5,10 @@ os: - osx env: - - variant=test_debug lang=cpp11 sim=1 - - variant=test_debug lang=cpp98 sim=0 - - variant=test_release lang=cpp11 sim=0 - - variant=test_barebones lang=cpp11 sim=0 + - variant=test_release lang=cpp11 sim=0 coverage=1 + - variant=test_debug lang=cpp11 sim=1 coverage=0 + - variant=test_debug lang=cpp98 sim=0 coverage=0 + - variant=test_barebones lang=cpp11 sim=0 coverage=0 git: submodules: false @@ -45,10 +45,24 @@ before_install: - if [ $TRAVIS_OS_NAME == "osx" ]; then export toolset="darwin-${lang}"; export sim="0"; fi - if [ $TRAVIS_OS_NAME == "osx" ]; then export target="osx-tests"; fi - if [ $TRAVIS_OS_NAME == "linux" ]; then export toolset="gcc-${lang}"; fi + - if [[ $TRAVIS_OS_NAME == "linux" && $coverage == "1" ]]; then + export coverage_toolset=gcc-coverage; + pip install --user codecov; + else + export coverage_toolset=$toolset; + fi - 'echo "using toolset: " ${toolset}' +after_success: + - if [[ $TRAVIS_OS_NAME == "linux" && $coverage == "1" ]]; then + cd test; + codecov --root .. --gcov-exec gcov-4.8; + fi + install: + - g++-4.8 --version - 'echo "using gcc : cpp11 : ccache g++-4.8 : -std=c11 -std=c++11 ;" > ~/user-config.jam' + - 'echo "using gcc : coverage : ccache g++-4.8 : -std=c11 -std=c++11 --coverage --coverage ;" >> ~/user-config.jam' - 'echo "using gcc : cpp98 : ccache g++-4.8 : -std=c99 -std=c++98 ;" >> ~/user-config.jam' # osx builds need to disable the deprecated warning because of the openssl @@ -61,21 +75,27 @@ install: script: - cd test - - bjam --hash -j3 warnings-as-errors=on variant=$variant -l900 $toolset $target + - bjam --hash -j3 warnings-as-errors=on variant=$variant -l900 $coverage_toolset $target + - cd ../examples - bjam --hash -j3 warnings-as-errors=on variant=$variant $toolset link=shared - cd .. + # build libtorrent separately and install it in a temporary (well known) dir # we have to do this because on linux the name of the python module is the same # as the main library, so we can't stage them to the same directory - bjam --hash -j3 warnings-as-errors=on link=shared variant=$variant $toolset install location=./lib + - cd bindings/python # here we specify the temporary lib dir as a path to look for the main library - bjam --hash -j3 warnings-as-errors=on variant=$variant $toolset stage_module libtorrent-link=shared install-type=LIB dll-path=../../lib - LD_LIBRARY_PATH=../../lib DYLD_LIBRARY_PATH=../../lib python test.py + - cd ../.. + - if [ $sim = "1" ]; then - cd ../../simulation; - bjam --hash -j2 crypto=built-in $toolset; + cd simulation; + bjam --hash -j2 crypto=built-in $coverage_toolset; + cd ..; fi - ccache --show-stats diff --git a/Jamfile b/Jamfile index d513f3ecd..0657b2eba 100644 --- a/Jamfile +++ b/Jamfile @@ -60,28 +60,6 @@ else VERSION = 1.1.0 ; -rule coverage ( properties * ) -{ - local result ; - if on in $(properties) - && ( gcc in $(properties) - || darwin in $(properties) - || clang in $(properties) ) - { - result += -fprofile-arcs -ftest-coverage ; - - if gcc in $(properties) - { - result += -lgcov ; - } - else - { - result += --coverage ; - } - } - return $(result) ; -} - # rule for linking the correct libraries depending # on features and target-os rule linking ( properties * ) @@ -506,8 +484,6 @@ feature boost-link : default static shared : propagated composite ; feature debug-iterators : off on : composite propagated link-incompatible ; feature.compose on : _SCL_SECURE=1 _GLIBCXX_DEBUG ; -feature test-coverage : off on : composite propagated link-incompatible ; - feature fpic : off on : composite propagated link-incompatible ; feature.compose on : -fPIC ; feature.compose off : darwin:-mdynamic-no-pic ; @@ -736,7 +712,6 @@ local usage-requirements = # enable cancel support in asio BOOST_ASIO_ENABLE_CANCELIO @linking - @coverage # these compiler settings just makes the compiler standard conforming msvc:/Zc:wchar_t msvc:/Zc:forScope diff --git a/README.rst b/README.rst index bb1d96c50..5181783e3 100644 --- a/README.rst +++ b/README.rst @@ -7,6 +7,9 @@ libtorrent .. image:: https://ci.appveyor.com/api/projects/status/w7teauvub5813mew/branch/master?svg=true :target: https://ci.appveyor.com/project/arvidn/libtorrent/branch/master +.. image:: https://codecov.io/github/arvidn/libtorrent/coverage.svg?branch=master + :target: https://codecov.io/github/arvidn/libtorrent?branch=master + .. image:: https://www.openhub.net/p/rasterbar-libtorrent/widgets/project_thin_badge.gif :target: https://www.openhub.net/p/rasterbar-libtorrent?ref=sample diff --git a/simulation/libsimulator b/simulation/libsimulator index 8417cbee7..a6129b416 160000 --- a/simulation/libsimulator +++ b/simulation/libsimulator @@ -1 +1 @@ -Subproject commit 8417cbee7f1a813f032c5c1ed81e1f2881af7580 +Subproject commit a6129b41688ae3caa667f0ac766080fbee28eb37