diff options
| author | Eric Huss <eric@huss.org> | 2025-02-15 10:50:47 -0800 |
|---|---|---|
| committer | Eric Huss <eric@huss.org> | 2025-03-27 19:04:56 -0700 |
| commit | ec25e3300b930b9d2873fe589ed3cbfa55db3ffe (patch) | |
| tree | 6808397bba745f149ba3d76efd6d8098ec6f3227 | |
| parent | 0340a865b9e7a3aa17a69555f0cc22ba3ad92c73 (diff) | |
| download | rust-ec25e3300b930b9d2873fe589ed3cbfa55db3ffe.tar.gz rust-ec25e3300b930b9d2873fe589ed3cbfa55db3ffe.zip | |
Rename `--runtool` and `--runtool-arg`
This renames `--runtool` and `--runtool-arg` to `--test-runtool` and `--test-runtool-arg` to maintain consistency with other `--test-*` arguments.
| -rw-r--r-- | src/doc/rustdoc/src/unstable-features.md | 6 | ||||
| -rw-r--r-- | src/librustdoc/config.rs | 16 | ||||
| -rw-r--r-- | src/librustdoc/doctest.rs | 4 | ||||
| -rw-r--r-- | src/librustdoc/lib.rs | 4 | ||||
| -rw-r--r-- | src/tools/miri/cargo-miri/src/main.rs | 2 | ||||
| -rw-r--r-- | src/tools/miri/cargo-miri/src/phases.rs | 10 | ||||
| -rw-r--r-- | tests/run-make/doctests-runtool/rmake.rs | 6 | ||||
| -rw-r--r-- | tests/run-make/rustdoc-default-output/output-default.stdout | 4 | ||||
| -rw-r--r-- | tests/rustdoc/doctest/doctest-runtool.rs | 6 |
9 files changed, 29 insertions, 29 deletions
diff --git a/src/doc/rustdoc/src/unstable-features.md b/src/doc/rustdoc/src/unstable-features.md index d4ff69a9933..144f1c61b34 100644 --- a/src/doc/rustdoc/src/unstable-features.md +++ b/src/doc/rustdoc/src/unstable-features.md @@ -666,21 +666,21 @@ struct Foo; In older versions, this will be ignored on all targets, but on newer versions `ignore-gnu` will override `ignore`. -## `--runtool`, `--runtool-arg`: program to run tests with; args to pass to it +## `--test-runtool`, `--test-runtool-arg`: program to run tests with; args to pass to it * Tracking issue: [#64245](https://github.com/rust-lang/rust/issues/64245) Using these options looks like this: ```bash -$ rustdoc src/lib.rs -Z unstable-options --runtool runner --runtool-arg --do-thing --runtool-arg --do-other-thing +$ rustdoc src/lib.rs -Z unstable-options --test-runtool runner --test-runtool-arg --do-thing --test-runtool-arg --do-other-thing ``` These options can be used to run the doctest under a program, and also pass arguments to that program. For example, if you want to run your doctests under valgrind you might run ```bash -$ rustdoc src/lib.rs -Z unstable-options --runtool valgrind +$ rustdoc src/lib.rs -Z unstable-options --test-runtool valgrind ``` Another use case would be to run a test inside an emulator, or through a Virtual Machine. diff --git a/src/librustdoc/config.rs b/src/librustdoc/config.rs index 23a2bcd9011..0eb620c01d9 100644 --- a/src/librustdoc/config.rs +++ b/src/librustdoc/config.rs @@ -124,9 +124,9 @@ pub(crate) struct Options { /// temporary directory if not set. pub(crate) persist_doctests: Option<PathBuf>, /// Runtool to run doctests with - pub(crate) runtool: Option<String>, + pub(crate) test_runtool: Option<String>, /// Arguments to pass to the runtool - pub(crate) runtool_args: Vec<String>, + pub(crate) test_runtool_args: Vec<String>, /// Whether to allow ignoring doctests on a per-target basis /// For example, using ignore-foo to ignore running the doctest on any target that /// contains "foo" as a substring @@ -215,8 +215,8 @@ impl fmt::Debug for Options { .field("persist_doctests", &self.persist_doctests) .field("show_coverage", &self.show_coverage) .field("crate_version", &self.crate_version) - .field("runtool", &self.runtool) - .field("runtool_args", &self.runtool_args) + .field("test_runtool", &self.test_runtool) + .field("test_runtool_args", &self.test_runtool_args) .field("enable-per-target-ignores", &self.enable_per_target_ignores) .field("run_check", &self.run_check) .field("no_run", &self.no_run) @@ -779,8 +779,8 @@ impl Options { let unstable_opts_strs = matches.opt_strs("Z"); let lib_strs = matches.opt_strs("L"); let extern_strs = matches.opt_strs("extern"); - let runtool = matches.opt_str("runtool"); - let runtool_args = matches.opt_strs("runtool-arg"); + let test_runtool = matches.opt_str("test-runtool"); + let test_runtool_args = matches.opt_strs("test-runtool-arg"); let enable_per_target_ignores = matches.opt_present("enable-per-target-ignores"); let document_private = matches.opt_present("document-private-items"); let document_hidden = matches.opt_present("document-hidden-items"); @@ -843,8 +843,8 @@ impl Options { crate_version, test_run_directory, persist_doctests, - runtool, - runtool_args, + test_runtool, + test_runtool_args, enable_per_target_ignores, test_builder, run_check, diff --git a/src/librustdoc/doctest.rs b/src/librustdoc/doctest.rs index a2808bddb3a..ae4863dd82b 100644 --- a/src/librustdoc/doctest.rs +++ b/src/librustdoc/doctest.rs @@ -781,10 +781,10 @@ fn run_test( let mut cmd; let output_file = make_maybe_absolute_path(output_file); - if let Some(tool) = &rustdoc_options.runtool { + if let Some(tool) = &rustdoc_options.test_runtool { let tool = make_maybe_absolute_path(tool.into()); cmd = Command::new(tool); - cmd.args(&rustdoc_options.runtool_args); + cmd.args(&rustdoc_options.test_runtool_args); cmd.arg(&output_file); } else { cmd = Command::new(&output_file); diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index 4fe5e13c3af..daa8e72edb8 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -518,7 +518,7 @@ fn opts() -> Vec<RustcOptGroup> { Unstable, Opt, "", - "runtool", + "test-runtool", "", "The tool to run tests with when building for a different target than host", ), @@ -526,7 +526,7 @@ fn opts() -> Vec<RustcOptGroup> { Unstable, Multi, "", - "runtool-arg", + "test-runtool-arg", "", "One (of possibly many) arguments to pass to the runtool", ), diff --git a/src/tools/miri/cargo-miri/src/main.rs b/src/tools/miri/cargo-miri/src/main.rs index 7d9f77f3752..322ef0a6c2a 100644 --- a/src/tools/miri/cargo-miri/src/main.rs +++ b/src/tools/miri/cargo-miri/src/main.rs @@ -53,7 +53,7 @@ fn main() { // with `RustcPhase::Rustdoc`. There we perform a check-build (needed to get the expected // build failures for `compile_fail` doctests) and then store a JSON file with the // information needed to run this test. - // - We also set `--runtool` to ourselves, which ends up in `phase_runner` with + // - We also set `--test-runtool` to ourselves, which ends up in `phase_runner` with // `RunnerPhase::Rustdoc`. There we parse the JSON file written in `phase_rustc` and invoke // the Miri driver for interpretation. diff --git a/src/tools/miri/cargo-miri/src/phases.rs b/src/tools/miri/cargo-miri/src/phases.rs index d7b4421061c..477e82f21a2 100644 --- a/src/tools/miri/cargo-miri/src/phases.rs +++ b/src/tools/miri/cargo-miri/src/phases.rs @@ -666,8 +666,8 @@ pub fn phase_rustdoc(mut args: impl Iterator<Item = String>) { if arg == "--extern" { // Patch --extern arguments to use *.rmeta files, since phase_cargo_rustc only creates stub *.rlib files. forward_patched_extern_arg(&mut args, &mut cmd); - } else if arg == "--runtool" { - // An existing --runtool flag indicates cargo is running in cross-target mode, which we don't support. + } else if arg == "--test-runtool" { + // An existing --test-runtool flag indicates cargo is running in cross-target mode, which we don't support. // Note that this is only passed when cargo is run with the unstable -Zdoctest-xcompile flag; // otherwise, we won't be called as rustdoc at all. show_error!("cross-interpreting doctests is not currently supported by Miri."); @@ -693,8 +693,8 @@ pub fn phase_rustdoc(mut args: impl Iterator<Item = String>) { // to let phase_cargo_rustc know to expect that. We'll use this environment variable as a flag: cmd.env("MIRI_CALLED_FROM_RUSTDOC", "1"); - // The `--test-builder` and `--runtool` arguments are unstable rustdoc features, - // which are disabled by default. We first need to enable them explicitly: + // The `--test-builder` is an unstable rustdoc features, + // which is disabled by default. We first need to enable them explicitly: cmd.arg("-Zunstable-options"); // rustdoc needs to know the right sysroot. @@ -705,7 +705,7 @@ pub fn phase_rustdoc(mut args: impl Iterator<Item = String>) { // Make rustdoc call us back. let cargo_miri_path = env::current_exe().expect("current executable path invalid"); cmd.arg("--test-builder").arg(&cargo_miri_path); // invoked by forwarding most arguments - cmd.arg("--runtool").arg(&cargo_miri_path); // invoked with just a single path argument + cmd.arg("--test-runtool").arg(&cargo_miri_path); // invoked with just a single path argument debug_cmd("[cargo-miri rustdoc]", verbose, &cmd); exec(cmd) diff --git a/tests/run-make/doctests-runtool/rmake.rs b/tests/run-make/doctests-runtool/rmake.rs index c7be829c215..817001c514b 100644 --- a/tests/run-make/doctests-runtool/rmake.rs +++ b/tests/run-make/doctests-runtool/rmake.rs @@ -1,4 +1,4 @@ -// Tests behavior of rustdoc `--runtool`. +// Tests behavior of rustdoc `--test-runtool`. use std::path::PathBuf; @@ -11,7 +11,7 @@ fn mkdir(name: &str) -> PathBuf { dir } -// Behavior with --runtool with relative paths and --test-run-directory. +// Behavior with --test-runtool with relative paths and --test-run-directory. fn main() { let run_dir_name = "rundir"; let run_dir = mkdir(run_dir_name); @@ -27,7 +27,7 @@ fn main() { .arg("--test") .arg("--test-run-directory") .arg(run_dir_name) - .arg("--runtool") + .arg("--test-runtool") .arg(&run_tool_binary) .extern_("t", "libt.rlib") .run(); diff --git a/tests/run-make/rustdoc-default-output/output-default.stdout b/tests/run-make/rustdoc-default-output/output-default.stdout index 01f470f6e16..b0ca5f3bf08 100644 --- a/tests/run-make/rustdoc-default-output/output-default.stdout +++ b/tests/run-make/rustdoc-default-output/output-default.stdout @@ -141,9 +141,9 @@ Options: --enable-per-target-ignores parse ignore-foo for ignoring doctests on a per-target basis - --runtool The tool to run tests with when building for a different target than host + --test-runtool The tool to run tests with when building for a different target than host - --runtool-arg One (of possibly many) arguments to pass to the runtool + --test-runtool-arg One (of possibly many) arguments to pass to the runtool --test-builder PATH The rustc-like binary to use as the test builder diff --git a/tests/rustdoc/doctest/doctest-runtool.rs b/tests/rustdoc/doctest/doctest-runtool.rs index f54dc06fb20..75568fab83e 100644 --- a/tests/rustdoc/doctest/doctest-runtool.rs +++ b/tests/rustdoc/doctest/doctest-runtool.rs @@ -1,10 +1,10 @@ -// Tests that the --runtool argument works. +// Tests that the --test-runtool argument works. //@ ignore-cross-compile //@ aux-bin: doctest-runtool.rs //@ compile-flags: --test -//@ compile-flags: --runtool=auxiliary/bin/doctest-runtool -//@ compile-flags: --runtool-arg=arg1 --runtool-arg +//@ compile-flags: --test-runtool=auxiliary/bin/doctest-runtool +//@ compile-flags: --test-runtool-arg=arg1 --test-runtool-arg //@ compile-flags: 'arg2 with space' //@ compile-flags: -Zunstable-options |
