Skip to content

Commit 054ab7d

Browse files
committed
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.
1 parent 58aa7b5 commit 054ab7d

File tree

8 files changed

+27
-27
lines changed

8 files changed

+27
-27
lines changed

src/doc/rustdoc/src/unstable-features.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -647,21 +647,21 @@ struct Foo;
647647
In older versions, this will be ignored on all targets, but on newer versions `ignore-gnu` will
648648
override `ignore`.
649649

650-
## `--runtool`, `--runtool-arg`: program to run tests with; args to pass to it
650+
## `--test-runtool`, `--test-runtool-arg`: program to run tests with; args to pass to it
651651

652652
* Tracking issue: [#64245](https://github.com/rust-lang/rust/issues/64245)
653653

654654
Using these options looks like this:
655655

656656
```bash
657-
$ rustdoc src/lib.rs -Z unstable-options --runtool runner --runtool-arg --do-thing --runtool-arg --do-other-thing
657+
$ rustdoc src/lib.rs -Z unstable-options --test-runtool runner --test-runtool-arg --do-thing --test-runtool-arg --do-other-thing
658658
```
659659

660660
These options can be used to run the doctest under a program, and also pass arguments to
661661
that program. For example, if you want to run your doctests under valgrind you might run
662662

663663
```bash
664-
$ rustdoc src/lib.rs -Z unstable-options --runtool valgrind
664+
$ rustdoc src/lib.rs -Z unstable-options --test-runtool valgrind
665665
```
666666

667667
Another use case would be to run a test inside an emulator, or through a Virtual Machine.

src/librustdoc/config.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,9 @@ pub(crate) struct Options {
122122
/// temporary directory if not set.
123123
pub(crate) persist_doctests: Option<PathBuf>,
124124
/// Runtool to run doctests with
125-
pub(crate) runtool: Option<String>,
125+
pub(crate) test_runtool: Option<String>,
126126
/// Arguments to pass to the runtool
127-
pub(crate) runtool_args: Vec<String>,
127+
pub(crate) test_runtool_args: Vec<String>,
128128
/// Whether to allow ignoring doctests on a per-target basis
129129
/// For example, using ignore-foo to ignore running the doctest on any target that
130130
/// contains "foo" as a substring
@@ -212,8 +212,8 @@ impl fmt::Debug for Options {
212212
.field("persist_doctests", &self.persist_doctests)
213213
.field("show_coverage", &self.show_coverage)
214214
.field("crate_version", &self.crate_version)
215-
.field("runtool", &self.runtool)
216-
.field("runtool_args", &self.runtool_args)
215+
.field("test_runtool", &self.test_runtool)
216+
.field("test_runtool_args", &self.test_runtool_args)
217217
.field("enable-per-target-ignores", &self.enable_per_target_ignores)
218218
.field("run_check", &self.run_check)
219219
.field("no_run", &self.no_run)
@@ -765,8 +765,8 @@ impl Options {
765765
let unstable_opts_strs = matches.opt_strs("Z");
766766
let lib_strs = matches.opt_strs("L");
767767
let extern_strs = matches.opt_strs("extern");
768-
let runtool = matches.opt_str("runtool");
769-
let runtool_args = matches.opt_strs("runtool-arg");
768+
let test_runtool = matches.opt_str("test-runtool");
769+
let test_runtool_args = matches.opt_strs("test-runtool-arg");
770770
let enable_per_target_ignores = matches.opt_present("enable-per-target-ignores");
771771
let document_private = matches.opt_present("document-private-items");
772772
let document_hidden = matches.opt_present("document-hidden-items");
@@ -828,8 +828,8 @@ impl Options {
828828
crate_version,
829829
test_run_directory,
830830
persist_doctests,
831-
runtool,
832-
runtool_args,
831+
test_runtool,
832+
test_runtool_args,
833833
enable_per_target_ignores,
834834
test_builder,
835835
run_check,

src/librustdoc/doctest.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -701,10 +701,10 @@ fn run_test(
701701
let mut cmd;
702702

703703
let output_file = make_maybe_absolute_path(output_file);
704-
if let Some(tool) = &rustdoc_options.runtool {
704+
if let Some(tool) = &rustdoc_options.test_runtool {
705705
let tool = make_maybe_absolute_path(tool.into());
706706
cmd = Command::new(tool);
707-
cmd.args(&rustdoc_options.runtool_args);
707+
cmd.args(&rustdoc_options.test_runtool_args);
708708
cmd.arg(&output_file);
709709
} else {
710710
cmd = Command::new(&output_file);

src/librustdoc/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -519,15 +519,15 @@ fn opts() -> Vec<RustcOptGroup> {
519519
Unstable,
520520
Opt,
521521
"",
522-
"runtool",
522+
"test-runtool",
523523
"",
524524
"The tool to run tests with when building for a different target than host",
525525
),
526526
opt(
527527
Unstable,
528528
Multi,
529529
"",
530-
"runtool-arg",
530+
"test-runtool-arg",
531531
"",
532532
"One (of possibly many) arguments to pass to the runtool",
533533
),

src/tools/miri/cargo-miri/src/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ fn main() {
5353
// with `RustcPhase::Rustdoc`. There we perform a check-build (needed to get the expected
5454
// build failures for `compile_fail` doctests) and then store a JSON file with the
5555
// information needed to run this test.
56-
// - We also set `--runtool` to ourselves, which ends up in `phase_runner` with
56+
// - We also set `--test-runtool` to ourselves, which ends up in `phase_runner` with
5757
// `RunnerPhase::Rustdoc`. There we parse the JSON file written in `phase_rustc` and invoke
5858
// the Miri driver for interpretation.
5959

src/tools/miri/cargo-miri/src/phases.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -666,8 +666,8 @@ pub fn phase_rustdoc(mut args: impl Iterator<Item = String>) {
666666
if arg == "--extern" {
667667
// Patch --extern arguments to use *.rmeta files, since phase_cargo_rustc only creates stub *.rlib files.
668668
forward_patched_extern_arg(&mut args, &mut cmd);
669-
} else if arg == "--runtool" {
670-
// An existing --runtool flag indicates cargo is running in cross-target mode, which we don't support.
669+
} else if arg == "--test-runtool" {
670+
// An existing --test-runtool flag indicates cargo is running in cross-target mode, which we don't support.
671671
// Note that this is only passed when cargo is run with the unstable -Zdoctest-xcompile flag;
672672
// otherwise, we won't be called as rustdoc at all.
673673
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>) {
693693
// to let phase_cargo_rustc know to expect that. We'll use this environment variable as a flag:
694694
cmd.env("MIRI_CALLED_FROM_RUSTDOC", "1");
695695

696-
// The `--test-builder` and `--runtool` arguments are unstable rustdoc features,
697-
// which are disabled by default. We first need to enable them explicitly:
696+
// The `--test-builder` is an unstable rustdoc features,
697+
// which is disabled by default. We first need to enable them explicitly:
698698
cmd.arg("-Zunstable-options");
699699

700700
// rustdoc needs to know the right sysroot.
@@ -705,7 +705,7 @@ pub fn phase_rustdoc(mut args: impl Iterator<Item = String>) {
705705
// Make rustdoc call us back.
706706
let cargo_miri_path = env::current_exe().expect("current executable path invalid");
707707
cmd.arg("--test-builder").arg(&cargo_miri_path); // invoked by forwarding most arguments
708-
cmd.arg("--runtool").arg(&cargo_miri_path); // invoked with just a single path argument
708+
cmd.arg("--test-runtool").arg(&cargo_miri_path); // invoked with just a single path argument
709709

710710
debug_cmd("[cargo-miri rustdoc]", verbose, &cmd);
711711
exec(cmd)

tests/run-make/doctests-runtool/rmake.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Tests behavior of rustdoc `--runtool`.
1+
// Tests behavior of rustdoc `--test-runtool`.
22

33
use std::path::PathBuf;
44

@@ -11,7 +11,7 @@ fn mkdir(name: &str) -> PathBuf {
1111
dir
1212
}
1313

14-
// Behavior with --runtool with relative paths and --test-run-directory.
14+
// Behavior with --test-runtool with relative paths and --test-run-directory.
1515
fn main() {
1616
let run_dir_name = "rundir";
1717
let run_dir = mkdir(run_dir_name);
@@ -27,7 +27,7 @@ fn main() {
2727
.arg("--test")
2828
.arg("--test-run-directory")
2929
.arg(run_dir_name)
30-
.arg("--runtool")
30+
.arg("--test-runtool")
3131
.arg(&run_tool_binary)
3232
.extern_("t", "libt.rlib")
3333
.run();

tests/rustdoc/doctest/doctest-runtool.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
// Tests that the --runtool argument works.
1+
// Tests that the --test-runtool argument works.
22

33
//@ ignore-cross-compile
44
//@ aux-bin: doctest-runtool.rs
55
//@ compile-flags: --test
6-
//@ compile-flags: --runtool=auxiliary/bin/doctest-runtool
7-
//@ compile-flags: --runtool-arg=arg1 --runtool-arg
6+
//@ compile-flags: --test-runtool=auxiliary/bin/doctest-runtool
7+
//@ compile-flags: --test-runtool-arg=arg1 --test-runtool-arg
88
//@ compile-flags: 'arg2 with space'
99
//@ compile-flags: -Zunstable-options
1010

0 commit comments

Comments
 (0)