Open Bug 1054275 Opened 10 years ago Updated 2 years ago

Create a new configure option to enable code-coverage in builds

Categories

(Firefox Build System :: General, defect)

defect

Tracking

(Not tracked)

People

(Reporter: ahal, Unassigned)

References

Details

Attachments

(1 file)

This doesn't strictly block bug 890116, but I think it would be cleaner if there was something that got defined in build configuration (as opposed to a mozconfig exporting some environment variables). This would make it easier to know things like "when do we need to upload the .gcno zip?"

It would also make it easier for devs to build with code-coverage enabled locally and would let us fail fast with unsupported compilers.
I can help with this one if you want.
I tried and failed to get this working as I'm a build noob. I think this fails because the compiler options aren't getting set in nsprpub. I tried variations of this patch that also didn't work.

I may come back to this in the future, but for now it isn't strictly needed. Also if someone from the build team is opposed to this, feel free to resolve WONTFIX.
(In reply to Sylvestre Ledru [:sylvestre] from comment #1)
> I can help with this one if you want.

Sure, if you know how to do this, that would be a great help!
Attachment #8473671 - Attachment description: Add --enable-code-coverage configure option → Add --enable-code-coverage configure option (not working)
(In reply to Andrew Halberstadt [:ahal] from comment #2)
> Created attachment 8473671 [details] [diff] [review]
> Add --enable-code-coverage configure option (not working)
> 
> I tried and failed to get this working as I'm a build noob. I think this
> fails because the compiler options aren't getting set in nsprpub. I tried
> variations of this patch that also didn't work.

HOST_LDFLAGS="--coverage" is in my patch, but that appears to be for Linux32 builds specifically (because NSPR considers that a cross-compile).

Likely, what's happening is that we reset the CFLAGS and CXXFLAGS for our subconfigures. You might try adjusting _SUBDIR_CFLAGS et al as well to fix NSPR.
Thanks for the suggestion, I'm hitting a wall with this though. I tried adding --coverage to every *FLAGS variable I could think of and it still isn't working. I tried all of:
CFLAGS
OS_CFLAGS
_SUBDIR_CFLAGS
NSS_CFLAGS
NSPR_CFLAGS
HOST_CFLAGS

and their CXXFLAGS/LDFLAGS equivalents.

For now I'm just going to go with exporting the variables in the mozconfig. Hopefully someone who knows what they're doing can pick this up in the meantime.
Bug 1380665 introduced a "--enable-coverage" option. It doesn't automatically set the compiler flags though, it's only needed to specify that a build is a coverage build.
Depends on: 1380665
Product: Core → Firefox Build System
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: