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

get error : ERROR: <builtin>: output '_coverage/_coverage_report.dat' was not created when execute “bazel run” command #12868

Closed
dzdeping opened this issue Jan 21, 2021 · 5 comments
Labels
coverage P4 This is either out of scope or we don't have bandwidth to review a PR. (No assignee) stale Issues or PRs that are stale (no activity for 30 days) team-Rules-Java Issues for Java rules type: bug

Comments

@dzdeping
Copy link

dzdeping commented Jan 21, 2021

ATTENTION! Please read and follow:

  • if this is a question about how to build / test / query / deploy using Bazel, or a discussion starter, send it to bazel-discuss@googlegroups.com
  • if this is a bug or feature request, fill the form below as best as you can.

Description of the problem / feature request:

when i execute command:
bazel run //:sq -- -Dsonar.host.url=MY_URL -Dsonar.login=MY_NAME -Dsonar.password=MY_PASS

I got this output:
INFO: Build options --collect_code_coverage, --coverage_report_generator, --instrumentation_filter, and 1 more have changed, discarding analysis cache.
INFO: Analyzed target //:sq (2 packages loaded, 174 targets configured).
INFO: Found 1 target...
ERROR: /opt/code/serp/bepcloudbazel/bepcloud/BUILD.bazel:27:10: //:sq: missing input file '//:bazel-out/_coverage/_coverage_report.dat'
Target //:sq failed to build
Use --verbose_failures to see the command lines of failed build steps.
ERROR: /opt/code/serp/bepcloudbazel/bepcloud/BUILD.bazel:27:10 1 input file(s) do not exist
INFO: Elapsed time: 0.193s, Critical Path: 0.07s
INFO: 4 processes: 4 worker.
FAILED: Build did NOT complete successfully
FAILED: Build did NOT complete successfully

And then ,i tried to run : "bazel coverage //..." to generate the "_coverage_report.dat" file, but got an error as below:

account@DZ:/opt/code/serp/bepcloudbazel/bepcloud# bazel coverage //...
_INFO: Using default value for --instrumentation_filter: "//bepcloud-parent/bepcloud-common[/:]".
INFO: Override the above default with --instrumentation_filter
INFO: Build options --collect_code_coverage, --coverage_report_generator, --instrumentation_filter, and 1 more have changed, discarding analysis cache.
INFO: Analyzed 6 targets (0 packages loaded, 230 targets configured).
INFO: Found 5 targets and 1 test target...
INFO: LCOV coverage report is located at /root/.cache/bazel/_bazel_root/b522ef4008cbaf1fbce240d7f801c5b6/execroot/main/bazel-out/_coverage/_coverage_report.dat
and execpath is bazel-out/_coverage/_coverage_report.dat
INFO: From CoverageReport _coverage/_coverage_report.dat:
Jan 21, 2021 3:06:49 PM com.google.devtools.coverageoutputgenerator.SonarQubeCoverageGenerator getTracefiles
INFO: Found 1 tracefiles.
Jan 21, 2021 3:06:49 PM com.google.devtools.coverageoutputgenerator.SonarQubeCoverageGenerator parseFiles
SEVERE: Parsing file bazel-out/k8-fastbuild/testlogs/bepcloud-parent/bepcloud-common/subarrytest/coverage.dat
Jan 21, 2021 3:06:49 PM com.google.devtools.coverageoutputgenerator.SonarQubeCoverageGenerator getGcovInfoFiles
INFO: No gcov info file found.
Jan 21, 2021 3:06:49 PM com.google.devtools.coverageoutputgenerator.SonarQubeCoverageGenerator getProfdataFileOrNull
INFO: No .profdata file found.
Jan 21, 2021 3:06:49 PM com.google.devtools.coverageoutputgenerator.SonarQubeCoverageGenerator main
WARNING: There was no coverage found.
ERROR: : output '_coverage/_coverage_report.dat' was not created
ERROR: : not all outputs were created or valid

INFO: Elapsed time: 0.341s, Critical Path: 0.24s
INFO: 4 processes: 1 linux-sandbox, 3 worker.
FAILED: Build did NOT complete successfully
//bepcloud-parent/bepcloud-common:subarrytest (cached) PASSED in 0.7s

Executed 0 out of 1 test: 1 test passes.
All tests passed but there were other errors during the build.
FAILED: Build did NOT complete successfully_

What operating system are you running Bazel on?

Ubuntu 18.04.2

What's the output of bazel info release?

release 3.5.0

Have you found anything relevant by searching the web?

#7719.
but did not work

Any other information, logs, or outputs that you want to share?

