Skip to content

Commit 2e0982d

Browse files
committed
Auto merge of #124711 - GuillaumeGomez:migrate-doctests-runtool, r=jieyouxu
Migrate `run-make/doctests-runtool` to rmake Part of #121876. The first commit is making the `edition` method common to `Rustc` and `Rustdoc` as I'll need it for the doctest in #123974. r? `@jieyouxu`
2 parents 3fbeedb + a64ba04 commit 2e0982d

File tree

4 files changed

+46
-21
lines changed

4 files changed

+46
-21
lines changed

src/tools/run-make-support/src/rustdoc.rs

+7
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,13 @@ impl Rustdoc {
9393
}
9494
}
9595

96+
/// Specify the edition year.
97+
pub fn edition(&mut self, edition: &str) -> &mut Self {
98+
self.cmd.arg("--edition");
99+
self.cmd.arg(edition);
100+
self
101+
}
102+
96103
#[track_caller]
97104
pub fn run_fail_assert_exit_code(&mut self, code: i32) -> Output {
98105
let caller_location = std::panic::Location::caller();

src/tools/tidy/src/allowed_run_make_makefiles.txt

-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ run-make/dep-graph/Makefile
4444
run-make/dep-info-doesnt-run-much/Makefile
4545
run-make/dep-info-spaces/Makefile
4646
run-make/dep-info/Makefile
47-
run-make/doctests-runtool/Makefile
4847
run-make/dump-ice-to-disk/Makefile
4948
run-make/dump-mono-stats/Makefile
5049
run-make/duplicate-output-flavors/Makefile

tests/run-make/doctests-runtool/Makefile

-20
This file was deleted.
+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// Tests behavior of rustdoc `--runtool`.
2+
3+
use run_make_support::{rustc, rustdoc, tmp_dir};
4+
use std::env::current_dir;
5+
use std::fs::{create_dir, remove_dir_all};
6+
use std::path::PathBuf;
7+
8+
fn mkdir(name: &str) -> PathBuf {
9+
let dir = tmp_dir().join(name);
10+
create_dir(&dir).expect("failed to create doctests folder");
11+
dir
12+
}
13+
14+
// Behavior with --runtool with relative paths and --test-run-directory.
15+
fn main() {
16+
let run_dir_name = "rundir";
17+
let run_dir = mkdir(run_dir_name);
18+
let run_tool = mkdir("runtool");
19+
let run_tool_binary = run_tool.join("runtool");
20+
21+
rustc().input("t.rs").crate_type("rlib").run();
22+
rustc().input("runtool.rs").arg("-o").arg(&run_tool_binary).run();
23+
24+
rustdoc()
25+
.input(current_dir().unwrap().join("t.rs"))
26+
.arg("-Zunstable-options")
27+
.arg("--test")
28+
.arg("--test-run-directory")
29+
.arg(run_dir_name)
30+
.arg("--runtool")
31+
.arg(&run_tool_binary)
32+
.arg("--extern")
33+
.arg("t=libt.rlib")
34+
.current_dir(tmp_dir())
35+
.run();
36+
37+
remove_dir_all(run_dir);
38+
remove_dir_all(run_tool);
39+
}

0 commit comments

Comments
 (0)