mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-21 22:34:05 +00:00
Simplify build system for rustdoc-gui test crates
This commit is contained in:
parent
8ccee61d38
commit
da6d82e465
3
.gitignore
vendored
3
.gitignore
vendored
@ -72,4 +72,7 @@ __pycache__/
|
|||||||
**node_modules
|
**node_modules
|
||||||
**package-lock.json
|
**package-lock.json
|
||||||
|
|
||||||
|
## Rustdoc GUI tests
|
||||||
|
src/test/rustdoc-gui/src/**.lock
|
||||||
|
|
||||||
# Before adding new lines, see the comment at the top.
|
# Before adding new lines, see the comment at the top.
|
||||||
|
@ -907,27 +907,25 @@ impl Step for RustdocGUI {
|
|||||||
// We remove existing folder to be sure there won't be artifacts remaining.
|
// We remove existing folder to be sure there won't be artifacts remaining.
|
||||||
let _ = fs::remove_dir_all(&out_dir);
|
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.
|
// 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");
|
let mut cargo = Command::new(&builder.initial_cargo);
|
||||||
for entry in libs_dir.read_dir().expect("read_dir call failed") {
|
cargo
|
||||||
let entry = entry.expect("invalid entry");
|
.arg("doc")
|
||||||
let path = entry.path();
|
.arg("--workspace")
|
||||||
if path.extension().map(|e| e == "rs").unwrap_or(false) {
|
.arg("--target-dir")
|
||||||
let mut command = builder.rustdoc_cmd(self.compiler);
|
.arg(&out_dir)
|
||||||
command.arg(path).arg("-o").arg(&out_dir);
|
.env("RUSTDOC", builder.rustdoc(self.compiler))
|
||||||
builder.run(&mut command);
|
.env("RUSTC", builder.rustc(self.compiler))
|
||||||
nb_generated += 1;
|
.current_dir(&builder.build.src.join(src_path));
|
||||||
}
|
builder.run(&mut cargo);
|
||||||
}
|
|
||||||
assert!(nb_generated > 0, "no documentation was generated...");
|
|
||||||
|
|
||||||
// We now run GUI tests.
|
// We now run GUI tests.
|
||||||
let mut command = Command::new(&nodejs);
|
let mut command = Command::new(&nodejs);
|
||||||
command
|
command
|
||||||
.arg(builder.build.src.join("src/tools/rustdoc-gui/tester.js"))
|
.arg(builder.build.src.join("src/tools/rustdoc-gui/tester.js"))
|
||||||
.arg("--doc-folder")
|
.arg("--doc-folder")
|
||||||
.arg(out_dir)
|
.arg(out_dir.join("doc"))
|
||||||
.arg("--tests-folder")
|
.arg("--tests-folder")
|
||||||
.arg(builder.build.src.join("src/test/rustdoc-gui"));
|
.arg(builder.build.src.join("src/test/rustdoc-gui"));
|
||||||
for path in &builder.paths {
|
for path in &builder.paths {
|
||||||
|
18
src/test/rustdoc-gui/src/Cargo.lock
Normal file
18
src/test/rustdoc-gui/src/Cargo.lock
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# 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"
|
6
src/test/rustdoc-gui/src/Cargo.toml
Normal file
6
src/test/rustdoc-gui/src/Cargo.toml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
[workspace]
|
||||||
|
members = [
|
||||||
|
"test_docs",
|
||||||
|
"lib2",
|
||||||
|
"implementors",
|
||||||
|
]
|
10
src/test/rustdoc-gui/src/lib2/Cargo.toml
Normal file
10
src/test/rustdoc-gui/src/lib2/Cargo.toml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
[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;
|
type X = u32;
|
||||||
const Y: u32 = 0;
|
const Y: u32 = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl implementors::Whatever for Foo {}
|
7
src/test/rustdoc-gui/src/lib2/src/lib.rs
Normal file
7
src/test/rustdoc-gui/src/lib2/src/lib.rs
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
#[test]
|
||||||
|
fn it_works() {
|
||||||
|
assert_eq!(2 + 2, 4);
|
||||||
|
}
|
||||||
|
}
|
7
src/test/rustdoc-gui/src/test_docs/Cargo.toml
Normal file
7
src/test/rustdoc-gui/src/test_docs/Cargo.toml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
[package]
|
||||||
|
name = "test_docs"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
|
[lib]
|
||||||
|
path = "lib.rs"
|
Loading…
Reference in New Issue
Block a user