Make nodejs
control the default for RustdocJs tests instead of a hard-off switch
If someone says `x test rustdoc-js-std` explicitly on the command line, it's because they want to run the tests. Give an error instead of doing nothing and reporting success.
This commit is contained in:
parent
33a2c2487a
commit
9d071b3b0d
@ -867,7 +867,8 @@ impl Step for RustdocJSStd {
|
|||||||
const ONLY_HOSTS: bool = true;
|
const ONLY_HOSTS: bool = true;
|
||||||
|
|
||||||
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
|
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
|
||||||
run.suite_path("tests/rustdoc-js-std")
|
let default = run.builder.config.nodejs.is_some();
|
||||||
|
run.suite_path("tests/rustdoc-js-std").default_condition(default)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn make_run(run: RunConfig<'_>) {
|
fn make_run(run: RunConfig<'_>) {
|
||||||
@ -875,38 +876,34 @@ impl Step for RustdocJSStd {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn run(self, builder: &Builder<'_>) {
|
fn run(self, builder: &Builder<'_>) {
|
||||||
if let Some(ref nodejs) = builder.config.nodejs {
|
let nodejs =
|
||||||
let mut command = Command::new(nodejs);
|
builder.config.nodejs.as_ref().expect("need nodejs to run rustdoc-js-std tests");
|
||||||
command
|
let mut command = Command::new(nodejs);
|
||||||
.arg(builder.src.join("src/tools/rustdoc-js/tester.js"))
|
command
|
||||||
.arg("--crate-name")
|
.arg(builder.src.join("src/tools/rustdoc-js/tester.js"))
|
||||||
.arg("std")
|
.arg("--crate-name")
|
||||||
.arg("--resource-suffix")
|
.arg("std")
|
||||||
.arg(&builder.version)
|
.arg("--resource-suffix")
|
||||||
.arg("--doc-folder")
|
.arg(&builder.version)
|
||||||
.arg(builder.doc_out(self.target))
|
.arg("--doc-folder")
|
||||||
.arg("--test-folder")
|
.arg(builder.doc_out(self.target))
|
||||||
.arg(builder.src.join("tests/rustdoc-js-std"));
|
.arg("--test-folder")
|
||||||
for path in &builder.paths {
|
.arg(builder.src.join("tests/rustdoc-js-std"));
|
||||||
if let Some(p) =
|
for path in &builder.paths {
|
||||||
util::is_valid_test_suite_arg(path, "tests/rustdoc-js-std", builder)
|
if let Some(p) = util::is_valid_test_suite_arg(path, "tests/rustdoc-js-std", builder) {
|
||||||
{
|
if !p.ends_with(".js") {
|
||||||
if !p.ends_with(".js") {
|
eprintln!("A non-js file was given: `{}`", path.display());
|
||||||
eprintln!("A non-js file was given: `{}`", path.display());
|
panic!("Cannot run rustdoc-js-std tests");
|
||||||
panic!("Cannot run rustdoc-js-std tests");
|
|
||||||
}
|
|
||||||
command.arg("--test-file").arg(path);
|
|
||||||
}
|
}
|
||||||
|
command.arg("--test-file").arg(path);
|
||||||
}
|
}
|
||||||
builder.ensure(crate::doc::Std::new(
|
|
||||||
builder.top_stage,
|
|
||||||
self.target,
|
|
||||||
DocumentationFormat::HTML,
|
|
||||||
));
|
|
||||||
builder.run(&mut command);
|
|
||||||
} else {
|
|
||||||
builder.info("No nodejs found, skipping \"tests/rustdoc-js-std\" tests");
|
|
||||||
}
|
}
|
||||||
|
builder.ensure(crate::doc::Std::new(
|
||||||
|
builder.top_stage,
|
||||||
|
self.target,
|
||||||
|
DocumentationFormat::HTML,
|
||||||
|
));
|
||||||
|
builder.run(&mut command);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -922,7 +919,8 @@ impl Step for RustdocJSNotStd {
|
|||||||
const ONLY_HOSTS: bool = true;
|
const ONLY_HOSTS: bool = true;
|
||||||
|
|
||||||
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
|
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
|
||||||
run.suite_path("tests/rustdoc-js")
|
let default = run.builder.config.nodejs.is_some();
|
||||||
|
run.suite_path("tests/rustdoc-js").default_condition(default)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn make_run(run: RunConfig<'_>) {
|
fn make_run(run: RunConfig<'_>) {
|
||||||
@ -931,18 +929,14 @@ impl Step for RustdocJSNotStd {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn run(self, builder: &Builder<'_>) {
|
fn run(self, builder: &Builder<'_>) {
|
||||||
if builder.config.nodejs.is_some() {
|
builder.ensure(Compiletest {
|
||||||
builder.ensure(Compiletest {
|
compiler: self.compiler,
|
||||||
compiler: self.compiler,
|
target: self.target,
|
||||||
target: self.target,
|
mode: "js-doc-test",
|
||||||
mode: "js-doc-test",
|
suite: "rustdoc-js",
|
||||||
suite: "rustdoc-js",
|
path: "tests/rustdoc-js",
|
||||||
path: "tests/rustdoc-js",
|
compare_mode: None,
|
||||||
compare_mode: None,
|
});
|
||||||
});
|
|
||||||
} else {
|
|
||||||
builder.info("No nodejs found, skipping \"tests/rustdoc-js\" tests");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1568,6 +1562,8 @@ note: if you're sure you want to do this, please open an issue as to why. In the
|
|||||||
|
|
||||||
if let Some(ref nodejs) = builder.config.nodejs {
|
if let Some(ref nodejs) = builder.config.nodejs {
|
||||||
cmd.arg("--nodejs").arg(nodejs);
|
cmd.arg("--nodejs").arg(nodejs);
|
||||||
|
} else if mode == "js-doc-test" {
|
||||||
|
panic!("need nodejs to run js-doc-test suite");
|
||||||
}
|
}
|
||||||
if let Some(ref npm) = builder.config.npm {
|
if let Some(ref npm) = builder.config.npm {
|
||||||
cmd.arg("--npm").arg(npm);
|
cmd.arg("--npm").arg(npm);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user