Make rust-docs component optional for local testing.

This commit is contained in:
Eric Huss 2020-05-26 10:59:49 -07:00
parent e0f9643b0f
commit f79fe537ba

View File

@ -1,7 +1,7 @@
//! Tests for the -Zrustdoc-map feature.
use cargo_test_support::registry::Package;
use cargo_test_support::{is_nightly, project, Project};
use cargo_test_support::{is_nightly, paths, project, Project};
fn basic_project() -> Project {
Package::new("bar", "1.0.0")
@ -78,6 +78,18 @@ fn std_docs() {
// --extern-html-root-url is unstable
return;
}
if !cargo::util::is_ci() {
// For local developers, skip this test if docs aren't installed.
let docs = std::path::Path::new(&paths::sysroot()).join("share/doc/rust/html");
if !docs.exists() {
eprintln!(
"documentation not found at {}, \
skipping test (run `rustdoc component add rust-docs` to install",
docs.display()
);
return;
}
}
let p = basic_project();
p.change_file(
".cargo/config",