This page contains recommendations on solving various problems related to JCov
Table of Contents |
---|
JCov OS Community
What is JCov?
JCov is a Java code Coverage tool which provides a means to measure and analyze dynamic code coverage of Java programs. "Dynamic" means that code coverage data is collected when a program executes, unlike static code coverage which is collected without running the program. JCov provides functionality to collect method, linear block and branch coverage. It is also able to show a program's source code annotated with coverage information.
...
We encourage you to contribute source code to the JCov project. In accordance with the OpenJDK project governance process, you can submit code to the project leader either as a user, a developer, or as a committer. If your code is accepted to be integrated into the source tree, you will be asked to sign a Contributor's Agreement similar to what Apache Software Foundation requires. For more information about the governance process and the various roles for members in the community, please review OpenJDK Governance.
JCov product
What documentation is available for developers?
...
with JCov you can perform these steps separately (which is called static instrumentation), and simultaneously (which is dynamic instrumentation mode).
How
...
do I get coverage of JRE or similar product?
The procedure to collect code-coverage data for a JRE (or similar product) is generally the same as any other product (same as the question above).
...
Panel |
---|
# java -jar jcov.jar repgen -o report-bNN/ [-src jdk/src/] result.xml |
How
...
do I use JCov with jtreg?
Please visit jtreg support for jcov page
...
- specify "-loose 3" option, this will allow to ignore as much as possible inconsistencies
- merge with a template: java -jar jcov.jar -t template.xml r1.xml r2.xml
...
Is JCov making my Application/Test hang?
It's very unlikely that code inserted by jcov could make an application hang. The two most probable reasons if it does happen:
- Test execution was terminated in the moment when jcov was saving data to file. Each time jcov creates a new file it creates a lock file to guarantee an exclusive access to the file. Unexpected termination might cause the situation when lock file hasn't removed. As the result, the next test execution will hang trying to allocate locked resource. Discovering files with names like resuslt.xml.fdsa-34vy-3434-FA3d-thtz after terminated execution should be a signal that not all lock files have been removed. Solution: remove all lock files (named like result.xml.lock), all created result file and files with long extensions. After that rerun tests
- Tests are not hanged up, but takes extra time. Possible solutions:
- Use grabber instead saving to file
- Use include/exclude patterns to narrow the classes to collect coverage for
Is JCov
...
producing malformed XML?
The most possible reason for malformed XML is that JCov processes have been terminated while saving data to a file. The solution is to use the JCov grabber - saving data to a file requires much more time than sending code coverage data to a JCov server.
...
How do I get code coverage information for individual tests in a test suite?
You can use the JCov extension jtobserver.jar (or write your own implementation of the javatest interface Harness.Observer) to receive total test coverage - as well as individual test coverage. Running tests with jtobserver will make JCov send data from the grabber after finishing each test. Sending testname for this covered data, the grabber will receive these coverage data from each test and merge them into one result.xml file - saving information about each tests coverage.
...