about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJoshua Nelson <jyn514@gmail.com>2021-05-01 01:11:44 -0400
committerJoshua Nelson <jyn514@gmail.com>2021-05-01 01:13:53 -0400
commitd95a6cf91189421cc3174d10aaa910c7376529b8 (patch)
treea00be62ba849b74286190cb3aba7ed220c0224b8
parentb52769b804a12b7045ee1bce893a64045cdb974a (diff)
downloadrust-d95a6cf91189421cc3174d10aaa910c7376529b8.tar.gz
rust-d95a6cf91189421cc3174d10aaa910c7376529b8.zip
Add support for --test-args to cargotest
This allows running a single test without having to wait for all tests
to complete.
-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 965d1162145..814a591b137 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);
+        }
     }
 }