提交 da6d82e4 编写于 作者: G Guillaume Gomez

Simplify build system for rustdoc-gui test crates

上级 8ccee61d
......@@ -72,4 +72,7 @@ __pycache__/
**node_modules
**package-lock.json
## Rustdoc GUI tests
src/test/rustdoc-gui/src/**.lock
# Before adding new lines, see the comment at the top.
......@@ -907,27 +907,25 @@ fn run(self, builder: &Builder<'_>) {
// We remove existing folder to be sure there won't be artifacts remaining.
let _ = fs::remove_dir_all(&out_dir);
let mut nb_generated = 0;
let src_path = "src/test/rustdoc-gui/src";
// We generate docs for the libraries present in the rustdoc-gui's src folder.
let libs_dir = builder.build.src.join("src/test/rustdoc-gui/src");
for entry in libs_dir.read_dir().expect("read_dir call failed") {
let entry = entry.expect("invalid entry");
let path = entry.path();
if path.extension().map(|e| e == "rs").unwrap_or(false) {
let mut command = builder.rustdoc_cmd(self.compiler);
command.arg(path).arg("-o").arg(&out_dir);
builder.run(&mut command);
nb_generated += 1;
}
}
assert!(nb_generated > 0, "no documentation was generated...");
let mut cargo = Command::new(&builder.initial_cargo);
cargo
.arg("doc")
.arg("--workspace")
.arg("--target-dir")
.arg(&out_dir)
.env("RUSTDOC", builder.rustdoc(self.compiler))
.env("RUSTC", builder.rustc(self.compiler))
.current_dir(&builder.build.src.join(src_path));
builder.run(&mut cargo);
// We now run GUI tests.
let mut command = Command::new(&nodejs);
command
.arg(builder.build.src.join("src/tools/rustdoc-gui/tester.js"))
.arg("--doc-folder")
.arg(out_dir)
.arg(out_dir.join("doc"))
.arg("--tests-folder")
.arg(builder.build.src.join("src/test/rustdoc-gui"));
for path in &builder.paths {
......
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "implementors"
version = "0.1.0"
[[package]]
name = "lib2"
version = "0.1.0"
dependencies = [
"implementors",
]
[[package]]
name = "test_docs"
version = "0.1.0"
[workspace]
members = [
"test_docs",
"lib2",
"implementors",
]
[package]
name = "lib2"
version = "0.1.0"
edition = "2018"
[lib]
path = "lib.rs"
[dependencies]
implementors = { path = "../implementors" }
......@@ -31,3 +31,5 @@ impl Trait for Foo {
type X = u32;
const Y: u32 = 0;
}
impl implementors::Whatever for Foo {}
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
assert_eq!(2 + 2, 4);
}
}
[package]
name = "test_docs"
version = "0.1.0"
edition = "2018"
[lib]
path = "lib.rs"
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册