-
Notifications
You must be signed in to change notification settings - Fork 393
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
Inform users that crate
and srcs
are mutually exclusive
#1650
Conversation
I guess this turned out to not be the case due to: https://github.com/bazelbuild/rules_rust/blob/0.12.0/test/inline_test_with_deps/test_with_srcs/BUILD.bazel
However, if I were to have a test source file exist outside of the traditional package structure, it seems tests go ignored diff --git a/test/inline_test_with_deps/test_with_srcs/BUILD.bazel b/test/inline_test_with_deps/test_with_srcs/BUILD.bazel
index 64d628e5..bc8c71f4 100644
--- a/test/inline_test_with_deps/test_with_srcs/BUILD.bazel
+++ b/test/inline_test_with_deps/test_with_srcs/BUILD.bazel
@@ -14,7 +14,10 @@ rust_library(
rust_test(
name = "inline_test",
- srcs = ["src/extra.rs"],
+ srcs = [
+ "src/extra.rs",
+ "tests/test.rs",
+ ],
crate = ":inline",
deps = ["//test/inline_test_with_deps/dep"],
)
diff --git a/test/inline_test_with_deps/test_with_srcs/tests/test.rs b/test/inline_test_with_deps/test_with_srcs/tests/test.rs
new file mode 100644
index 00000000..edbfb4cf
--- /dev/null
+++ b/test/inline_test_with_deps/test_with_srcs/tests/test.rs
@@ -0,0 +1,4 @@
+#[test]
+fn some_test() {
+ assert!(false);
+} I wonder if this functionality should be supported, where one can have |
I'd also expect rust_test.crate and rust_test.srcs to be mutually exclusive and that test case is surprising to me. |
I did some archeology and I think we should delete the test. The origin of the logic in questoin is from https://github.com/bazelbuild/rules_rust/pull/203/files#r272400341 and I claim that the feature wasn't really needed (used for test-only submodules with test helpers, but authors seem to be fine with not supporting the feature), alternatives were not explored (for example why not have a test helpers crate in deps?), and as we can see it is buggy. So I vote for deleting the test and submitting this PR (thank you @UebelAndre for working on this!) |
I should have checked for all tests before but it seems there's one more that fails
This was introduced in #954. I'll have to dig into this to figure out what the expectation is. |
@sayrer @briansmith maybe one of you could help me understand #1650 (comment) ? |
e66526d
to
5ccb45b
Compare
cc @illicitonion would you be able to review? |
f80866a
to
a9a72ae
Compare
527bd79
to
4ec1ddd
Compare
f9f67b4
to
94e11f4
Compare
chore: rules_rust 0.33.0 -> 0.42.1 in `rust_test` `src` and `crate` are mutually [exlusive](bazelbuild/rules_rust#1650). The current behaviour is that `src` is ignored. See merge request dfinity-lab/public/ic!18760
This should avoid confusion in cases where users have defined tests with both
rust_test.crate
andrust_test.srcs
set and later findrust_test.srcs
are actually unused and not being tested.relates to #2324