The WORKSPACE file:
_http_archive(
name = "bazel_sonarqube",
sha256 = "e33f8222983b20cc4eb7d128db68bf83a63571d0b6e05b97bd3871b81f8fb9d9",
strip_prefix = "bazel-sonarqube-56537ff1cf4e6c28fba2b06e0f20d1f4e186645e",
urls = ["https://github.com/Zetten/bazel-sonarqube/archive/56537ff1cf4e6c28fba2b06e0f20d1f4e186645e.zip"],
)

load("@bazel_sonarqube//:repositories.bzl", "bazel_sonarqube_repositories")

bazel_sonarqube_repositories(
sonar_scanner_cli_sha256 = "a271a933d14da6e8705d58996d30afd0b4afc93c0bfe957eb377bed808c4fa89",
sonar_scanner_cli_version = "4.5.0.2216",
)_

The parent BUILD file:
_load("@bazel_sonarqube//:defs.bzl", "sonarqube")
filegroup(
name = "git",
srcs = glob(
[".git/"],
exclude = [".git//["], # gitk creates temp files with []
),
tags = ["manual"],
)

filegroup(
name = "coverage_report",
srcs = ["bazel-out/_coverage/_coverage_report.dat"],
tags = ["manual"],
visibility = ["//visibility:public"],
)

filegroup(
name = "test_reports",
srcs = glob(["bazel-testlogs/**/test.xml"]),
tags = ["manual"],
visibility = ["//visibility:public"],
)

sonarqube(
name = "sq",
coverage_report = ":coverage_report",
modules = {"//bepcloud-parent/bepcloud-common:subarrytest":"subarrytest"},
project_key = "bepcloud:bepcloud-common",
project_name = "bepcloud-common-bazel",
scm_info = [":git"],
tags = ["manual"],
)_

The child BUILD file:
_filegroup(
name = "file_java_srcs",
srcs = glob(["src/main/java/com/huawei/bepcloud/validater/SubArray.java"]),
)

java_library(
name = "source_java",
srcs = [":file_java_srcs"],
)

java_library(
name = "file_java_tests",
testonly = False,
srcs = glob(["src/main/java/com/huawei/bepcloud/validater/SubArrayTest.java"]),
deps = [
":source_java",
"@maven//:junit_junit",
],
)

java_test(
name = "subarrytest",
size = "small",
testonly = False,
test_class = "com.huawei.bepcloud.validater.SubArrayTest",
runtime_deps = [":file_java_tests"],
visibility = ["//visibility:public"],
)_

The ENV is:
OS: Ubuntu 18.04.2 LTS
GCC: gcc version 7.3.0 (Ubuntu 7.3.0-27ubuntu1~18.04)
bazel : 3.5.0
sonarqube : 8.5.1.38104

@gregestren gregestren added team-Rules-Server Issues for serverside rules included with Bazel type: bug untriaged labels Jan 26, 2021
@dzdeping
Copy link
Author

dzdeping commented Jan 29, 2021

As supplements:
when .bazelrc file is:

build --define=ABSOLUTE_JAVABASE=/opt/buildtools/adoptopenjdk-8u242b08/jdk8u242-b08
build --javabase=@bazel_tools//tools/jdk:absolute_javabase
build --host_javabase=@bazel_tools//tools/jdk:absolute_javabase
build --java_toolchain=@bazel_tools//tools/jdk:toolchain_vanilla
build --host_java_toolchain=@bazel_tools//tools/jdk:toolchain_vanilla
coverage --collect_code_coverage
coverage --combined_report=lcov
coverage --coverage_report_generator=@bazel_sonarqube//:sonarqube_coverage_generator

And error log in /root/.cache/bazel/_bazel_root/ef23feb022b492d353b857069ef82962:

