-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Add doc ui tests #53319
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Add doc ui tests #53319
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -109,3 +109,5 @@ version.texi | |
|
||
no_llvm_build | ||
|
||
**node_modules/ | ||
**doc-ui/.lock | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -584,6 +584,70 @@ impl Step for RustdocJS { | |
} | ||
} | ||
|
||
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] | ||
pub struct DocUI { | ||
pub host: Interned<String>, | ||
pub target: Interned<String>, | ||
} | ||
|
||
impl Step for DocUI { | ||
type Output = (); | ||
const DEFAULT: bool = true; | ||
const ONLY_HOSTS: bool = true; | ||
|
||
fn should_run(run: ShouldRun) -> ShouldRun { | ||
run.path("src/test/doc-ui") | ||
} | ||
|
||
fn make_run(run: RunConfig) { | ||
run.builder.ensure(DocUI { | ||
host: run.host, | ||
target: run.target, | ||
}); | ||
} | ||
|
||
fn run(self, builder: &Builder) { | ||
if let Some(ref nodejs) = builder.config.nodejs { | ||
let mut found_puppeteer = false; | ||
// Check if puppeteer is installed locally. | ||
if let Ok(output) = Command::new("npm") | ||
.args(&["ls", "puppeteer", "puppeteer-core"]) | ||
.current_dir("src/tools/doc-ui") | ||
.output() { | ||
found_puppeteer = String::from_utf8_lossy(&output.stdout).contains("puppeteer"); | ||
} | ||
if !found_puppeteer { | ||
// Check if puppeteer is installed "globally". | ||
if let Ok(output) = Command::new("npm") | ||
.args(&["ls", "-g", "puppeteer", "puppeteer-core"]) | ||
.output() { | ||
found_puppeteer = String::from_utf8_lossy(&output.stdout).contains("puppeteer"); | ||
} | ||
} | ||
if !found_puppeteer { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the condition is inverted here, you're running the script only if puppeteer was not found? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes it is inverted, good find! |
||
let mut command = Command::new(nodejs); | ||
command.args(&["src/tools/doc-ui/script.js", | ||
&*self.host, | ||
&builder.top_stage.to_string()]); | ||
builder.ensure(::doc::Std { | ||
target: self.target, | ||
stage: builder.top_stage, | ||
}); | ||
builder.run(&mut command); | ||
} else { | ||
builder.info(&format!( | ||
"No puppeteer found (maybe try installing it with `npm install puppeteer`?), \ | ||
skipping \"src/test/doc-ui\" tests" | ||
)); | ||
} | ||
} else { | ||
builder.info(&format!( | ||
"No nodejs found, skipping \"src/test/doc-ui\" tests" | ||
)); | ||
} | ||
} | ||
} | ||
|
||
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] | ||
pub struct RustdocUi { | ||
pub host: Interned<String>, | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution and at | ||
// http://rust-lang.org/COPYRIGHT. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
pub struct Foo { | ||
pub damn: u32, | ||
pub foo: Option<i8>, | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution and at | ||
// http://rust-lang.org/COPYRIGHT. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
var TEST = { | ||
"path": "struct.Foo.html", | ||
}; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, do these need to be this much of a blanket ignore? Perhaps we can isolate it to some subpath?
(Very much not important if you don't feel like dealing with it).