Add //testing/rust_gtest_interop when //testing/gtest is in deps [chromium/src : main]

0 views
Skip to first unread message

danakj (Gerrit)

unread,
Mar 2, 2022, 10:27:57 AM3/2/22
to rust...@chromium.org, John Chen, chromium...@chromium.org, Matthew Riley

Attention is currently required from: John Chen.

View Change

1 comment:

To view, visit change 3497966. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ia18d2dc89661ada05b6d96d15b5f2906a733f621
Gerrit-Change-Number: 3497966
Gerrit-PatchSet: 1
Gerrit-Owner: danakj <dan...@chromium.org>
Gerrit-Reviewer: John Chen <john...@chromium.org>
Gerrit-CC: Matthew Riley <mat...@chromium.org>
Gerrit-Attention: John Chen <john...@chromium.org>
Gerrit-Comment-Date: Wed, 02 Mar 2022 15:27:46 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment

danakj (Gerrit)

unread,
Mar 2, 2022, 10:28:09 AM3/2/22
to rust...@chromium.org

Attention is currently required from: John Chen.

danakj uploaded patch set #2 to this change.

View Change

Add //testing/rust_gtest_interop when //testing/gtest is in deps

To make it simpler to add rust files to a unit test, act as if Rust
interop support is build into //testing/gtest. Then a person only needs
to add `rs_sources = [ "foo.rs" ]` to their test() target (as well as a
`rs_crate_root` for now), and their rust files will automatically get
the Rust gtest macros and run as part of their gtest binary.

We add //testing/rust_gtest_interop to rs_deps only if:
1. The target already depends on //testing/gtest, since otherwise it
would not work.
2. The target defines a non-empty rs_sources; that is, they have Rust
unit tests in the test() target.

R=john...@chromium.org

Bug: 1293979
Change-Id: Ia18d2dc89661ada05b6d96d15b5f2906a733f621
Cq-Include-Trybots: luci.chromium.try:android-rust-arm-rel,linux-rust-x64-rel
---
M testing/rust_gtest_interop/BUILD.gn
M testing/test.gni
2 files changed, 79 insertions(+), 16 deletions(-)

To view, visit change 3497966. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ia18d2dc89661ada05b6d96d15b5f2906a733f621
Gerrit-Change-Number: 3497966
Gerrit-PatchSet: 2
Gerrit-Owner: danakj <dan...@chromium.org>
Gerrit-Reviewer: John Chen <john...@chromium.org>
Gerrit-CC: Matthew Riley <mat...@chromium.org>
Gerrit-Attention: John Chen <john...@chromium.org>
Gerrit-MessageType: newpatchset

John Chen (Gerrit)

unread,
Mar 2, 2022, 10:59:31 AM3/2/22
to Ben Pastene, rust...@chromium.org, danakj

Attention is currently required from: danakj, Ben Pastene.

John Chen would like Ben Pastene to review this change authored by danakj.

Gerrit-Reviewer: Ben Pastene <bpas...@chromium.org>
Gerrit-CC: John Chen <john...@chromium.org>
Gerrit-CC: Matthew Riley <mat...@chromium.org>
Gerrit-Attention: danakj <dan...@chromium.org>
Gerrit-Attention: Ben Pastene <bpas...@chromium.org>
Gerrit-MessageType: newchange

John Chen (Gerrit)

unread,
Mar 2, 2022, 10:59:38 AM3/2/22
to danakj, rust...@chromium.org, Ben Pastene, chromium...@chromium.org, Matthew Riley

Attention is currently required from: danakj, Ben Pastene.

View Change

1 comment:

To view, visit change 3497966. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ia18d2dc89661ada05b6d96d15b5f2906a733f621
Gerrit-Change-Number: 3497966
Gerrit-PatchSet: 2
Gerrit-Owner: danakj <dan...@chromium.org>
Gerrit-Reviewer: Ben Pastene <bpas...@chromium.org>
Gerrit-CC: John Chen <john...@chromium.org>
Gerrit-CC: Matthew Riley <mat...@chromium.org>
Gerrit-Attention: danakj <dan...@chromium.org>
Gerrit-Attention: Ben Pastene <bpas...@chromium.org>
Gerrit-Comment-Date: Wed, 02 Mar 2022 15:59:28 +0000

