bazelbuild / rules_rust

Rust rules for Bazel
https://bazelbuild.github.io/rules_rust/
Apache License 2.0
659 stars 424 forks source link

rust_test_suite does not pull in common code in common module #2266

Open wmcrobertsq opened 11 months ago

wmcrobertsq commented 11 months ago

In attempting to get a simple rust_test_suite target running, I think I am seeing that it does not support the design pattern for including common functionality as detailed here in the Rust Book submodules-in-integration-tests.

Specifically, when placing common code into common/mod.rs and referencing the common functionality in the root level integration tests, I am getting the following error message:

error[E0583]: file not found for module `common`
  |
3 | mod common;
  | ^^^^^^^^^^^
  |

I am now attempting to see if the kwargs parameter for rust_test_suite can help here and will report back. I will also do a sanity check on multiple rust_test setups to accomplish same.

Does anyone have any additional insights to this issue?

gregorygaines commented 10 months ago

I'm having the same issue, my workaround is using rust_binary with the test arg.

rust_binary(
    name = "integration_tests",
    srcs = glob(["tests/**/*.rs"]),
    rustc_flags = ["--test"],
    deps = [":lib"],
)