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")]
|
||||
"Lightbeam",
|
||||
] {
|
||||
writeln!(out, "#[cfg(test)]").expect("generating tests");
|
||||
writeln!(out, "#[allow(non_snake_case)]").expect("generating tests");
|
||||
writeln!(out, "mod {} {{", 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_file(
|
||||
&mut out,
|
||||
"spec_testsuite/proposals/simd/simd_const.wast",
|
||||
strategy,
|
||||
)
|
||||
.expect("generating tests");
|
||||
// Skip running spec_testsuite tests if the submodule isn't checked out.
|
||||
if read_dir("spec_testsuite")
|
||||
.expect("reading testsuite directory")
|
||||
.next()
|
||||
.is_some()
|
||||
{
|
||||
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");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user