Ben Pastene (Gerrit)

unread,
Mar 3, 2022, 6:36:03 PM3/3/22
to danakj, rust...@chromium.org, John Chen, chromium...@chromium.org, Matthew Riley

Attention is currently required from: danakj.

View Change

1 comment:

  • Patchset:

    • Patch Set #2:

      I haven't any knowledge or prior context with rust, so pardon the clarifying questions, but as I've tried understanding it:

      • //testing/rust_gtest_interop/ contains the plumbing needed to register a rust test to the gtest launcher. (a README there might be nice?)
      • to add rust test files to a suite, we want folks to only have to add a simple line like `rs_sources = [...]` to the test target
      • so we need to get rust_gtest_interop slurped up into their test targets automatically somehow, and the base test template is a good place to do so

      Is that right? And this is all so that they don't have to add one extra line like `deps += [ "//testing/rust_gtest_interop" ]` to their test target?

To view, visit change 3497966. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ia18d2dc89661ada05b6d96d15b5f2906a733f621
Gerrit-Change-Number: 3497966
Gerrit-PatchSet: 2
Gerrit-Owner: danakj <dan...@chromium.org>
Gerrit-Reviewer: Ben Pastene <bpas...@chromium.org>
Gerrit-CC: John Chen <john...@chromium.org>
Gerrit-CC: Matthew Riley <mat...@chromium.org>
Gerrit-Attention: danakj <dan...@chromium.org>
Gerrit-Comment-Date: Thu, 03 Mar 2022 23:35:53 +0000

danakj (Gerrit)

unread,
Mar 4, 2022, 10:14:38 AM3/4/22
to rust...@chromium.org, Ben Pastene, John Chen, chromium...@chromium.org, Matthew Riley

Attention is currently required from: Ben Pastene.

View Change

1 comment:

  • Patchset:

    • Patch Set #2:

      I haven't any knowledge or prior context with rust, so pardon the clarifying questions, but as I've […]

      Yes. That's all correct except (nit) it would be `rs_deps += ["//testing/rust_gtest_interop"]`

      A README is a good idea. There's a long comment in gtest_attribute.rs I can steal from. I can add the README in this CL.

To view, visit change 3497966. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ia18d2dc89661ada05b6d96d15b5f2906a733f621
Gerrit-Change-Number: 3497966
Gerrit-PatchSet: 2
Gerrit-Owner: danakj <dan...@chromium.org>
Gerrit-Reviewer: Ben Pastene <bpas...@chromium.org>
Gerrit-CC: John Chen <john...@chromium.org>
Gerrit-CC: Matthew Riley <mat...@chromium.org>
Gerrit-Attention: Ben Pastene <bpas...@chromium.org>
Gerrit-Comment-Date: Fri, 04 Mar 2022 15:14:30 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Ben Pastene <bpas...@chromium.org>
Gerrit-MessageType: comment

Ben Pastene (Gerrit)

unread,
Mar 4, 2022, 4:17:53 PM3/4/22
to danakj, rust...@chromium.org, Chromium LUCI CQ, John Chen, chromium...@chromium.org, Matthew Riley

Attention is currently required from: danakj, John Chen.

Patch set 4:Code-Review +1

View Change

1 comment:

  • Patchset:

    • Patch Set #2:

      Yes. That's all correct except (nit) it would be `rs_deps += ["//testing/rust_gtest_interop"]` […]

      I think the introspection of the deps is a bit funky, but I've seen far funkier stuff in chromium's GN. And I can appreciate why yall would want to make rust integration as easy as possible, so lgtm. (And thx for the readme)

