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

coverage creates the offline.jar into same directory for tests with different directories #1528

Open
nlou9 opened this issue Nov 30, 2023 · 0 comments

Comments

@nlou9
Copy link

nlou9 commented Nov 30, 2023

we have two tests
core/src/test/scala/integration/kafka/api/MetricsTest.scala
core/src/test/scala/unit/kafka/metrics/MetricsTest.scala

We have one BUILD.bazel file under the root of core and scala_library will create two targets for this two files //core:src/test/scala/integration/kafka/api/MetricsTest_lib, //core:src/test/scala/unit/kafka/metrics/MetricsTest_lib.

It seems bazel coverage takes the BUILD.bazel file as root to create the .jar for both tests to the same directory core/MetricsTest_lib-offline.jar. That causes conflict.

I checked the coverage code, it seems related to this line. wonder why don't we use the full path here.

"{}-offline.jar".format(input_jar.basename.split(".")[0]),

 bazel coverage //core:all

ERROR: file 'core/MetricsTest_lib-offline.jar' is generated by these conflicting actions:
Label: //core:src/test/scala/integration/kafka/api/MetricsTest_lib, //core:src/test/scala/unit/kafka/metrics/MetricsTest_lib
RuleClass: scala_library rule
JavaActionClass: class com.google.devtools.build.lib.analysis.actions.StarlarkAction
Configuration: 431c6ed08bc0b6e39a8f21066ea2b734ef6de2238f4c0230711b0d2342811a3d
Mnemonic: JacocoInstrumenter
Action key: 632a747906afd7af6e359f859b01779a0ec638a0b658c82157cf7be4d63abf89, ddfc66e8613b8842448c9cc42558e68ed5b78ed803ff5acc113890398ca9ba64
Progress message: JacocoInstrumenter core/MetricsTest_lib-offline.jar
Action describeKey: JacocoInstrumenter core/MetricsTest_lib-offline.jar
  Argument: bazel-out/darwin-opt-exec-2B5CBBC6/bin/external/io_bazel_rules_scala/src/java/io/bazel/rulesscala/coverage/instrumenter/instrumenter
  Argument: bazel-out/darwin-fastbuild/bin/core/src/test/scala/integration/kafka/api/MetricsTest_lib.jar
  Argument: bazel-out/darwin-fastbuild/bin/core/MetricsTest_lib-offline.jar
  Argument: core/src/test/scala/integration/kafka/api/MetricsTest.scala
, JacocoInstrumenter core/MetricsTest_lib-offline.jar
  Argument: bazel-out/darwin-opt-exec-2B5CBBC6/bin/external/io_bazel_rules_scala/src/java/io/bazel/rulesscala/coverage/instrumenter/instrumenter
  Argument: bazel-out/darwin-fastbuild/bin/core/src/test/scala/unit/kafka/metrics/MetricsTest_lib.jar
  Argument: bazel-out/darwin-fastbuild/bin/core/MetricsTest_lib-offline.jar
  Argument: core/src/test/scala/unit/kafka/metrics/MetricsTest.scala

PrimaryInput: File:[[<execution_root>]bazel-out/darwin-fastbuild/bin]core/src/test/scala/integration/kafka/api/MetricsTest_lib.jar, File:[[<execution_root>]bazel-out/darwin-fastbuild/bin]core/src/test/scala/unit/kafka/metrics/MetricsTest_lib.jar
PrimaryOutput: File:[[<execution_root>]bazel-out/darwin-fastbuild/bin]core/MetricsTest_lib-offline.jar
ERROR: com.google.devtools.build.lib.actions.MutableActionGraph$ActionConflictException: for core/MetricsTest_lib-offline.jar, previous action: action 'JacocoInstrumenter core/MetricsTest_lib-offline.jar', attempted action: action 'JacocoInstrumenter core/MetricsTest_lib-offline.jar'
INFO: Elapsed time: 6.896s
INFO: 0 processes.
ERROR: Couldn't start the build. Unable to run tests
INFO: Build Event Protocol files produced successfully.
FAILED: Build did NOT complete successfully (605 packages loaded, 11251 targets configured)
Error: bazel exited with exit code: 1
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

No branches or pull requests

1 participant