Closed Bug 1191289 Opened 9 years ago Closed 9 years ago

Export Code Coverage information in a standard format.

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla43
Tracking Status
firefox42 --- affected
firefox43 --- fixed

People

(Reporter: nbp, Assigned: nbp)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

Code Coverage information is currently exported in a non-standard format, we should add similar function to export this information in a format which can be used by other tools. In the code-coverage meeting, we suggested to export this information with the same format as GCC (gcov), which generates 2 files, one generated during the compilation, and one generated during the execution. After reading some documentation on gcov files format [1], and comparing it to the lcov tracefiles [2], it seems that the tracefile format of lcov is both easier to understand, to produce, and to verify. I think producing lcov tracefiles is the most practical solution, less error prone, and thus faster to implement correctly. The goal is to add functions to export PCCounts information in a lcov compatible format. In a follow-up bug, we should look for exporting this generated content into a file when the a compartment is finalized. [1] https://github.com/gcc-mirror/gcc/blob/master/gcc/gcov-io.h [2] http://ltp.sourceforge.net/coverage/lcov/geninfo.1.php
This patch add a LCOV output [1] to the PCCounts api. [1] http://ltp.sourceforge.net/coverage/lcov/geninfo.1.php
Attachment #8646436 - Flags: review?(bhackett1024)
Comment on attachment 8646436 [details] [diff] [review] Add a JSFriendApi function to produce LCOV information about the current compartment. Review of attachment 8646436 [details] [diff] [review]: ----------------------------------------------------------------- ::: js/src/jsopcode.cpp @@ +2112,5 @@ > + // generate functions in the right order. > + auto lessFun = [](const JSScript* lhs, const JSScript* rhs) -> bool { > + int d = strcmp(lhs->filename(), rhs->filename()); > + /* > + This should not be necessary as we are supposed to have only the Multiline comments should have a * on every line I think.
Attachment #8646436 - Flags: review?(bhackett1024) → review+
Attachment #8648863 - Flags: review?(bhackett1024)
Comment on attachment 8648863 [details] [diff] [review] part 2 - JS Lcov output: Handle throw statements. Review of attachment 8648863 [details] [diff] [review]: ----------------------------------------------------------------- ::: js/src/jit-test/tests/coverage/simple.js @@ +166,5 @@ > + } > + //FNF:1 > + //FNH:1 > + //LF:9 // Expected LF:8 , Apparently if the first statement is a try, the > + // statement forllowing the "try{" statement is visited twice. typo ::: js/src/jsopcode.cpp @@ +2025,5 @@ > if (counts) > hits = counts->numExec(); > } > > + // If the current instruction thrown, then decrement the hit counts with If the current instruction has thrown @@ +2026,5 @@ > hits = counts->numExec(); > } > > + // If the current instruction thrown, then decrement the hit counts with > + // the number of throw encountered. number of throws
Attachment #8648863 - Flags: review?(bhackett1024) → review+
Assignee: nobody → nicolas.b.pierron
Status: NEW → RESOLVED
Closed: 9 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla43
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: