Closed Bug 1416239 Opened 2 years ago Closed 2 years ago

Windows coverage build is failing to write gcda files on automation

Categories

(Testing :: Code Coverage, defect)

defect
Not set

Tracking

(firefox59 fixed)

RESOLVED FIXED
mozilla59
Tracking Status
firefox59 --- fixed

People

(Reporter: marco, Assigned: marco)

References

Details

Attachments

(1 file)

See the log at https://bugzilla.mozilla.org/attachment.cgi?id=8927342.

You can see messages such as "profiling: c:\users\task_1510324156\appdata\local\temp\tmputrfcj\z:\build\build\src\obj-firefox\memory\fallible\fallible.gcda: cannot open: Invalid argument".

The problem is that LLVM is trying to write the file at an invalid path (it contains ":"). We probably just need to set GCOV_PREFIX_STRIP.

We might be able to remove the weird logic at https://dxr.mozilla.org/mozilla-central/rev/2535bad09d720e71a982f3f70dd6925f66ab8ec7/testing/mozharness/mozharness/mozilla/testing/codecoverage.py#133 if we use GCOV_PREFIX_STRIP for Linux too.
Summary: Windows coverage build is failing to write gcda files → Windows coverage build is failing to write gcda files on automation
Assignee: nobody → mcastelluccio
Status: NEW → ASSIGNED
Attached patch PatchSplinter Review
Attachment #8927807 - Flags: review?(jmaher)
Comment on attachment 8927807 [details] [diff] [review]
Patch

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

::: testing/mozharness/mozharness/mozilla/testing/codecoverage.py
@@ +91,5 @@
> +            # Add 1 as on Windows the path where the compiler tries to write the
> +            # gcda files has an additional 'obj-firefox' component.
> +            strip_count = self.prefix.count('/') + 1
> +
> +        os.environ['GCOV_PREFIX_STRIP'] = str(strip_count)

what is this used for?  I don't see it referenced here.
Attachment #8927807 - Flags: review?(jmaher) → review+
(In reply to Joel Maher ( :jmaher) (UTC-5) from comment #2)
> Comment on attachment 8927807 [details] [diff] [review]
> Patch
> 
> Review of attachment 8927807 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> ::: testing/mozharness/mozharness/mozilla/testing/codecoverage.py
> @@ +91,5 @@
> > +            # Add 1 as on Windows the path where the compiler tries to write the
> > +            # gcda files has an additional 'obj-firefox' component.
> > +            strip_count = self.prefix.count('/') + 1
> > +
> > +        os.environ['GCOV_PREFIX_STRIP'] = str(strip_count)
> 
> what is this used for?  I don't see it referenced here.

This is used by GCC to remove a prefix from the path where it stores the GCDA files, more details here: https://gcc.gnu.org/onlinedocs/gcc/Cross-profiling.html.

Basically, without GCOV_PREFIX_STRIP, GCC would write the gcda files to GCOV_PREFIX + "/builds/worker/workspace/build/src/". With GCOV_PREFIX_STRIP, GCC removes path components from "/builds/worker/workspace/build/src/" (the number of components defined in GCOV_PREFIX_STRIP).
So, if we set GCOV_PREFIX_STRIP to the number of directories in "/builds/worker/workspace/build/src/", GCC will write the gcda files directly in GCOV_PREFIX.
Pushed by mcastelluccio@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/0d54bbebadb2
Use GCOV_PREFIX_STRIP to strip prefix from the gcda target path. r=jmaher
https://hg.mozilla.org/mozilla-central/rev/0d54bbebadb2
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla59
You need to log in before you can comment on or make changes to this bug.