Skip to content

Commit

Permalink
Don't run the spec_testsuite tests if the submodule isn't checked out. (
Browse files Browse the repository at this point in the history
bytecodealliance#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`.
  • Loading branch information
sunfishcode authored Oct 9, 2019
1 parent fd3efad commit 8e59350
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand Down

0 comments on commit 8e59350

Please sign in to comment.