To view, visit change 3497966. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ia18d2dc89661ada05b6d96d15b5f2906a733f621
Gerrit-Change-Number: 3497966
Gerrit-PatchSet: 4
Gerrit-Owner: danakj <dan...@chromium.org>
Gerrit-Reviewer: Ben Pastene <bpas...@chromium.org>
Gerrit-Reviewer: John Chen <john...@chromium.org>
Gerrit-Reviewer: danakj <dan...@chromium.org>
Gerrit-CC: Matthew Riley <mat...@chromium.org>
Gerrit-Attention: danakj <dan...@chromium.org>
Gerrit-Attention: John Chen <john...@chromium.org>
Gerrit-Comment-Date: Fri, 04 Mar 2022 21:17:40 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: danakj <dan...@chromium.org>

danakj (Gerrit)

unread,
Mar 4, 2022, 4:26:13 PM3/4/22
to rust...@chromium.org, Ben Pastene, Chromium LUCI CQ, John Chen, chromium...@chromium.org, Matthew Riley

Attention is currently required from: John Chen.

Patch set 4:Commit-Queue +2

View Change

1 comment:

To view, visit change 3497966. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ia18d2dc89661ada05b6d96d15b5f2906a733f621
Gerrit-Change-Number: 3497966
Gerrit-PatchSet: 4
Gerrit-Owner: danakj <dan...@chromium.org>
Gerrit-Reviewer: Ben Pastene <bpas...@chromium.org>
Gerrit-Reviewer: John Chen <john...@chromium.org>
Gerrit-Reviewer: danakj <dan...@chromium.org>
Gerrit-CC: Matthew Riley <mat...@chromium.org>
Gerrit-Attention: John Chen <john...@chromium.org>
Gerrit-Comment-Date: Fri, 04 Mar 2022 21:25:59 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment

Chromium LUCI CQ (Gerrit)

unread,
Mar 4, 2022, 4:30:27 PM3/4/22
to danakj, rust...@chromium.org, Ben Pastene, John Chen, chromium...@chromium.org, Matthew Riley

Chromium LUCI CQ submitted this change.

View Change


Approvals: Ben Pastene: Looks good to me danakj: Commit
Add //testing/rust_gtest_interop when //testing/gtest is in deps

To make it simpler to add rust files to a unit test, act as if Rust
interop support is build into //testing/gtest. Then a person only needs
to add `rs_sources = [ "foo.rs" ]` to their test() target (as well as a
`rs_crate_root` for now), and their rust files will automatically get
the Rust gtest macros and run as part of their gtest binary.

We add //testing/rust_gtest_interop to rs_deps only if:
1. The target already depends on //testing/gtest, since otherwise it
would not work.
2. The target defines a non-empty rs_sources; that is, they have Rust
unit tests in the test() target.

R=john...@chromium.org

Bug: 1293979
Change-Id: Ia18d2dc89661ada05b6d96d15b5f2906a733f621
Cq-Include-Trybots: luci.chromium.try:android-rust-arm-rel,linux-rust-x64-rel
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3497966
Reviewed-by: Ben Pastene <bpas...@chromium.org>
Commit-Queue: danakj <dan...@chromium.org>
Cr-Commit-Position: refs/heads/main@{#977827}
---
M testing/rust_gtest_interop/BUILD.gn
A testing/rust_gtest_interop/README.md
M testing/test.gni
3 files changed, 216 insertions(+), 16 deletions(-)


To view, visit change 3497966. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ia18d2dc89661ada05b6d96d15b5f2906a733f621
Gerrit-Change-Number: 3497966
Gerrit-PatchSet: 5
Gerrit-Owner: danakj <dan...@chromium.org>
Gerrit-Reviewer: Ben Pastene <bpas...@chromium.org>
Gerrit-Reviewer: Chromium LUCI CQ <chromiu...@luci-project-accounts.iam.gserviceaccount.com>
Gerrit-Reviewer: John Chen <john...@chromium.org>
Gerrit-Reviewer: danakj <dan...@chromium.org>
Gerrit-CC: Matthew Riley <mat...@chromium.org>
Gerrit-MessageType: merged
Reply all
Reply to author
Forward
0 new messages