Skip to content
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

Fix code coverage collection. #2001

Merged
merged 4 commits into from
Jun 13, 2023
Merged

Conversation

UebelAndre
Copy link
Collaborator

@UebelAndre UebelAndre commented Jun 10, 2023

This change fixes code coverage. Some notable findings as of Bazel 6.2.1.

  • _collect_cc_coverage and _lcov_merger are magic attributes that enable the coverage behavior folks might be familiar with in C++ and other native rules.
  • Coverage should not be written to COVERAGE_OUTPUT_FILE in _collect_cc_coverage tools. This value appears to only be intended for _lcov_merger tools. Instead, write to COVERAGE_DIR.
  • lcov outputs are expected to have the .dat extension.

Additionally this bumps the min tested version to avoid the following error:

(17:44:41) ERROR: /workdir/test/unit/win_interface_library/BUILD.bazel:4:42: Reporting failed target //test/unit/win_interface_library:win_interface_library_test located at /workdir/test/unit/win_interface_library/BUILD.bazel:4:42 failed: Can't build this. This target is incompatible. Please file a bug upstream. caused by //test/unit/win_interface_library:win_interface_library_test

@UebelAndre UebelAndre force-pushed the coverage_ci branch 6 times, most recently from e9ca5ed to 31c0896 Compare June 10, 2023 17:57
@UebelAndre UebelAndre enabled auto-merge (squash) June 10, 2023 18:01
@UebelAndre UebelAndre requested a review from illicitonion June 10, 2023 18:02
@UebelAndre UebelAndre force-pushed the coverage_ci branch 5 times, most recently from e456134 to d15d2f2 Compare June 11, 2023 14:46
@UebelAndre
Copy link
Collaborator Author

I'm seeing an odd failure on RBE builds. @scentini @meteorcloudy would either of you be able to take a look?
https://buildkite.com/bazel/rules-rust-rustlang/builds/8715#0188aaec-43c1-4ad1-a9fe-62cdbf7d03e3

(14:48:13) FAIL: //test:hello_lib_rule_test (see /var/lib/buildkite-agent/.cache/bazel/_bazel_buildkite-agent/ec321eb2cc2d0f8f91b676b6d4c66c29/execroot/rules_rust/bazel-out/k8-fastbuild/testlogs/test/hello_lib_rule_test/test.log)
(14:48:13) FAIL: //test/rust:hello_lib_rule_test (see /var/lib/buildkite-agent/.cache/bazel/_bazel_buildkite-agent/ec321eb2cc2d0f8f91b676b6d4c66c29/execroot/rules_rust/bazel-out/k8-fastbuild/testlogs/test/rust/hello_lib_rule_test/test.log)
(14:48:13) FAIL: //test/rust:hello_world_rule_test (see /var/lib/buildkite-agent/.cache/bazel/_bazel_buildkite-agent/ec321eb2cc2d0f8f91b676b6d4c66c29/execroot/rules_rust/bazel-out/k8-fastbuild/testlogs/test/rust/hello_world_rule_test/test.log)
(14:48:13) FAIL: //test:hello_world_rule_test (see /var/lib/buildkite-agent/.cache/bazel/_bazel_buildkite-agent/ec321eb2cc2d0f8f91b676b6d4c66c29/execroot/rules_rust/bazel-out/k8-fastbuild/testlogs/test/hello_world_rule_test/test.log)
(14:48:13) FAIL: //test/rustc_env_files:output_test (see /var/lib/buildkite-agent/.cache/bazel/_bazel_buildkite-agent/ec321eb2cc2d0f8f91b676b6d4c66c29/execroot/rules_rust/bazel-out/k8-fastbuild/testlogs/test/rustc_env_files/output_test/test.log)
(14:48:14) ERROR: <builtin>: Coverage report generation failed: (Exit 34): INVALID_ARGUMENT: Invalid arguments:
  "command.ValidateSpec": Invalid spec - docker container must be specified
