summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorbcoe <bencoe@google.com>2020-10-22 19:56:28 -0700
committerBenjamin Coe <bencoe@google.com>2020-10-25 07:22:57 -0700
commitba907ff750ea18df743252b09f2c29d35ebe285d (patch)
treef110f5384e46eb2f1d95d74b59f4bf08eb14817b /Makefile
parentbae7ddecf709aa9c2c10d511ccecb3c13242471c (diff)
downloadnode-new-ba907ff750ea18df743252b09f2c29d35ebe285d.tar.gz
test: refactor coverage logic
Cleanup logic in Makefile for coverage. Update BUILDING.md accordingly. PR-URL: https://github.com/nodejs/node/pull/35767 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile35
1 files changed, 9 insertions, 26 deletions
diff --git a/Makefile b/Makefile
index b3a0a52e0d..08386412bf 100644
--- a/Makefile
+++ b/Makefile
@@ -197,20 +197,11 @@ check: test
# Remove files generated by running coverage, put the non-instrumented lib back
# in place
coverage-clean:
- if [ -d lib_ ]; then $(RM) -r lib; mv lib_ lib; fi
$(RM) -r node_modules
$(RM) -r gcovr build
- $(RM) -r out/$(BUILDTYPE)/.coverage
- $(RM) out/$(BUILDTYPE)/obj.target/node/gen/*.gcda
- $(RM) out/$(BUILDTYPE)/obj.target/node/src/*.gcda
- $(RM) out/$(BUILDTYPE)/obj.target/node/src/tracing/*.gcda
- $(RM) out/$(BUILDTYPE)/obj.target/node/gen/*.gcno
- $(RM) out/$(BUILDTYPE)/obj.target/node/src/*.gcno
- $(RM) out/$(BUILDTYPE)/obj.target/node/src/tracing/*.gcno
- $(RM) out/$(BUILDTYPE)/obj.target/cctest/src/*.gcno
- $(RM) out/$(BUILDTYPE)/obj.target/cctest/test/cctest/*.gcno
- $(RM) out/$(BUILDTYPE)/obj.target/embedtest/src/*.gcno
- $(RM) out/$(BUILDTYPE)/obj.target/embedtest/test/embedding/*.gcno
+ $(RM) -r coverage/tmp
+ $(FIND) out/$(BUILDTYPE)/obj.target \( -name "*.gcda" -o -name "*.gcno" \) \
+ -type f -exec $(RM) {} \;
.PHONY: coverage
# Build and test with code coverage reporting. Leave the lib directory
@@ -245,8 +236,8 @@ coverage-test: coverage-build
$(RM) out/$(BUILDTYPE)/obj.target/node/src/*/*.gcda
$(RM) out/$(BUILDTYPE)/obj.target/node_lib/src/*.gcda
$(RM) out/$(BUILDTYPE)/obj.target/node_lib/src/*/*.gcda
- -NODE_V8_COVERAGE=out/$(BUILDTYPE)/.coverage \
- TEST_CI_ARGS="$(TEST_CI_ARGS) --type=coverage" $(MAKE) $(COVTESTS)
+ -NODE_V8_COVERAGE=coverage/tmp \
+ TEST_CI_ARGS="$(TEST_CI_ARGS) --type=coverage" $(MAKE) $(COVTESTS)
$(MAKE) coverage-report-js
-(cd out && "../gcovr/scripts/gcovr" \
--gcov-exclude='.*\b(deps|usr|out|cctest|embedding)\b' -v \
@@ -259,17 +250,10 @@ coverage-test: coverage-build
@grep -A3 Lines coverage/cxxcoverage.html | grep style \
| sed 's/<[^>]*>//g'| sed 's/ //g'
-COV_REPORT_OPTIONS = --reporter=html \
- --temp-directory=out/$(BUILDTYPE)/.coverage --omit-relative=false \
- --resolve=./lib --exclude="benchmark/" --exclude="deps/" --exclude="test/" --exclude="tools/" \
- --wrapper-length=0
-ifdef COV_ENFORCE_THRESHOLD
- COV_REPORT_OPTIONS += --check-coverage --lines=$(COV_ENFORCE_THRESHOLD)
-endif
-
.PHONY: coverage-report-js
coverage-report-js:
- $(NODE) ./node_modules/.bin/c8 report $(COV_REPORT_OPTIONS)
+ -$(MAKE) coverage-build-js
+ $(NODE) ./node_modules/.bin/c8 report
.PHONY: cctest
# Runs the C++ tests using the built `cctest` executable.
@@ -305,9 +289,8 @@ tooltest:
.PHONY: coverage-run-js
coverage-run-js:
- $(RM) -r out/$(BUILDTYPE)/.coverage
- $(MAKE) coverage-build-js
- -NODE_V8_COVERAGE=out/$(BUILDTYPE)/.coverage CI_SKIP_TESTS=$(COV_SKIP_TESTS) \
+ $(RM) -r coverage/tmp
+ -NODE_V8_COVERAGE=coverage/tmp CI_SKIP_TESTS=$(COV_SKIP_TESTS) \
TEST_CI_ARGS="$(TEST_CI_ARGS) --type=coverage" $(MAKE) jstest
$(MAKE) coverage-report-js