From 677b665327481f9bf82262fd84c81da71d247be8 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sun, 29 Mar 2020 15:14:24 +0200 Subject: [PATCH 01/19] Add rustdoc GUI tests --- src/bootstrap/builder.rs | 1 + src/bootstrap/test.rs | 66 +++++++++++++++++++ src/bootstrap/util.rs | 33 ++++++++++ .../host-x86_64/x86_64-gnu-aux/Dockerfile | 34 +++++++++- 4 files changed, 133 insertions(+), 1 deletion(-) diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index 6446fa7550d53..e8d12befaec65 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -429,6 +429,7 @@ impl<'a> Builder<'a> { test::RustdocJSNotStd, test::RustdocTheme, test::RustdocUi, + test::RustdocGUI, // Run bootstrap close to the end as it's unlikely to fail test::Bootstrap, // Run run-make last, since these won't pass without make on Windows diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index afa72b5d58c14..f23fe6c3246f6 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -716,6 +716,72 @@ impl Step for RustdocUi { } } +#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] +pub struct RustdocGUI { + pub host: Interned, + pub target: Interned, + pub compiler: Compiler, +} + +impl Step for RustdocGUI { + type Output = (); + const ONLY_HOSTS: bool = true; + + fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { + run.path("src/test/rustdoc-gui") + } + + fn make_run(run: RunConfig<'_>) { + let compiler = run.builder.compiler(run.builder.top_stage, run.host); + run.builder.ensure(RustdocGUI { host: run.host, target: run.target, compiler }); + } + + fn run(self, builder: &Builder<'_>) { + if let Some(ref nodejs) = builder.config.nodejs { + // First step: cloning repositories. + util::clone_repository( + "https://github.com/GuillaumeGomez/browser-UI-test", + &builder.out.join("browser-UI-test"), + Some("1de38b0962f9abbddc677aaa3a94b864c0f40668"), + ); + util::clone_repository( + "https://github.com/GuillaumeGomez/test-rust-docs-ui", + &builder.out.join("test-rust-docs-ui"), + Some("03ea8284c2ab62607b6260793f08ea34953b14be"), + ); + // Second step: install npm dependencies. + let mut cmd = Command::new("npm"); + cmd.arg("install").current_dir(builder.out.join("browser-UI-test").to_str().unwrap()); + try_run(builder, &mut cmd); + + // Third step: building documentation with lastest rustdoc version. + let mut cmd = builder.rustdoc_cmd(self.compiler); + if let Some(linker) = builder.linker(self.compiler.host, true) { + cmd.env("RUSTC_TARGET_LINKER", linker); + } + try_run(builder, &mut cmd); + // Last step: running tests. + let mut command = Command::new(nodejs); + command + .arg("../browser-UI-test/src/index.js") + .arg("--no-sandbox") + .arg("--test-folder") + .arg("ui-tests") + .arg("--failure-folder") + .arg("failures") + .arg("--variable") + .arg("DOC_PATH") + .arg("test-docs/doc/test_docs") + .arg("--show-text") + .arg("--generate-images") + .current_dir(builder.out.join("test-rust-docs-ui")); + builder.run(&mut command); + } else { + builder.info("No nodejs found, skipping \"src/test/rustdoc-js-std\" tests"); + } + } +} + #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub struct Tidy; diff --git a/src/bootstrap/util.rs b/src/bootstrap/util.rs index a307ef39d03a8..86f922d016681 100644 --- a/src/bootstrap/util.rs +++ b/src/bootstrap/util.rs @@ -302,3 +302,36 @@ pub fn use_host_linker(target: TargetSelection) -> bool { || target.contains("fortanix") || target.contains("fuchsia")) } + +pub fn clone_repository( + repository_url: &str, + target_dir: &Path, + specific_commit_hash: Option<&str>, +) { + if target_dir.is_dir() { + fs::remove_dir_all(target_dir).expect("failed to remove target folder"); + } + let status = + Command::new("git").arg("clone").arg(repository_url).arg(target_dir.as_os_str()).status(); + let success = match status { + Ok(s) => s.success(), + Err(_) => false, + }; + if !success { + panic!("git clone unsuccessful (status: {:?})", status); + } + if let Some(specific_commit_hash) = specific_commit_hash { + let status = Command::new("git") + .arg("checkout") + .arg(specific_commit_hash) + .current_dir(target_dir.to_str().unwrap()) + .status(); + let success = match status { + Ok(s) => s.success(), + Err(_) => false, + }; + if !success { + panic!("git checkout unsuccessful (status: {:?})", status); + } + } +} diff --git a/src/ci/docker/host-x86_64/x86_64-gnu-aux/Dockerfile b/src/ci/docker/host-x86_64/x86_64-gnu-aux/Dockerfile index 86ac0256d2820..692f60392c044 100644 --- a/src/ci/docker/host-x86_64/x86_64-gnu-aux/Dockerfile +++ b/src/ci/docker/host-x86_64/x86_64-gnu-aux/Dockerfile @@ -16,7 +16,39 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ libgl1-mesa-dev \ llvm-dev \ libfreetype6-dev \ - libexpat1-dev + libexpat1-dev \ + gnupg \ + apt-utils \ + wget + +RUN curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash - +RUN apt install -y nodejs + +# This part is to install the requirements to run rustdoc GUI tests +# +# To do so we need: +# * a chrome instance (we can extend it to firefox) +# * cloning the browser-UI-test repository from https://github.com/GuillaumeGomez/browser-UI-test/ +# * cloning the test-rust-docs-ui repository from https://github.com/GuillaumeGomez/test-rust-docs-ui +# +# The browser-UI-test repository is a framework to make it as easy as possible to write GUI tests +# where the test-rust-docs-ui repository contains the tests specific to rustdoc GUI. +# +# NOte that the two repositories clone part is handled by bootstrap. +# +# To prevent unwanted changes breaking tests for everyone, both repositories will target a specfic +# commit that will need to be updated when the rustdoc GUI will be updated. +RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \ + && sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' + +RUN apt-get update && apt-get install -y --no-install-recommends \ + google-chrome-unstable \ + fonts-ipafont-gothic \ + fonts-wqy-zenhei \ + fonts-thai-tlwg \ + fonts-kacst \ + fonts-freefont-ttf \ + && rm -rf /var/lib/apt/lists/* COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh From 23903d9a936cc05824c5af3b4f579d6a797298f7 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sat, 6 Jun 2020 13:20:09 +0200 Subject: [PATCH 02/19] more fixes --- src/bootstrap/test.rs | 2 +- src/ci/docker/host-x86_64/x86_64-gnu-aux/Dockerfile | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index f23fe6c3246f6..01a133e060cd4 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -751,7 +751,7 @@ impl Step for RustdocGUI { ); // Second step: install npm dependencies. let mut cmd = Command::new("npm"); - cmd.arg("install").current_dir(builder.out.join("browser-UI-test").to_str().unwrap()); + cmd.arg("install").current_dir(builder.out.join("browser-UI-test")); try_run(builder, &mut cmd); // Third step: building documentation with lastest rustdoc version. diff --git a/src/ci/docker/host-x86_64/x86_64-gnu-aux/Dockerfile b/src/ci/docker/host-x86_64/x86_64-gnu-aux/Dockerfile index 692f60392c044..50cfda78c4ba7 100644 --- a/src/ci/docker/host-x86_64/x86_64-gnu-aux/Dockerfile +++ b/src/ci/docker/host-x86_64/x86_64-gnu-aux/Dockerfile @@ -19,7 +19,12 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ libexpat1-dev \ gnupg \ apt-utils \ - wget + wget \ + fonts-ipafont-gothic \ + fonts-wqy-zenhei \ + fonts-thai-tlwg \ + fonts-kacst \ + fonts-freefont-ttf \ RUN curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash - RUN apt install -y nodejs @@ -43,11 +48,6 @@ RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key RUN apt-get update && apt-get install -y --no-install-recommends \ google-chrome-unstable \ - fonts-ipafont-gothic \ - fonts-wqy-zenhei \ - fonts-thai-tlwg \ - fonts-kacst \ - fonts-freefont-ttf \ && rm -rf /var/lib/apt/lists/* COPY scripts/sccache.sh /scripts/ From b96a755ca78e770f9391dddcf7084f79972ea988 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sat, 27 Jun 2020 13:03:22 +0200 Subject: [PATCH 03/19] Update test-rust-docs-ui repository commit --- src/bootstrap/test.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index 01a133e060cd4..d47808bf64499 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -747,7 +747,7 @@ impl Step for RustdocGUI { util::clone_repository( "https://github.com/GuillaumeGomez/test-rust-docs-ui", &builder.out.join("test-rust-docs-ui"), - Some("03ea8284c2ab62607b6260793f08ea34953b14be"), + Some("c58f490401f2f0b1050946b224968a0466af0a8c"), ); // Second step: install npm dependencies. let mut cmd = Command::new("npm"); From 0b21a1c6b6ad2a3df9598f8c95ae5ed5f8bcc714 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sat, 27 Jun 2020 13:05:50 +0200 Subject: [PATCH 04/19] Add rustdoc GUI tests in try CI --- src/bootstrap/mk/Makefile.in | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/bootstrap/mk/Makefile.in b/src/bootstrap/mk/Makefile.in index 1564cfb06199c..11b497b96b84e 100644 --- a/src/bootstrap/mk/Makefile.in +++ b/src/bootstrap/mk/Makefile.in @@ -45,6 +45,10 @@ check-aux: src/tools/cargo \ src/tools/cargotest \ $(BOOTSTRAP_ARGS) +check-aux-and-gui: check-aux + $(Q)$(BOOTSTRAP) test \ + src/test/rustdoc-gui \ + $(BOOTSTRAP_ARGS) check-bootstrap: $(Q)$(CFG_PYTHON) $(CFG_SRC_DIR)src/bootstrap/bootstrap_test.py dist: From 103a7c9b345dd4d79375f7cf4948858251edb617 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sun, 12 Jul 2020 20:08:40 +0200 Subject: [PATCH 05/19] Use check-aux-and-gui rule instead of check-aux --- src/ci/docker/host-x86_64/x86_64-gnu-aux/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ci/docker/host-x86_64/x86_64-gnu-aux/Dockerfile b/src/ci/docker/host-x86_64/x86_64-gnu-aux/Dockerfile index 50cfda78c4ba7..9ce3f74c544b3 100644 --- a/src/ci/docker/host-x86_64/x86_64-gnu-aux/Dockerfile +++ b/src/ci/docker/host-x86_64/x86_64-gnu-aux/Dockerfile @@ -54,4 +54,4 @@ COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh ENV RUST_CONFIGURE_ARGS --build=x86_64-unknown-linux-gnu -ENV RUST_CHECK_TARGET check-aux +ENV RUST_CHECK_TARGET check-aux-and-gui From d91dc622898f1f6343c56dbe8be2482a8d68b305 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Tue, 14 Jul 2020 00:27:32 +0200 Subject: [PATCH 06/19] Fix apt install command --- src/ci/docker/host-x86_64/x86_64-gnu-aux/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ci/docker/host-x86_64/x86_64-gnu-aux/Dockerfile b/src/ci/docker/host-x86_64/x86_64-gnu-aux/Dockerfile index 9ce3f74c544b3..d573364e23d35 100644 --- a/src/ci/docker/host-x86_64/x86_64-gnu-aux/Dockerfile +++ b/src/ci/docker/host-x86_64/x86_64-gnu-aux/Dockerfile @@ -24,7 +24,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ fonts-wqy-zenhei \ fonts-thai-tlwg \ fonts-kacst \ - fonts-freefont-ttf \ + fonts-freefont-ttf RUN curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash - RUN apt install -y nodejs From cee74d433bfade17b810ba90c2d731fd584efcb2 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Tue, 14 Jul 2020 16:03:00 +0200 Subject: [PATCH 07/19] Actually generate test docs --- src/bootstrap/test.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index d47808bf64499..692e247f8f401 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -759,7 +759,9 @@ impl Step for RustdocGUI { if let Some(linker) = builder.linker(self.compiler.host, true) { cmd.env("RUSTC_TARGET_LINKER", linker); } + cmd.current_dir(builder.out.join("test-rust-docs-ui/test-docs")).arg("src/lib.rs"); try_run(builder, &mut cmd); + // Last step: running tests. let mut command = Command::new(nodejs); command From 1725e319a2cb4b7910ea9e271ef8774695fc59c8 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Thu, 16 Jul 2020 13:38:55 +0200 Subject: [PATCH 08/19] ensure that std has been built --- src/bootstrap/test.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index 692e247f8f401..a5e585040a0fe 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -738,6 +738,8 @@ impl Step for RustdocGUI { fn run(self, builder: &Builder<'_>) { if let Some(ref nodejs) = builder.config.nodejs { + builder.ensure(compile::Std { target: self.target, compiler: self.compiler }); + // First step: cloning repositories. util::clone_repository( "https://github.com/GuillaumeGomez/browser-UI-test", From 382279f2720968f6760d3888f816126c57b25184 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Wed, 22 Jul 2020 10:53:25 +0200 Subject: [PATCH 09/19] Add missing dependency --- src/ci/docker/host-x86_64/x86_64-gnu-aux/Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ci/docker/host-x86_64/x86_64-gnu-aux/Dockerfile b/src/ci/docker/host-x86_64/x86_64-gnu-aux/Dockerfile index d573364e23d35..3628f063f0674 100644 --- a/src/ci/docker/host-x86_64/x86_64-gnu-aux/Dockerfile +++ b/src/ci/docker/host-x86_64/x86_64-gnu-aux/Dockerfile @@ -24,7 +24,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ fonts-wqy-zenhei \ fonts-thai-tlwg \ fonts-kacst \ - fonts-freefont-ttf + fonts-freefont-ttf \ + libxss1 RUN curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash - RUN apt install -y nodejs From f655eae122b5c900b9d0b44a8dbe171b293b7155 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Wed, 22 Jul 2020 14:53:28 +0200 Subject: [PATCH 10/19] Update bootstrap RustdocGUI fields --- src/bootstrap/test.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index a5e585040a0fe..b5e9005d2b267 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -718,8 +718,8 @@ impl Step for RustdocUi { #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] pub struct RustdocGUI { - pub host: Interned, - pub target: Interned, + pub host: TargetSelection, + pub target: TargetSelection, pub compiler: Compiler, } From 2645e928cfa14aeaa7bae143c107f1ce59d52ff4 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Thu, 23 Jul 2020 00:23:17 +0200 Subject: [PATCH 11/19] Put back rustdoc GUI tests into CI try check --- .github/workflows/ci.yml | 2 +- src/ci/github-actions/ci.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f6f181612c926..956b7395adc7b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -151,7 +151,7 @@ jobs: strategy: matrix: include: - - name: dist-x86_64-linux + - name: x86_64-gnu-aux os: ubuntu-latest-xl env: {} timeout-minutes: 600 diff --git a/src/ci/github-actions/ci.yml b/src/ci/github-actions/ci.yml index db2def483ac30..ef32a4853c212 100644 --- a/src/ci/github-actions/ci.yml +++ b/src/ci/github-actions/ci.yml @@ -293,7 +293,7 @@ jobs: strategy: matrix: include: - - name: dist-x86_64-linux + - name: x86_64-gnu-aux <<: *job-linux-xl auto: From c2f904591bf60abe32ebdbf1ca8c148baee7860e Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Tue, 25 Aug 2020 14:01:19 +0200 Subject: [PATCH 12/19] Update test-rust-docs-ui commit to fix invalid codeblock tag --- src/bootstrap/test.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index b5e9005d2b267..48836c69cdc91 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -749,7 +749,7 @@ impl Step for RustdocGUI { util::clone_repository( "https://github.com/GuillaumeGomez/test-rust-docs-ui", &builder.out.join("test-rust-docs-ui"), - Some("c58f490401f2f0b1050946b224968a0466af0a8c"), + Some("ab1380fbf6e75d5f96f11eb36a2755773e52ba18"), ); // Second step: install npm dependencies. let mut cmd = Command::new("npm"); From 579132c2fbc977a62d735bba481b340a5a0af2d6 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Tue, 25 Aug 2020 15:15:10 +0200 Subject: [PATCH 13/19] * Force to run on stage 2 * Remove unneeded linker --- src/bootstrap/mk/Makefile.in | 2 +- src/bootstrap/test.rs | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/bootstrap/mk/Makefile.in b/src/bootstrap/mk/Makefile.in index 11b497b96b84e..1484ce1f28976 100644 --- a/src/bootstrap/mk/Makefile.in +++ b/src/bootstrap/mk/Makefile.in @@ -46,7 +46,7 @@ check-aux: src/tools/cargotest \ $(BOOTSTRAP_ARGS) check-aux-and-gui: check-aux - $(Q)$(BOOTSTRAP) test \ + $(Q)$(BOOTSTRAP) test --stage 2 \ src/test/rustdoc-gui \ $(BOOTSTRAP_ARGS) check-bootstrap: diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index 48836c69cdc91..ef0df16c1cfdd 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -758,9 +758,6 @@ impl Step for RustdocGUI { // Third step: building documentation with lastest rustdoc version. let mut cmd = builder.rustdoc_cmd(self.compiler); - if let Some(linker) = builder.linker(self.compiler.host, true) { - cmd.env("RUSTC_TARGET_LINKER", linker); - } cmd.current_dir(builder.out.join("test-rust-docs-ui/test-docs")).arg("src/lib.rs"); try_run(builder, &mut cmd); @@ -781,7 +778,7 @@ impl Step for RustdocGUI { .current_dir(builder.out.join("test-rust-docs-ui")); builder.run(&mut command); } else { - builder.info("No nodejs found, skipping \"src/test/rustdoc-js-std\" tests"); + builder.info("No nodejs found, skipping \"src/test/rustdoc-gui\" tests"); } } } From 789593390d379ad649d986546404de835e526748 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Tue, 25 Aug 2020 15:28:04 +0200 Subject: [PATCH 14/19] Don't force clone if the repository already exists --- src/bootstrap/util.rs | 71 +++++++++++++++++++++++++++++-------------- 1 file changed, 48 insertions(+), 23 deletions(-) diff --git a/src/bootstrap/util.rs b/src/bootstrap/util.rs index 86f922d016681..7bd54c9cabfb3 100644 --- a/src/bootstrap/util.rs +++ b/src/bootstrap/util.rs @@ -7,7 +7,7 @@ use std::env; use std::fs; use std::io; use std::path::{Path, PathBuf}; -use std::process::Command; +use std::process::{Command, ExitStatus}; use std::str; use std::time::Instant; @@ -303,35 +303,60 @@ pub fn use_host_linker(target: TargetSelection) -> bool { || target.contains("fuchsia")) } +fn check_command_status(cmd_status: io::Result, error_msg: &str) { + let success = match cmd_status { + Ok(s) => s.success(), + Err(_) => false, + }; + if !success { + panic!("{} unsuccessful (status: {:?})", error_msg, cmd_status); + } +} + pub fn clone_repository( repository_url: &str, target_dir: &Path, specific_commit_hash: Option<&str>, ) { if target_dir.is_dir() { - fs::remove_dir_all(target_dir).expect("failed to remove target folder"); - } - let status = - Command::new("git").arg("clone").arg(repository_url).arg(target_dir.as_os_str()).status(); - let success = match status { - Ok(s) => s.success(), - Err(_) => false, - }; - if !success { - panic!("git clone unsuccessful (status: {:?})", status); + // First fetch to have latest remote repository data. + check_command_status( + Command::new("git") + .arg("fetch") + .arg("origin") + .current_dir(target_dir.to_str().unwrap()) + .status(), + "git fetch", + ); + // In case there is no specific commit hash, we need to get the last version. + if specific_commit_hash.is_none() { + check_command_status( + Command::new("git") + .arg("checkout") + .arg("origin/master") + .current_dir(target_dir.to_str().unwrap()) + .status(), + "git checkout on origin/master", + ); + } + } else { + check_command_status( + Command::new("git") + .arg("clone") + .arg(repository_url) + .arg(target_dir.as_os_str()) + .status(), + "git clone", + ); } if let Some(specific_commit_hash) = specific_commit_hash { - let status = Command::new("git") - .arg("checkout") - .arg(specific_commit_hash) - .current_dir(target_dir.to_str().unwrap()) - .status(); - let success = match status { - Ok(s) => s.success(), - Err(_) => false, - }; - if !success { - panic!("git checkout unsuccessful (status: {:?})", status); - } + check_command_status( + Command::new("git") + .arg("checkout") + .arg(specific_commit_hash) + .current_dir(target_dir.to_str().unwrap()) + .status(), + "git checkout", + ); } } From 8ec189f60f9d9ad285d572e39c3a0bb8bef298b6 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Tue, 25 Aug 2020 17:06:41 +0200 Subject: [PATCH 15/19] Add missing libxtst6 dependency for chrome --- src/ci/docker/host-x86_64/x86_64-gnu-aux/Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ci/docker/host-x86_64/x86_64-gnu-aux/Dockerfile b/src/ci/docker/host-x86_64/x86_64-gnu-aux/Dockerfile index 3628f063f0674..31aac7f1c2ed9 100644 --- a/src/ci/docker/host-x86_64/x86_64-gnu-aux/Dockerfile +++ b/src/ci/docker/host-x86_64/x86_64-gnu-aux/Dockerfile @@ -25,7 +25,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ fonts-thai-tlwg \ fonts-kacst \ fonts-freefont-ttf \ - libxss1 + libxss1 \ + libxtst6 RUN curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash - RUN apt install -y nodejs From 902570b7e22dd66b69b3d8960f5ac69346840ab9 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Tue, 25 Aug 2020 18:06:40 +0200 Subject: [PATCH 16/19] Use panic in case try_run fails --- src/bootstrap/test.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index ef0df16c1cfdd..4f50a2dbf28a6 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -754,12 +754,16 @@ impl Step for RustdocGUI { // Second step: install npm dependencies. let mut cmd = Command::new("npm"); cmd.arg("install").current_dir(builder.out.join("browser-UI-test")); - try_run(builder, &mut cmd); + if !try_run(builder, &mut cmd) { + panic!("failed to install browser-UI-test node package"); + } // Third step: building documentation with lastest rustdoc version. let mut cmd = builder.rustdoc_cmd(self.compiler); cmd.current_dir(builder.out.join("test-rust-docs-ui/test-docs")).arg("src/lib.rs"); - try_run(builder, &mut cmd); + if !try_run(builder, &mut cmd) { + panic!("Failed to build docs for rustdoc-gui test!"); + } // Last step: running tests. let mut command = Command::new(nodejs); From c12fb90d3668cd9a11f39c7a47a64b6cb0b02025 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Tue, 25 Aug 2020 18:07:31 +0200 Subject: [PATCH 17/19] Update test-rust-docs-ui repository commit to fix library naming issue when generating without cargo --- src/bootstrap/test.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index 4f50a2dbf28a6..b3d743f436050 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -749,7 +749,7 @@ impl Step for RustdocGUI { util::clone_repository( "https://github.com/GuillaumeGomez/test-rust-docs-ui", &builder.out.join("test-rust-docs-ui"), - Some("ab1380fbf6e75d5f96f11eb36a2755773e52ba18"), + Some("a12357e6ff192378cc88833ab02b00a529cd6aa2"), ); // Second step: install npm dependencies. let mut cmd = Command::new("npm"); From 24281040b03b69d0dff27f0ab7375b82a089b7b4 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Tue, 25 Aug 2020 19:36:17 +0200 Subject: [PATCH 18/19] canonicalize path --- src/bootstrap/test.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index b3d743f436050..d18e6bd3b42fe 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -776,7 +776,13 @@ impl Step for RustdocGUI { .arg("failures") .arg("--variable") .arg("DOC_PATH") - .arg("test-docs/doc/test_docs") + .arg( + builder + .out + .canonicalize() + .unwrap() + .join("test-rust-docs-ui/test-docs/doc/test_docs"), + ) .arg("--show-text") .arg("--generate-images") .current_dir(builder.out.join("test-rust-docs-ui")); From 0756b1e4b103af5ad4016cbb608d1b3a18bbd347 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Wed, 26 Aug 2020 01:07:27 +0200 Subject: [PATCH 19/19] Update both repositories to new docker image run --- src/bootstrap/test.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index d18e6bd3b42fe..e2ce45cc4fa91 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -744,12 +744,12 @@ impl Step for RustdocGUI { util::clone_repository( "https://github.com/GuillaumeGomez/browser-UI-test", &builder.out.join("browser-UI-test"), - Some("1de38b0962f9abbddc677aaa3a94b864c0f40668"), + Some("e47b1a8697f628429cb684e0b3716737a3a0fa78"), ); util::clone_repository( "https://github.com/GuillaumeGomez/test-rust-docs-ui", &builder.out.join("test-rust-docs-ui"), - Some("a12357e6ff192378cc88833ab02b00a529cd6aa2"), + Some("d74abb60d1bd1e3fbf647d2d2eb521f2aa357f27"), ); // Second step: install npm dependencies. let mut cmd = Command::new("npm");