Closed Bug 1472688 Opened Last year Closed Last year

Make it possible to accumulate counters

Categories

(Testing :: Code Coverage, enhancement)

enhancement
Not set

Tracking

(firefox63 fixed)

RESOLVED FIXED
mozilla63
Tracking Status
firefox63 --- fixed

People

(Reporter: marco, Assigned: marco)

References

Details

Attachments

(1 file)

Instead of resetting to 0, it should be possible to reset the counters to a previous checkpoint.

This will allow, for example, to ignore parts of the execution (for example, in browser-chrome tests, it would be really useful to ignore the execution of some of the functions in BrowserTestUtils, especially the ones creating new tabs).

This is also needed for xpcshell tests, as sometimes, even if we run a single test in test-coverage (or test-verify), we run it twice as the test can be in multiple manifests (e.g. test_table_rollback.js).
Attached patch PatchSplinter Review
Attachment #8989174 - Flags: review?(jmaher)
Comment on attachment 8989174 [details] [diff] [review]
Patch

Review of attachment 8989174 [details] [diff] [review]:
-----------------------------------------------------------------

just one question

::: tools/code-coverage/PerTestCoverageUtils.jsm
@@ +52,5 @@
> +
> +function moveDirectoryContents(src, dst) {
> +  let entries = src.directoryEntries;
> +  while (entries.hasMoreElements()) {
> +    entries.nextFile.moveTo(dst, null);

if the file has an open pointer, is there a chance that moving the file could still allow a running process to continue writing to the file?
Attachment #8989174 - Flags: review?(jmaher) → review+
(In reply to Joel Maher ( :jmaher ) (UTC-4) from comment #2)
> Comment on attachment 8989174 [details] [diff] [review]
> Patch
> 
> Review of attachment 8989174 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> just one question
> 
> ::: tools/code-coverage/PerTestCoverageUtils.jsm
> @@ +52,5 @@
> > +
> > +function moveDirectoryContents(src, dst) {
> > +  let entries = src.directoryEntries;
> > +  while (entries.hasMoreElements()) {
> > +    entries.nextFile.moveTo(dst, null);
> 
> if the file has an open pointer, is there a chance that moving the file
> could still allow a running process to continue writing to the file?

GCC (and LLVM) reopen the file everytime they have to write the counters (in order to be multiprocess safe), either when we call __gcov_dump (or __gcov_flush) or on shutdown. So as long as we wait for resetting/dumping to be complete (so that no process is terminated while we're doing it) we should be safe.
Pushed by mcastelluccio@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/a127e91d1951
Remove any gcda file left in GCOV_PREFIX when resetting counters, and make it possible to accumulate counters. r=jmaher
https://hg.mozilla.org/mozilla-central/rev/a127e91d1951
Status: ASSIGNED → RESOLVED
Closed: Last year
Resolution: --- → FIXED
Target Milestone: --- → mozilla63
Blocks: 1472895
You need to log in before you can comment on or make changes to this bug.