From 82feb9c19943b36b3faf1c63c83b0fb7ca75dda1 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Fri, 4 Jun 2021 14:12:25 +0200 Subject: [PATCH] Ensure html-checker is run on CI --- src/bootstrap/test.rs | 20 +++++++++++-------- .../host-x86_64/x86_64-gnu-tools/Dockerfile | 3 ++- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index 26b40f819d4e6..d26fa697d4ebc 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -144,6 +144,14 @@ You can skip linkcheck with --exclude src/tools/linkchecker" } } +fn check_if_tidy_is_installed() -> bool { + Command::new("tidy") + .arg("--version") + .stdout(Stdio::null()) + .status() + .map_or(false, |status| status.success()) +} + #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub struct HtmlCheck { target: TargetSelection, @@ -155,7 +163,8 @@ impl Step for HtmlCheck { const ONLY_HOSTS: bool = true; fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { - run.path("src/tools/html-checker") + let run = run.path("src/tools/html-checker"); + run.default_condition(check_if_tidy_is_installed()) } fn make_run(run: RunConfig<'_>) { @@ -163,17 +172,12 @@ impl Step for HtmlCheck { } fn run(self, builder: &Builder<'_>) { - if !Command::new("tidy") - .arg("--version") - .stdout(Stdio::null()) - .status() - .map_or(false, |status| status.success()) - { + if !check_if_tidy_is_installed() { eprintln!("not running HTML-check tool because `tidy` is missing"); eprintln!( "Note that `tidy` is not the in-tree `src/tools/tidy` but needs to be installed" ); - return; + panic!("Cannot run html-check tests"); } // Ensure that a few different kinds of documentation are available. builder.default_doc(&[]); diff --git a/src/ci/docker/host-x86_64/x86_64-gnu-tools/Dockerfile b/src/ci/docker/host-x86_64/x86_64-gnu-tools/Dockerfile index 605d988dad712..6311f69164aa2 100644 --- a/src/ci/docker/host-x86_64/x86_64-gnu-tools/Dockerfile +++ b/src/ci/docker/host-x86_64/x86_64-gnu-tools/Dockerfile @@ -12,7 +12,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ cmake \ libssl-dev \ sudo \ - xz-utils + xz-utils \ + tidy # Install dependencies for chromium browser RUN apt-get install -y \