Bug 264202

Summary: WebKit build fails while generating coverage data with generate-coverage-data script
Product: WebKit Reporter: Andreas Wilhelm <wilhelm>
Component: Tools / TestsAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: achristensen, ap, ddkilzer, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Local Build   
Hardware: Mac (Intel)   
OS: macOS 13   

Description Andreas Wilhelm 2023-11-04 04:13:17 PDT
We want to generate coverage data for WebKit as input for our static analysis tool.

Unfortunately, the script Tools/Scripts/generate-coverage-data fails on step 2 (calling "Tools/Scripts/build-webkit -- coverage --release").
The first issue occurs because $coverageIsEnabled is undefined when calling Tools/Scripts/check-for-weak-vtables-and-externals, as e.g. ___llvm_profile_filename has weak symbols.

When explicitly defining $coverageIsEnabled in determineCoverageIsEnabled() in Tools/Scripts/webkitidirs.pm, the building continues until we hit another error when building JavaScriptCore:
The following build commands failed:
GenerateTAPI WebKit/WebKitBuild/Release/JavaScriptCore.framework/Versions/A/JavaScriptCore.tbd normal x86_64 (in target 'JavaScriptCore' from project 'JavaScriptCore')

So we have the following questions regarding the generate-coverage-data script:
1. Is the script doing what we expect: generate coverage reports for WebKit?
2. Is the script expected to run on a MacBook (i9 or M2 MAX)?
3. Are we missing some requirements or how do we fix the issue(s) above?

Best regards,
Andreas
Comment 1 Alexey Proskuryakov 2023-11-06 09:35:34 PST
This script was last substantially updated in 2013, so I'm not sure if anyone would just know the answers. CC'ing some folks with an interest in this area though.
Comment 2 Andreas Wilhelm 2023-11-06 12:39:05 PST
The mentioned issue also appears when enabling coverage for the WebKit schema in XCode. So it’s maybe a general question how coverage data is produced!?
Comment 3 Alexey Proskuryakov 2023-11-06 13:53:08 PST
You may want to disable tbd verification (see TAPI_VERIFY_MODE) to get past the GenerateTAPI error. Coverage must be adding exported symbols that are not part of API.
Comment 4 Radar WebKit Bug Importer 2023-11-11 03:14:13 PST
<rdar://problem/118270349>