about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTyler Mandry <tmandry@gmail.com>2021-04-28 23:50:16 +0000
committerTyler Mandry <tmandry@gmail.com>2021-04-30 04:10:14 +0000
commit09783815b29fe6a8d0299bf883dba733f8a6fd1d (patch)
treed1e038f756f8f0f8906df3039c7073426226b45d
parent051f9ec694ec8c173b551d674cd17b8b989a9ee8 (diff)
downloadrust-09783815b29fe6a8d0299bf883dba733f8a6fd1d.tar.gz
rust-09783815b29fe6a8d0299bf883dba733f8a6fd1d.zip
Add run flag to bootstrap test
-rw-r--r--src/bootstrap/builder/tests.rs3
-rw-r--r--src/bootstrap/flags.rs15
-rw-r--r--src/bootstrap/test.rs5
3 files changed, 23 insertions, 0 deletions
diff --git a/src/bootstrap/builder/tests.rs b/src/bootstrap/builder/tests.rs
index a881512e988..4d7c207e3ab 100644
--- a/src/bootstrap/builder/tests.rs
+++ b/src/bootstrap/builder/tests.rs
@@ -489,6 +489,7 @@ mod dist {
             compare_mode: None,
             rustfix_coverage: false,
             pass: None,
+            run: None,
         };
 
         let build = Build::new(config);
@@ -529,6 +530,7 @@ mod dist {
             compare_mode: None,
             rustfix_coverage: false,
             pass: None,
+            run: None,
         };
 
         let build = Build::new(config);
@@ -584,6 +586,7 @@ mod dist {
             compare_mode: None,
             rustfix_coverage: false,
             pass: None,
+            run: None,
         };
         // Make sure rustfmt binary not being found isn't an error.
         config.channel = "beta".to_string();
diff --git a/src/bootstrap/flags.rs b/src/bootstrap/flags.rs
index 6044899c237..13d11cded30 100644
--- a/src/bootstrap/flags.rs
+++ b/src/bootstrap/flags.rs
@@ -103,6 +103,7 @@ pub enum Subcommand {
         bless: bool,
         compare_mode: Option<String>,
         pass: Option<String>,
+        run: Option<String>,
         test_args: Vec<String>,
         rustc_args: Vec<String>,
         fail_fast: bool,
@@ -293,6 +294,12 @@ To learn more about a subcommand, run `./x.py <subcommand> -h`",
                     "force {check,build,run}-pass tests to this mode.",
                     "check | build | run",
                 );
+                opts.optopt(
+                    "",
+                    "run",
+                    "whether to execute run-* tests",
+                    "auto | always | never",
+                );
                 opts.optflag(
                     "",
                     "rustfix-coverage",
@@ -556,6 +563,7 @@ Arguments:
                 bless: matches.opt_present("bless"),
                 compare_mode: matches.opt_str("compare-mode"),
                 pass: matches.opt_str("pass"),
+                run: matches.opt_str("run"),
                 test_args: matches.opt_strs("test-args"),
                 rustc_args: matches.opt_strs("rustc-args"),
                 fail_fast: !matches.opt_present("no-fail-fast"),
@@ -742,6 +750,13 @@ impl Subcommand {
         }
     }
 
+    pub fn run(&self) -> Option<&str> {
+        match *self {
+            Subcommand::Test { ref run, .. } => run.as_ref().map(|s| &s[..]),
+            _ => None,
+        }
+    }
+
     pub fn open(&self) -> bool {
         match *self {
             Subcommand::Doc { open, .. } => open,
diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs
index b9d7ecf8c0e..1eccfe102be 100644
--- a/src/bootstrap/test.rs
+++ b/src/bootstrap/test.rs
@@ -1207,6 +1207,11 @@ note: if you're sure you want to do this, please open an issue as to why. In the
             cmd.arg(pass);
         }
 
+        if let Some(ref run) = builder.config.cmd.run() {
+            cmd.arg("--run");
+            cmd.arg(run);
+        }
+
         if let Some(ref nodejs) = builder.config.nodejs {
             cmd.arg("--nodejs").arg(nodejs);
         }