Don't run the spec_testsuite tests if the submodule isn't checked out. (#409)
* Don't run the spec_testsuite tests if the submodule isn't checked out. This way, if someone checks out the repository without checking out the submodules, they can still run "cargo test". Also, fix a warning in the generated test runner code. * Print a message if the spec_testsuite submodule is not enabled. * Move the `#[cfg(test)]` to the top-level `mod`.
This commit is contained in:
22
build.rs
22
build.rs
@@ -19,17 +19,27 @@ fn main() {
|
|||||||
#[cfg(feature = "lightbeam")]
|
#[cfg(feature = "lightbeam")]
|
||||||
"Lightbeam",
|
"Lightbeam",
|
||||||
] {
|
] {
|
||||||
|
writeln!(out, "#[cfg(test)]").expect("generating tests");
|
||||||
writeln!(out, "#[allow(non_snake_case)]").expect("generating tests");
|
writeln!(out, "#[allow(non_snake_case)]").expect("generating tests");
|
||||||
writeln!(out, "mod {} {{", strategy).expect("generating tests");
|
writeln!(out, "mod {} {{", strategy).expect("generating tests");
|
||||||
|
|
||||||
test_directory(&mut out, "misc_testsuite", strategy).expect("generating tests");
|
test_directory(&mut out, "misc_testsuite", strategy).expect("generating tests");
|
||||||
test_directory(&mut out, "spec_testsuite", strategy).expect("generating tests");
|
test_directory(&mut out, "spec_testsuite", strategy).expect("generating tests");
|
||||||
test_file(
|
// Skip running spec_testsuite tests if the submodule isn't checked out.
|
||||||
&mut out,
|
if read_dir("spec_testsuite")
|
||||||
"spec_testsuite/proposals/simd/simd_const.wast",
|
.expect("reading testsuite directory")
|
||||||
strategy,
|
.next()
|
||||||
)
|
.is_some()
|
||||||
.expect("generating tests");
|
{
|
||||||
|
test_file(
|
||||||
|
&mut out,
|
||||||
|
"spec_testsuite/proposals/simd/simd_const.wast",
|
||||||
|
strategy,
|
||||||
|
)
|
||||||
|
.expect("generating tests");
|
||||||
|
} else {
|
||||||
|
println!("cargo:warning=The spec testsuite is disabled. To enable, run `git submodule update --remote`.");
|
||||||
|
}
|
||||||
|
|
||||||
writeln!(out, "}}").expect("generating tests");
|
writeln!(out, "}}").expect("generating tests");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user