File tree Expand file tree Collapse file tree 4 files changed +45
-1
lines changed Expand file tree Collapse file tree 4 files changed +45
-1
lines changed Original file line number Diff line number Diff line change @@ -18,12 +18,17 @@ addons:
18
18
- ldap-utils
19
19
- slapd
20
20
21
+ env :
22
+ - WITH_GCOV=1
23
+
21
24
install :
22
25
- pip install "pip>=7.1.0"
23
26
- pip install tox-travis tox codecov coverage
24
27
25
28
script : tox
26
29
27
30
after_success :
31
+ # gather Python coverage
28
32
- python -m coverage combine
33
+ # send Python and GCOV coverage
29
34
- 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
+
1
6
.NOTPARALLEL :
2
7
3
8
.PHONY : all
9
14
rm -f .coverage .coverage.*
10
15
find . -name ' *.py[co]' -or -name ' *.so*' -or -name ' *.dylib' -delete
11
16
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:
34
34
extra_link_args = []
35
35
extra_objects = []
36
36
libs = ['ldap' , 'lber' ]
37
- defines = [ ]
37
+ defines = []
38
38
extra_files = []
39
39
40
40
LDAP_CLASS = OpenLDAP2
@@ -55,6 +55,14 @@ class OpenLDAP2:
55
55
origfileslist = origfiles .split (',' )
56
56
LDAP_CLASS .extra_files [i ]= (destdir , origfileslist )
57
57
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
+
58
66
#-- Let distutils/setuptools do the rest
59
67
name = 'python-ldap'
60
68
Original file line number Diff line number Diff line change 13
13
pyasn1
14
14
pyasn1_modules
15
15
commands = {envpython} -m coverage run --parallel setup.py test
16
+ passenv = WITH_GCOV
16
17
17
18
[testenv:coverage-report]
18
19
deps = coverage
You can’t perform that action at this time.
0 commit comments