From d95a6cf91189421cc3174d10aaa910c7376529b8 Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Sat, 1 May 2021 01:11:44 -0400 Subject: [PATCH] Add support for --test-args to cargotest This allows running a single test without having to wait for all tests to complete. --- src/bootstrap/test.rs | 1 + src/tools/cargotest/main.rs | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index 965d11621450b..814a591b13738 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -183,6 +183,7 @@ impl Step for Cargotest { builder, cmd.arg(&cargo) .arg(&out_dir) + .args(builder.config.cmd.test_args()) .env("RUSTC", builder.rustc(compiler)) .env("RUSTDOC", builder.rustdoc(compiler)), ); diff --git a/src/tools/cargotest/main.rs b/src/tools/cargotest/main.rs index fc608eaabccf7..54ff38e39dbe4 100644 --- a/src/tools/cargotest/main.rs +++ b/src/tools/cargotest/main.rs @@ -85,7 +85,9 @@ fn main() { let cargo = &Path::new(cargo); for test in TEST_REPOS.iter().rev() { - test_repo(cargo, out_dir, test); + if args[3..].is_empty() || args[3..].iter().any(|s| s.contains(test.name)) { + test_repo(cargo, out_dir, test); + } } }