-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Add rustdoc JS non-std tests #58330
Add rustdoc JS non-std tests #58330
Changes from 1 commit
834347d
aa3ca32
be23cd9
240fad0
405d950
d6add90
37ab3dc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
/// Foo | ||
pub struct Foo; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ use crate::common::{output_base_dir, output_base_name, output_testname_unique}; | |
use crate::common::{Codegen, CodegenUnits, DebugInfoBoth, DebugInfoGdb, DebugInfoLldb, Rustdoc}; | ||
use crate::common::{CompileFail, Pretty, RunFail, RunPass, RunPassValgrind}; | ||
use crate::common::{Config, TestPaths}; | ||
use crate::common::{Incremental, MirOpt, RunMake, Ui}; | ||
use crate::common::{Incremental, MirOpt, RunMake, Ui, JsDocTest}; | ||
use diff; | ||
use crate::errors::{self, Error, ErrorKind}; | ||
use filetime::FileTime; | ||
|
@@ -275,6 +275,7 @@ impl<'test> TestCx<'test> { | |
RunMake => self.run_rmake_test(), | ||
RunPass | Ui => self.run_ui_test(), | ||
MirOpt => self.run_mir_opt_test(), | ||
JsDocTest => self.run_js_doc_test(), | ||
} | ||
} | ||
|
||
|
@@ -290,7 +291,7 @@ impl<'test> TestCx<'test> { | |
fn should_compile_successfully(&self) -> bool { | ||
match self.config.mode { | ||
CompileFail => self.props.compile_pass, | ||
RunPass => true, | ||
RunPass | JsDocTest => true, | ||
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. Instead of the 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. Sure! |
||
Ui => self.props.compile_pass, | ||
Incremental => { | ||
let revision = self.revision | ||
|
@@ -1712,7 +1713,8 @@ impl<'test> TestCx<'test> { | |
} | ||
|
||
fn make_compile_args(&self, input_file: &Path, output_file: TargetLocation) -> Command { | ||
let is_rustdoc = self.config.src_base.ends_with("rustdoc-ui"); | ||
let is_rustdoc = self.config.src_base.ends_with("rustdoc-ui") || | ||
self.config.src_base.ends_with("rustdoc-js"); | ||
let mut rustc = if !is_rustdoc { | ||
Command::new(&self.config.rustc_path) | ||
} else { | ||
|
@@ -1802,7 +1804,7 @@ impl<'test> TestCx<'test> { | |
rustc.arg(dir_opt); | ||
} | ||
RunFail | RunPassValgrind | Pretty | DebugInfoBoth | DebugInfoGdb | DebugInfoLldb | ||
| Codegen | Rustdoc | RunMake | CodegenUnits => { | ||
| Codegen | Rustdoc | RunMake | CodegenUnits | JsDocTest => { | ||
// do not use JSON output | ||
} | ||
} | ||
|
@@ -2710,6 +2712,25 @@ impl<'test> TestCx<'test> { | |
fs::remove_dir(path) | ||
} | ||
|
||
fn run_js_doc_test(&self) { | ||
if let Some(nodejs) = &self.config.nodejs { | ||
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. Is 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 took the same code I used previously. But iirc, it is from the 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. Yep, and checked in bootstrap (this is a config "passed through" from bootstrap). 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. Can we make this call 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. Ok! |
||
let out_dir = self.output_base_dir(); | ||
|
||
self.document(&out_dir); | ||
|
||
let root = self.config.find_rust_src_root().unwrap(); | ||
let res = self.cmd2procres( | ||
Command::new(&nodejs) | ||
.arg(root.join("src/tools/rustdoc-js/tester.js")) | ||
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. Shouldn't this be Either way, I'm confused why we've only migrated one of the suites and not both to compiletest? 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. The |
||
.arg(out_dir.parent().expect("no parent")) | ||
.arg(&self.testpaths.file.file_stem().expect("couldn't get file stem")), | ||
); | ||
if !res.status.success() { | ||
self.fatal_proc_rec("rustdoc-js test failed!", &res); | ||
} | ||
} | ||
} | ||
|
||
fn run_ui_test(&self) { | ||
// if the user specified a format in the ui test | ||
// print the output to the stderr file, otherwise extract | ||
|
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.
It feels like this isn't needed? The compiletest invocation above is has the mode as js-doc-test, which you've also checked below.
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.
It's more convenient to check for instance:
or: