File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,12 +18,17 @@ addons:
1818 - ldap-utils
1919 - slapd
2020
21+ env :
22+ - WITH_GCOV=1
23+
2124install :
2225 - pip install "pip>=7.1.0"
2326 - pip install tox-travis tox codecov coverage
2427
2528script : tox
2629
2730after_success :
31+ # gather Python coverage
2832 - python -m coverage combine
33+ # send Python and GCOV coverage
2934 - codecov
Original file line number Diff line number Diff line change 1+ LCOV_INFO =build/lcov.info
2+ LCOV_REPORT =build/lcov_report
3+ LCOV_REPORT_OPTIONS =--show-details -no-branch-coverage \
4+ --title "python-ldap LCOV report"
5+
16.NOTPARALLEL :
27
38.PHONY : all
914 rm -f .coverage .coverage.*
1015 find . -name ' *.py[co]' -or -name ' *.so*' -or -name ' *.dylib' -delete
1116 find . -depth -name __pycache__ -exec rm -rf {} \;
17+
18+ # LCOV report (measuring test coverage for C code)
19+ .PHONY : lcov-clean lcov-coverage lcov-report lcov-open lcov
20+ lcov-clean :
21+ rm -rf $(LCOV_INFO ) $(LCOV_REPORT )
22+ find build -name ' *.gc??' -delete
23+
24+ lcov-coverage :
25+ WITH_GCOV=1 tox -e py27,py36
26+
27+ $(LCOV_INFO ) :
28+ lcov --capture --directory build --output-file $(LCOV_INFO )
29+
30+ $(LCOV_REPORT ) : $(LCOV_INFO )
31+ genhtml --output-directory $(LCOV_REPORT ) \
32+ $(LCOV_REPORT_OPTIONS ) $(LCOV_INFO )
33+
34+ lcov-report : $(LCOV_REPORT )
35+
36+ lcov-open : $(LCOV_REPORT )
37+ xdg-open $(LCOV_REPORT ) /index.html
38+
39+ lcov : lcov-clean
40+ $(MAKE ) lcov-coverage
41+ $(MAKE ) lcov-report
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ class OpenLDAP2:
3434 extra_link_args = []
3535 extra_objects = []
3636 libs = ['ldap' , 'lber' ]
37- defines = [ ]
37+ defines = []
3838 extra_files = []
3939
4040LDAP_CLASS = OpenLDAP2
@@ -55,6 +55,14 @@ class OpenLDAP2:
5555 origfileslist = origfiles .split (',' )
5656 LDAP_CLASS .extra_files [i ]= (destdir , origfileslist )
5757
58+ if os .environ .get ('WITH_GCOV' ):
59+ # Insrumentation for measuring code coverage
60+ LDAP_CLASS .extra_compile_args .extend (
61+ ['-O0' , '-pg' , '-fprofile-arcs' , '-ftest-coverage' ]
62+ )
63+ LDAP_CLASS .extra_link_args .append ('-pg' )
64+ LDAP_CLASS .libs .append ('gcov' )
65+
5866#-- Let distutils/setuptools do the rest
5967name = 'python-ldap'
6068
Original file line number Diff line number Diff line change 1313 pyasn1
1414 pyasn1_modules
1515commands = {envpython} -m coverage run --parallel setup.py test
16+ passenv = WITH_GCOV
1617
1718[testenv:coverage-report]
1819deps = coverage
You can’t perform that action at this time.
0 commit comments