-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #124753 - GuillaumeGomez:migrate-rustdoc-determinism, r…
…=jieyouxu Migrate `run-make/rustdoc-error-lines` to new `rmake.rs` Part of #121876. There was a weird naming inconsistency with `input`/`output`. A few tests write `.arg("-o").arg(path)` and the `output` method was actually the command output. So instead, I renamed the original `output` into `command_output` so that I could create the `output` method with the expected effect (and updated the tests to use it too). EDIT: The first two commits come from #124711. Some weird things happened recently pparently. ^^' r? `@jieyouxu`
- Loading branch information
Showing
15 changed files
with
108 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Tests behavior of rustdoc `--runtool`. | ||
|
||
use run_make_support::{rustc, rustdoc, tmp_dir}; | ||
use std::env::current_dir; | ||
use std::fs::{create_dir, remove_dir_all}; | ||
use std::path::PathBuf; | ||
|
||
fn mkdir(name: &str) -> PathBuf { | ||
let dir = tmp_dir().join(name); | ||
create_dir(&dir).expect("failed to create doctests folder"); | ||
dir | ||
} | ||
|
||
// Behavior with --runtool with relative paths and --test-run-directory. | ||
fn main() { | ||
let run_dir_name = "rundir"; | ||
let run_dir = mkdir(run_dir_name); | ||
let run_tool = mkdir("runtool"); | ||
let run_tool_binary = run_tool.join("runtool"); | ||
|
||
rustc().input("t.rs").crate_type("rlib").run(); | ||
rustc().input("runtool.rs").output(&run_tool_binary).run(); | ||
|
||
rustdoc() | ||
.input(current_dir().unwrap().join("t.rs")) | ||
.arg("-Zunstable-options") | ||
.arg("--test") | ||
.arg("--test-run-directory") | ||
.arg(run_dir_name) | ||
.arg("--runtool") | ||
.arg(&run_tool_binary) | ||
.arg("--extern") | ||
.arg("t=libt.rlib") | ||
.current_dir(tmp_dir()) | ||
.run(); | ||
|
||
remove_dir_all(run_dir); | ||
remove_dir_all(run_tool); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,19 @@ | ||
use run_make_support::{diff, rustc, rustdoc, tmp_dir}; | ||
// Assert that the search index is generated deterministically, regardless of the | ||
// order that crates are documented in. | ||
|
||
use run_make_support::{diff, rustdoc, tmp_dir}; | ||
|
||
/// Assert that the search index is generated deterministically, regardless of the | ||
/// order that crates are documented in. | ||
fn main() { | ||
let dir_first = tmp_dir().join("first"); | ||
rustdoc().out_dir(&dir_first).input("foo.rs").run(); | ||
rustdoc().out_dir(&dir_first).input("bar.rs").run(); | ||
let foo_first = tmp_dir().join("foo_first"); | ||
rustdoc().input("foo.rs").output(&foo_first).run(); | ||
rustdoc().input("bar.rs").output(&foo_first).run(); | ||
|
||
let dir_second = tmp_dir().join("second"); | ||
rustdoc().out_dir(&dir_second).input("bar.rs").run(); | ||
rustdoc().out_dir(&dir_second).input("foo.rs").run(); | ||
let bar_first = tmp_dir().join("bar_first"); | ||
rustdoc().input("bar.rs").output(&bar_first).run(); | ||
rustdoc().input("foo.rs").output(&bar_first).run(); | ||
|
||
diff() | ||
.expected_file(dir_first.join("search-index.js")) | ||
.actual_file(dir_second.join("search-index.js")) | ||
.expected_file(foo_first.join("search-index.js")) | ||
.actual_file(bar_first.join("search-index.js")) | ||
.run(); | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Assert that the search index is generated deterministically, regardless of the | ||
// order that crates are documented in. | ||
|
||
use run_make_support::rustdoc; | ||
|
||
fn main() { | ||
let output = | ||
String::from_utf8(rustdoc().input("input.rs").arg("--test").command_output().stdout) | ||
.unwrap(); | ||
|
||
let should_contain = &[ | ||
"input.rs - foo (line 5)", | ||
"input.rs:7:15", | ||
"input.rs - bar (line 15)", | ||
"input.rs:17:15", | ||
"input.rs - bar (line 24)", | ||
"input.rs:26:15", | ||
]; | ||
for text in should_contain { | ||
assert!(output.contains(text), "output doesn't contains {:?}", text); | ||
} | ||
} |