210129 06:43:46.639:I 20 [com.google.devtools.build.lib.runtime.CacheFileDigestsModule.logStats] Accumulated cache stats before command: hit count=0, miss count=0, hit rate=1.00000, eviction count=0 210129 06:43:46.702:I 20 [com.google.devtools.build.lib.buildtool.SymlinkForest.plantSymlinkForest] Planted symlink forest in /root/.cache/bazel/_bazel_root/ef23feb022b492d353b857069ef82962/execroot/bepcloud 210129 06:43:46.708:I 20 [com.google.devtools.build.lib.runtime.BlazeWorkspace.getPersistentActionCache] Spent 2 milliseconds doing Loading action cache 210129 06:43:46.713:I 20 [com.google.devtools.build.lib.skyframe.FilesystemValueChecker.getDirtyActionValues] Accumulating dirty actions 210129 06:43:46.749:I 20 [com.google.devtools.build.lib.skyframe.FilesystemValueChecker.getDirtyActionValues] Sharded action values for batching 210129 06:43:46.750:I 20 [com.google.devtools.build.lib.skyframe.FilesystemValueChecker.getDirtyActionValues] Completed output file stat checks 210129 06:43:46.750:I 20 [com.google.devtools.build.lib.skyframe.SequencedSkyframeExecutor.detectModifiedOutputFiles] Found 0 modified files from last build 210129 06:43:47.522:I 206 [com.google.devtools.build.lib.exec.FileWriteStrategy.beginWriteOutputToFile] Spent 194 milliseconds doing running write for action action 'Creating source manifest for //bepcloud_frontEnd:serve' 210129 06:43:52.929:I 206 [com.google.devtools.build.lib.exec.SymlinkTreeStrategy.createSymlinks] Spent 5324 milliseconds doing running action 'Creating runfiles tree bazel-out/k8-fastbuild/bin/bepcloud_frontEnd/serve.sh.runfiles' 210129 06:43:56.067:I 212 [com.google.devtools.build.lib.exec.SymlinkTreeStrategy.createSymlinks] Spent 7319 milliseconds doing running action 'Creating runfiles tree bazel-out/host/bin/external/npm/vue-cli-launcher/bin/vue-cli-launcher.sh.runfiles [for host]' **210129 06:44:12.947:W 208 [com.google.devtools.build.lib.skyframe.SkyframeActionExecutor.reportMissingOutputFile] Error creating output '_coverage/_coverage_report.dat' : _coverage/_coverage_report.dat does not exist 210129 06:44:12.957:WT 208 [com.google.devtools.build.skyframe.AbstractParallelEvaluator$Evaluate.run] Aborting evaluation while evaluating UnshareableActionLookupData{actionLookupKey=com.google.devtools.build.lib.skyframe.CoverageReportValue$CoverageReportKey@157b22b, actionIndex=1} com.google.devtools.build.lib.skyframe.ActionExecutionFunction$ActionExecutionFunctionException: com.google.devtools.build.lib.actions.AlreadyReportedActionExecutionException: not all outputs were created or valid at com.google.devtools.build.lib.skyframe.ActionExecutionFunction.compute(ActionExecutionFunction.java:326) at com.google.devtools.build.skyframe.AbstractParallelEvaluator$Evaluate.run(AbstractParallelEvaluator.java:477) at com.google.devtools.build.lib.concurrent.AbstractQueueVisitor$WrappedRunnable.run(AbstractQueueVisitor.java:398) 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: com.google.devtools.build.lib.actions.AlreadyReportedActionExecutionException: not all outputs were created or valid ... 6 more** 210129 06:44:13.709:I 20 [com.google.devtools.build.lib.buildtool.ExecutionTool.saveActionCache] Spent 0 milliseconds doing Saving action cache 210129 06:44:13.719:I 20 [com.google.devtools.build.lib.runtime.BuildSummaryStatsModule.buildComplete] Critical Path: 26.16s, Remote (0.00% of the time): [parse: 0.00%, queue: 0.00%, network: 0.00%, upload: 0.00%, setup: 0.00%, process: 0.00%, fetch: 0.00%, retry: 0.00%, processOutputs: 0.00%, other: 0.00%, input files: 0, input bytes: 0, memory bytes: 0]

@Nikunj1703
Copy link

Nikunj1703 commented Dec 18, 2021

Is there a work-around for this?
I tried using both --incompatible_cc_coverage --experimental_cc_coverage. It doesn't work.

Following are env. details where I see above mentioned error:
Bazel: release 4.0.0
GCC: gcc (Debian 8.3.0-6) 8.3.0
OS: x86_64 GNU/Linux

It works for me only in Mac: Darwin Kernel Version 20.6.0, Bazel: release 4.0.0

@comius comius added team-Rules-Java Issues for Java rules coverage P4 This is either out of scope or we don't have bandwidth to review a PR. (No assignee) and removed team-Rules-Server Issues for serverside rules included with Bazel untriaged labels Jul 19, 2022
@comius
Copy link
Contributor

comius commented Jul 19, 2022

I don't see specific issue for Bazel here, maybe report this also on bazel_sonarqube repo.

@github-actions
Copy link

Thank you for contributing to the Bazel repository! This issue has been marked as stale since it has not had any activity in the last 1+ years. It will be closed in the next 90 days unless any other activity occurs or one of the following labels is added: "not stale", "awaiting-bazeler". Please reach out to the triage team (@bazelbuild/triage) if you think this issue is still relevant or you are interested in getting the issue resolved.

@github-actions github-actions bot added the stale Issues or PRs that are stale (no activity for 30 days) label Sep 23, 2023
Copy link

This issue has been automatically closed due to inactivity. If you're still interested in pursuing this, please reach out to the triage team (@bazelbuild/triage). Thanks!

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Dec 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
coverage P4 This is either out of scope or we don't have bandwidth to review a PR. (No assignee) stale Issues or PRs that are stale (no activity for 30 days) team-Rules-Java Issues for Java rules type: bug
Projects
None yet
Development

No branches or pull requests

4 participants