[coverage] introduce instrument_classpath, modify cobertura to use native class filtering, add coverage integration test.

Review Request #2893 - Created Sept. 25, 2015 and submitted

Information
Justin Trobec
pants
coverage/cobertura-incl-excl
2245
a6f2c69...
Reviewers
pants-reviews
benjyw, stuhood

This change fixes cobertura integration by switching to a strategy that clones and instruments compiled jars rather than depending on .class files. It moves us closer to breaking coverage out into tasks by introducing an instrument_classpath product, and removes some unnecessary complexity by leveraging cobertura's native class filtering logic. Finally, it adds an integration test that will hopefully help cobertura coverage be more reliably functional down the road.

I had intended to split this branch up more, but because of the move to jar strategies as the default, cobertura integration was completely broken and I felt it was better to do a slightly longer branch but have things in a working state.

Subsequent branches will simplify the cobertura reporting (specifically the source file linking), deprecate emma integration, and completely refactor coverage into seperate tasks.

Manual tests:

./pants clean-all test testprojects/tests/java/org/pantsbuild/testproject/unicode:: --test-junit-coverage-processor=cobertura --test-junit-coverage
open .pants.d/test/junit/coverage/xml/coverage.xml

New integration test:

./pants test tests/python/pants_test/backend/jvm/tasks:junit_run_integration

Tests for cobertura class filtering:

The following leads to a report with 100% coverage (i.e. default includes all classes in instrumentation):

./pants clean-all test testprojects/tests/java/org/pantsbuild/testproject/unicode:: --test-junit-coverage-processor=cobertura --test-junit-coverage

The following leads to an empty report, as the only class in the project under test is covered by the exclude:

./pants clean-all test testprojects/tests/java/org/pantsbuild/testproject/unicode:: --test-junit-coverage-processor=cobertura --test-junit-coverage --test-junit-coverage-cobertura-exclude-classes='.*cucumber.*'

The following leads to a report with 100% coverage, as the only class is covered by the specified inclusion:

./pants clean-all test testprojects/tests/java/org/pantsbuild/testproject/unicode:: --test-junit-coverage-processor=cobertura --test-junit-coverage --test-junit-coverage-cobertura-include-classes='.*cucumber.*'

Issues

  • 0
  • 2
  • 0
  • 2
Description From Last Updated
Justin Trobec
Stu Hood
Stu Hood
Stu Hood
Justin Trobec
Justin Trobec
Review request changed

Status: Closed (submitted)

Change Summary:

Merged as 98c1a81923512a9d266aa2d7ed899880648b5182

Loading...