Attention is currently required from: Łukasz Anforowicz, John Chen.
To view, visit change 3513336. To unsubscribe, or for help writing mail filters, visit settings.
Attention is currently required from: danakj, Łukasz Anforowicz.
Patch set 4:Code-Review +1
Attention is currently required from: Łukasz Anforowicz.
Patch set 5:Commit-Queue +2
Attention is currently required from: Łukasz Anforowicz.
Patch set 5:Commit-Queue +1
Attention is currently required from: danakj, Łukasz Anforowicz.
danakj uploaded patch set #7 to this change.
Generate Rust crate roots for test() targets.
Test targets don't have a public interface and are simply a collection
of independent test files. Instead of requiring devs to write a crate
root pointing to each of those files (and introducing a chance for
mistakenly forgetting a file which would then exclude its tests
silently), generate the crate root from the set of rust files in
`sources`.
The module name encodes the full path to each file in sources, so that
foo/bar.rs and baz/bar.rs do not collide as both being `mod bar;`.
Instead they would be `mod foo_bar;` and `mod baz_bar;`
Example generated file for base_unittests (which has a base_unittests_rs
Rust target):
% cat out_desktop/Release/gen/base/base_unittests_rs_crate_root.rs
// Generated crate root for base_unittests_rs.
#[path = "../../../../base/json/json_parser_unittest.rs"]
mod json_json_parser_unittest.rs;
#[path = "../../../../base/values_unittest.rs"]
mod values_unittest.rs;
R=john...@chromium.org, luk...@chromium.org
Bug: 1293979
Change-Id: I33c28a181340fbf75beb0a01dc851b268805a80e
Cq-Include-Trybots: luci.chromium.try:linux-rust-x64-rel,android-rust-arm-rel
---
M base/BUILD.gn
M build/rust/mixed_target.gni
M build/rust/rust_target.gni
M testing/rust_gtest_interop/BUILD.gn
M testing/rust_gtest_interop/README.md
M testing/test.gni
6 files changed, 73 insertions(+), 26 deletions(-)
To view, visit change 3513336. To unsubscribe, or for help writing mail filters, visit settings.
Attention is currently required from: Łukasz Anforowicz.
1 comment:
Patchset:
PTAL lukasza. I've made sure we don't have module name collisions (unless you used underscores to carefully construct one, in which case we can go further in generating the module name).
To view, visit change 3513336. To unsubscribe, or for help writing mail filters, visit settings.
Attention is currently required from: danakj.
Patch set 7:Code-Review +1
3 comments:
Patchset:
Thanks! LGTM if you think that my concerns about "foo_test_support" module are sufficiently under control.
File build/rust/rust_target.gni:
Patch Set #7, Line 58: Generated
nit: s/ Generated / @generated /
See https://rust-lang.github.io/rustfmt/?version=v1.4.38&search=#format_generated_files (I hear that other tools can also recognize this marker).
Patch Set #7, Line 62: "/", "_")
This works if test sources only contain individual modules that do not refer to each other. This is usually the case, but sometimes there may be some shared helper functions. I guess you are saying that they should be put into a separate `foo_test_support` target/crate?
I wonder what the error looks like in this case? And what `mod` statements can be put into the test support helper module A) itself and B) it's users, to fix the errors.
To view, visit change 3513336. To unsubscribe, or for help writing mail filters, visit settings.
2 comments:
File build/rust/rust_target.gni:
Patch Set #7, Line 58: Generated
nit: s/ Generated / @generated / […]
Oh interesting, thanks!
Patch Set #7, Line 62: "/", "_")
I guess you are saying that they should be put into a separate foo_test_support target/crate?
Precisely.
There would be no error if you did this directly, but you'd have to figure out the crate path to it. You'd have to like use like `crate::the_generated_path::Helper`.
I will call this out in the README as well.
To view, visit change 3513336. To unsubscribe, or for help writing mail filters, visit settings.
Patch set 8:Commit-Queue +2
Patch set 9:Commit-Queue +2
Attention is currently required from: danakj.
danakj uploaded patch set #10 to this change.
Generate Rust crate roots for test() targets.
Test targets don't have a public interface and are simply a collection
of independent test files. Instead of requiring devs to write a crate
root pointing to each of those files (and introducing a chance for
mistakenly forgetting a file which would then exclude its tests
silently), generate the crate root from the set of rust files in
`sources`.
The module name encodes the full path to each file in sources, so that
foo/bar.rs and baz/bar.rs do not collide as both being `mod bar;`.
Instead they would be `mod foo_bar;` and `mod baz_bar;`
Example generated file for base_unittests (which has a base_unittests_rs
Rust target):
% cat out_desktop/Release/gen/base/base_unittests_rs_crate_root.rs
// Generated crate root for base_unittests_rs.
#[path = "../../../../base/json/json_parser_unittest.rs"]
mod json_json_parser_unittest.rs;
#[path = "../../../../base/values_unittest.rs"]
mod values_unittest.rs;
R=john...@chromium.org, luk...@chromium.org
Bug: 1293979
Change-Id: I33c28a181340fbf75beb0a01dc851b268805a80e
Cq-Include-Trybots: android-rust-arm-rel
---
M base/BUILD.gn
M build/rust/mixed_target.gni
M build/rust/rust_target.gni
M testing/rust_gtest_interop/BUILD.gn
M testing/rust_gtest_interop/README.md
M testing/test.gni
6 files changed, 101 insertions(+), 26 deletions(-)
To view, visit change 3513336. To unsubscribe, or for help writing mail filters, visit settings.
Patch set 10:Commit-Queue +2
1 comment:
Patchset:
Linux rust trybot broke when clang rolled and the set of libs in the clang dir changed. So skipping that one for now. Ade is working to fix it.
To view, visit change 3513336. To unsubscribe, or for help writing mail filters, visit settings.
CQ can't continue processing your CL:
* Failed to parse additional builders: project/bucket and builders must be separated by : in `android-rust-arm-rel`. Canonical syntax is "Cq-Include-Trybots: project/bucket:builder1,builder2;another/bucket:b3". Multiple lines are allowed.
danakj uploaded patch set #11 to this change.
Generate Rust crate roots for test() targets.
Test targets don't have a public interface and are simply a collection
of independent test files. Instead of requiring devs to write a crate
root pointing to each of those files (and introducing a chance for
mistakenly forgetting a file which would then exclude its tests
silently), generate the crate root from the set of rust files in
`sources`.
The module name encodes the full path to each file in sources, so that
foo/bar.rs and baz/bar.rs do not collide as both being `mod bar;`.
Instead they would be `mod foo_bar;` and `mod baz_bar;`
Example generated file for base_unittests (which has a base_unittests_rs
Rust target):
% cat out_desktop/Release/gen/base/base_unittests_rs_crate_root.rs
// Generated crate root for base_unittests_rs.
#[path = "../../../../base/json/json_parser_unittest.rs"]
mod json_json_parser_unittest.rs;
#[path = "../../../../base/values_unittest.rs"]
mod values_unittest.rs;
R=john...@chromium.org, luk...@chromium.org
Bug: 1293979
Change-Id: I33c28a181340fbf75beb0a01dc851b268805a80e
Cq-Include-Trybots: luci.chromium.try:android-rust-arm-rel
---
M base/BUILD.gn
M build/rust/mixed_target.gni
M build/rust/rust_target.gni
M testing/rust_gtest_interop/BUILD.gn
M testing/rust_gtest_interop/README.md
M testing/test.gni
6 files changed, 101 insertions(+), 26 deletions(-)
To view, visit change 3513336. To unsubscribe, or for help writing mail filters, visit settings.
Attention is currently required from: danakj.
Patch set 11:Commit-Queue +2
Chromium LUCI CQ submitted this change.
7 is the latest approved patch-set.
The change was submitted with unreviewed changes in the following files:
```
The name of the file: build/rust/rust_target.gni
Insertions: 12, Deletions: 5.
The diff is too large to show. Please review the diff.
```
```
The name of the file: testing/rust_gtest_interop/README.md
Insertions: 21, Deletions: 0.
The diff is too large to show. Please review the diff.
```
Generate Rust crate roots for test() targets.
Test targets don't have a public interface and are simply a collection
of independent test files. Instead of requiring devs to write a crate
root pointing to each of those files (and introducing a chance for
mistakenly forgetting a file which would then exclude its tests
silently), generate the crate root from the set of rust files in
`sources`.
The module name encodes the full path to each file in sources, so that
foo/bar.rs and baz/bar.rs do not collide as both being `mod bar;`.
Instead they would be `mod foo_bar;` and `mod baz_bar;`
Example generated file for base_unittests (which has a base_unittests_rs
Rust target):
% cat out_desktop/Release/gen/base/base_unittests_rs_crate_root.rs
// Generated crate root for base_unittests_rs.
#[path = "../../../../base/json/json_parser_unittest.rs"]
mod json_json_parser_unittest.rs;
#[path = "../../../../base/values_unittest.rs"]
mod values_unittest.rs;
R=john...@chromium.org, luk...@chromium.org
Bug: 1293979
Change-Id: I33c28a181340fbf75beb0a01dc851b268805a80e
Cq-Include-Trybots: luci.chromium.try:android-rust-arm-rel
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3513336
Reviewed-by: John Chen <john...@chromium.org>
Reviewed-by: Łukasz Anforowicz <luk...@chromium.org>
Commit-Queue: danakj <dan...@chromium.org>
Cr-Commit-Position: refs/heads/main@{#979869}
---
M base/BUILD.gn
M build/rust/mixed_target.gni
M build/rust/rust_target.gni
M testing/rust_gtest_interop/BUILD.gn
M testing/rust_gtest_interop/README.md
M testing/test.gni
6 files changed, 106 insertions(+), 26 deletions(-)