about summary refs log tree commit diff
diff options
context:
space:
mode:
authorYuki Okushi <jtitor@2k36.org>2021-05-07 15:20:21 +0900
committerGitHub <noreply@github.com>2021-05-07 15:20:21 +0900
commit2d496f46bf1960d72122cccc3ed5c774cea931c2 (patch)
tree6c9d0f65b1497b321bb410de468e7858ee15dd5b
parent1773f14a24c49356b384e45ebb45643bc9bef2c4 (diff)
parentd95a6cf91189421cc3174d10aaa910c7376529b8 (diff)
downloadrust-2d496f46bf1960d72122cccc3ed5c774cea931c2.tar.gz
rust-2d496f46bf1960d72122cccc3ed5c774cea931c2.zip
Rollup merge of #84779 - jyn514:cargotest-args, r=Mark-Simulacrum
Add support for --test-args to cargotest

This allows running a single test without having to wait for all tests
to complete.

Closes https://github.com/rust-lang/rust/issues/77260.
-rw-r--r--src/bootstrap/test.rs1
-rw-r--r--src/tools/cargotest/main.rs4
2 files changed, 4 insertions, 1 deletions
diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs
index fbce2f03da0..edb4bb9938b 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 fc608eaabcc..54ff38e39db 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);
+        }
     }
 }