diff options
| author | Jacob Pratt <jacob@jhpratt.dev> | 2024-03-11 03:47:21 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-11 03:47:21 -0400 |
| commit | 9b30f01c0c63a28c81b84409dc07d5f6af50d482 (patch) | |
| tree | 3a6ae7563935e204454e00dd4bec1390eec8aae8 /src/tools/compiletest | |
| parent | b3ac6fab3d98bc5d638da2c284f9bf623b87862f (diff) | |
| parent | 9bdb8a6888939c61c2907a5d37562833cf8d1ff3 (diff) | |
| download | rust-9b30f01c0c63a28c81b84409dc07d5f6af50d482.tar.gz rust-9b30f01c0c63a28c81b84409dc07d5f6af50d482.zip | |
Rollup merge of #122108 - alexcrichton:target-config-runtool, r=WaffleLapkin
Add `target.*.runner` configuration for targets This commit adds a `runner` field configuration to `config.toml` for specifying a wrapper executable when executing binaries for a target. This is pulled out of #122036 where a WebAssembly runtime is used, for example, to execute tests for `wasm32-wasip1`. The name "runner" here is chosen to match Cargo's `CARGO_*_RUNNER` configuration, and to make things a bit more consistent this additionally renames compiletest's `--runtool` argument to `--runner`.
Diffstat (limited to 'src/tools/compiletest')
| -rw-r--r-- | src/tools/compiletest/src/common.rs | 6 | ||||
| -rw-r--r-- | src/tools/compiletest/src/lib.rs | 6 | ||||
| -rw-r--r-- | src/tools/compiletest/src/runtest.rs | 4 |
3 files changed, 9 insertions, 7 deletions
diff --git a/src/tools/compiletest/src/common.rs b/src/tools/compiletest/src/common.rs index 06d8f099c33..78246136f2a 100644 --- a/src/tools/compiletest/src/common.rs +++ b/src/tools/compiletest/src/common.rs @@ -266,8 +266,10 @@ pub struct Config { pub logfile: Option<PathBuf>, /// A command line to prefix program execution with, - /// for running under valgrind - pub runtool: Option<String>, + /// for running under valgrind for example. + /// + /// Similar to `CARGO_*_RUNNER` configuration. + pub runner: Option<String>, /// Flags to pass to the compiler when building for the host pub host_rustcflags: Vec<String>, diff --git a/src/tools/compiletest/src/lib.rs b/src/tools/compiletest/src/lib.rs index b32a5a4bf1a..ef02e7fcb4a 100644 --- a/src/tools/compiletest/src/lib.rs +++ b/src/tools/compiletest/src/lib.rs @@ -86,7 +86,7 @@ pub fn parse_config(args: Vec<String>) -> Config { .optflag("", "exact", "filters match exactly") .optopt( "", - "runtool", + "runner", "supervisor program to run tests under \ (eg. emulator, valgrind)", "PROGRAM", @@ -256,7 +256,7 @@ pub fn parse_config(args: Vec<String>) -> Config { _ => panic!("unknown `--run` option `{}` given", mode), }), logfile: matches.opt_str("logfile").map(|s| PathBuf::from(&s)), - runtool: matches.opt_str("runtool"), + runner: matches.opt_str("runner"), host_rustcflags: matches.opt_strs("host-rustcflags"), target_rustcflags: matches.opt_strs("target-rustcflags"), optimize_tests: matches.opt_present("optimize-tests"), @@ -341,7 +341,7 @@ pub fn log_config(config: &Config) { c, format!("force_pass_mode: {}", opt_str(&config.force_pass_mode.map(|m| format!("{}", m))),), ); - logv(c, format!("runtool: {}", opt_str(&config.runtool))); + logv(c, format!("runner: {}", opt_str(&config.runner))); logv(c, format!("host-rustcflags: {:?}", config.host_rustcflags)); logv(c, format!("target-rustcflags: {:?}", config.target_rustcflags)); logv(c, format!("target: {}", config.target)); diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index ae0db88d873..9fd83c507ed 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -461,7 +461,7 @@ impl<'test> TestCx<'test> { } let mut new_config = self.config.clone(); - new_config.runtool = new_config.valgrind_path.clone(); + new_config.runner = new_config.valgrind_path.clone(); let new_cx = TestCx { config: &new_config, ..*self }; proc_res = new_cx.exec_compiled_test(); @@ -2647,7 +2647,7 @@ impl<'test> TestCx<'test> { fn make_run_args(&self) -> ProcArgs { // If we've got another tool to run under (valgrind), // then split apart its command - let mut args = self.split_maybe_args(&self.config.runtool); + let mut args = self.split_maybe_args(&self.config.runner); // If this is emscripten, then run tests under nodejs if self.config.target.contains("emscripten") { |