java.io.IOException: io.grpc.StatusRuntimeException: INVALID_ARGUMENT: Invalid arguments:
  "command.ValidateSpec": Invalid spec - docker container must be specified
	at com.google.devtools.build.lib.remote.GrpcRemoteExecutor.executeRemotely(GrpcRemoteExecutor.java:235)
	at com.google.devtools.build.lib.remote.RemoteExecutionService.executeRemotely(RemoteExecutionService.java:1496)
	at com.google.devtools.build.lib.remote.RemoteSpawnRunner.lambda$exec$2(RemoteSpawnRunner.java:269)
	at com.google.devtools.build.lib.remote.Retrier.execute(Retrier.java:244)
	at com.google.devtools.build.lib.remote.RemoteRetrier.execute(RemoteRetrier.java:127)
	at com.google.devtools.build.lib.remote.RemoteRetrier.execute(RemoteRetrier.java:116)
	at com.google.devtools.build.lib.remote.RemoteSpawnRunner.exec(RemoteSpawnRunner.java:244)
	at com.google.devtools.build.lib.exec.SpawnRunner.execAsync(SpawnRunner.java:301)
	at com.google.devtools.build.lib.exec.AbstractSpawnStrategy.exec(AbstractSpawnStrategy.java:152)
	at com.google.devtools.build.lib.exec.AbstractSpawnStrategy.exec(AbstractSpawnStrategy.java:112)
	at com.google.devtools.build.lib.exec.SpawnStrategyResolver.exec(SpawnStrategyResolver.java:46)
	at com.google.devtools.build.lib.bazel.coverage.CoverageReportActionBuilder$CoverageReportAction.execute(CoverageReportActionBuilder.java:152)
	at com.google.devtools.build.lib.skyframe.SkyframeActionExecutor$5.execute(SkyframeActionExecutor.java:957)
	at com.google.devtools.build.lib.skyframe.SkyframeActionExecutor$ActionRunner.continueAction(SkyframeActionExecutor.java:1124)
	at com.google.devtools.build.lib.skyframe.SkyframeActionExecutor$ActionRunner.run(SkyframeActionExecutor.java:1082)
	at com.google.devtools.build.lib.skyframe.ActionExecutionState.runStateMachine(ActionExecutionState.java:160)
	at com.google.devtools.build.lib.skyframe.ActionExecutionState.getResultOrDependOnFuture(ActionExecutionState.java:93)
	at com.google.devtools.build.lib.skyframe.SkyframeActionExecutor.executeAction(SkyframeActionExecutor.java:516)
	at com.google.devtools.build.lib.skyframe.ActionExecutionFunction.checkCacheAndExecuteIfNeeded(ActionExecutionFunction.java:827)
	at com.google.devtools.build.lib.skyframe.ActionExecutionFunction.computeInternal(ActionExecutionFunction.java:323)
	at com.google.devtools.build.lib.skyframe.ActionExecutionFunction.compute(ActionExecutionFunction.java:161)
	at com.google.devtools.build.skyframe.AbstractParallelEvaluator$Evaluate.run(AbstractParallelEvaluator.java:571)
	at com.google.devtools.build.lib.concurrent.AbstractQueueVisitor$WrappedRunnable.run(AbstractQueueVisitor.java:382)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)
Caused by: io.grpc.StatusRuntimeException: INVALID_ARGUMENT: Invalid arguments:
  "command.ValidateSpec": Invalid spec - docker container must be specified
	at io.grpc.Status.asRuntimeException(Status.java:535)
	at io.grpc.stub.ClientCalls$BlockingResponseStream.hasNext(ClientCalls.java:648)
	at com.google.devtools.build.lib.remote.GrpcRemoteExecutor.lambda$executeRemotely$2(GrpcRemoteExecutor.java:169)
	at com.google.devtools.build.lib.remote.Retrier.execute(Retrier.java:244)
	at com.google.devtools.build.lib.remote.RemoteRetrier.execute(RemoteRetrier.java:127)
	at com.google.devtools.build.lib.remote.RemoteRetrier.execute(RemoteRetrier.java:116)
	at com.google.devtools.build.lib.remote.GrpcRemoteExecutor.lambda$executeRemotely$3(GrpcRemoteExecutor.java:140)
	at com.google.devtools.build.lib.remote.util.Utils.refreshIfUnauthenticated(Utils.java:523)
	at com.google.devtools.build.lib.remote.GrpcRemoteExecutor.executeRemotely(GrpcRemoteExecutor.java:138)
	... 25 more

@meteorcloudy
Copy link
Member

/cc @coeuvre any idea?

@UebelAndre UebelAndre force-pushed the coverage_ci branch 9 times, most recently from 5723f6e to db08b06 Compare June 13, 2023 13:37
@UebelAndre UebelAndre force-pushed the coverage_ci branch 3 times, most recently from aed87d0 to 8da20e8 Compare June 13, 2023 14:09
@UebelAndre UebelAndre changed the title Run coverage for the min Bazel version job Fix code coverage collection. Jun 13, 2023
@UebelAndre
Copy link
Collaborator Author

I've deferred the issue mentioned on #2001 (comment) to #2005

@UebelAndre UebelAndre disabled auto-merge June 13, 2023 15:20
@UebelAndre
Copy link
Collaborator Author

Adding @krasimirgg and @scentini to see if I can't get this merged soon for the release 😅

@UebelAndre
Copy link
Collaborator Author

I made #2004 as a minor spinoff so there's a unique commit for the change.

@UebelAndre UebelAndre enabled auto-merge (squash) June 13, 2023 17:10
@UebelAndre UebelAndre merged commit 93b230b into bazelbuild:main Jun 13, 2023
@UebelAndre UebelAndre deleted the coverage_ci branch June 13, 2023 17:34
Silcet pushed a commit to Silcet/rules_rust that referenced this pull request Jul 10, 2023
* Minor CI and test cleanup

* Bump min tested Bazel version to 5.2.0

* Fix code coverage collection.
Silcet pushed a commit to Silcet/rules_rust that referenced this pull request Jul 10, 2023
* Minor CI and test cleanup

* Bump min tested Bazel version to 5.2.0

* Fix code coverage collection.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants