From f79fe537ba913466b112218659f70174850f3a60 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Tue, 26 May 2020 10:59:49 -0700 Subject: [PATCH] Make rust-docs component optional for local testing. --- tests/testsuite/rustdoc_extern_html.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tests/testsuite/rustdoc_extern_html.rs b/tests/testsuite/rustdoc_extern_html.rs index 33ff7f172..0051c457f 100644 --- a/tests/testsuite/rustdoc_extern_html.rs +++ b/tests/testsuite/rustdoc_extern_html.rs @@ -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",