[rust] generate `out/.../bin/run_foo` script from rust_unit_test("foo").
This CL tweaks GN templates so that `rust_unit_test(foo)` will not only
generate a `out/dir/foo` executable with unit tests from "foo" crate,
but also generate a `out/dir/bin/run_foo` Bash script that can be used
to run the tests in a //docs/testing/test_executable_api.md-compatible
way.
Exactly 1 generated run_foo script is generated per 1
rust_unit_test("foo") build target. In the future, additional gni magic
may be provided for generating a script that covers multiple crates
(e.g. multiple Rust unit test executables). To ensure that the test
names are stable going forward, this CL preemptively tweaks
//testing/scripts/rust to encode the name of a test executable in test
names.
Manual testing:
1. $ ninja -C out/rust build/rust/tests/test_rust_unittests
$ out/rust/bin/run_test_rust_unittests
2. Checking that a follow-up CL can successfully execute Rust unit tests
on a bot: https://crrev.com/c/3322199/3
Bug: 1260120
Change-Id: I2c963c12c343ff90a7d5132ee8b7136d24a79685
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3268794
Reviewed-by: Adrian Taylor <adetaylor@chromium.org>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Commit-Queue: Ćukasz Anforowicz <lukasza@chromium.org>
Cr-Commit-Position: refs/heads/main@{#950547}
NOKEYCHECK=True
GitOrigin-RevId: b81e936243c7fac546e4d1cac20f286982c10823
9 files changed