Skip to content

Commit 20587d8

Browse files
committed
Improved code coverage [skip appveyor]
1 parent df99843 commit 20587d8

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

.travis.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,10 @@ install:
4646
--with-php-config=$(phpenv which php-config) \
4747
--enable-zephir-parser \
4848
--enable-zephir-parser-debug \
49-
--enable-coverage
49+
--enable-coverage \
50+
LDFLAGS="${LDFLAGS} --coverage" \
51+
CFLAGS="${CFLAGS} -O0 -ggdb -fprofile-arcs -ftest-coverage" \
52+
CXXFLAGS="${CXXFLAGS} -O0 -ggdb -fprofile-arcs -ftest-coverage"
5053
- make -j"$(getconf _NPROCESSORS_ONLN)"
5154

5255
before_script:

coverage.mk

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
OUTCOV=coverage.info
1+
LCOV_REPORT=lcov.info
22
DIRCOV=coverage
33

44
.PHONY: clean-coverage
55
clean-coverage:
6-
-rm -fr $(OUTCOV) $(DIRCOV)
6+
-rm -fr $(DIRCOV)
7+
-rm -f $(LCOV_REPORT)
78

8-
# coverage-initial test coverage-capture
99
.PHONY: coverage-initial
1010
coverage-initial: clean-coverage
11-
@$(LCOV) --directory ./parser --directory . --zerocounters
12-
@$(LCOV) --directory ./parser --directory . --capture --compat-libtool --initial --base-directory=. --output-file $(OUTCOV)
11+
@$(LCOV) -d . -z
12+
@$(LCOV) -d . -c --compat-libtool -i -o $(LCOV_REPORT)
1313

1414
.PHONY: coverage-capture
1515
coverage-capture:
16-
@$(LCOV) --no-checksum --directory . --capture --compat-libtool --output-file $(OUTCOV)
17-
@$(LCOV) --remove $(OUTCOV) "/usr*" --remove $(OUTCOV) "${HOME}/.phpenv/*" --compat-libtool --output-file $(OUTCOV)
16+
@$(LCOV) --no-checksum -d . -c --compat-libtool -o $(LCOV_REPORT)
17+
@$(LCOV) -r $(LCOV_REPORT) "/usr*" -r $(LCOV_REPORT) "${HOME}/.phpenv/*" --compat-libtool -o $(LCOV_REPORT)
1818

1919
.PHONY: coverage-html
2020
coverage-html: coverage-capture
21-
@$(GENHTML) --legend --output-directory $(DIRCOV) --title "Zephir Parser code coverage" $(OUTCOV)
21+
@$(GENHTML) --legend -o $(DIRCOV) -t "Zephir Parser code coverage" $(LCOV_REPORT)

0 commit comments

Comments
 (0)