-
Notifications
You must be signed in to change notification settings - Fork 42
Make it possible to use llvm-cov with bazel coverage
#377
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
crosstool/osx_cc_configure.bzl
Outdated
]) | ||
if result.return_code != 0: | ||
return None | ||
return result.stdout.strip() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does these being host specific absolute paths affect caching? since this will have the absolute path to Xcode.app in it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, you're right that the coverage actions will probably be cached incorrectly. This was already the case if the GCOV
env var was set, so I didn't notice. What's a good way forward here?
Looks like I can put the _get_tool_path logic into a bash script and then:
tool_paths["llvm-cov"] = "llvm-cov.sh"
That should result in a relative path being baked into the action instead of an absolute path. Do you think that'd work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea i think that would work.
I think the reason the gcov one has flown under the radar is because in apple specific (aka non-c++) tests the coverage logic is handled in rules_apple and sidesteps all of this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no worries. I think the updated version addresses this issue. If no overrides are present then the cache key contains a script which just says xcrun --run gcov/llvm-profdata/llvm-cov
. Since the script is the same across machines caching should work fine.
If there are override env vars present, then as long as users set the override to the same value, they should also get cache hits.
The fact that
llvm-cov
andllvm-profdata
are not set seems to trip up theexternal/bazel_tools/tools/test/collect_cc_coverage.sh
script resulting in empty .dat files.To solve the issue we implement something similar to what's done in rules_cc.
After these changes
bazel coverage <test target>
no longer produces empty .dat files.