Spec-interpreter fuzzing: check out fuzzing branch of our mirror. (#3222)

In #3186, we found an issue that requires patching the spec interpreter
for now. Our plan is to have a `fuzzing` branch in our spec-repo mirror
that lets us make these fixes locally before they are upstreamed.
This PR updates the build script for the spec-interpreter wrapper
crate to clone this particular `fuzzing` branch instead of the main
branch.
This commit is contained in:
Chris Fallin
2021-08-20 10:54:52 -07:00
committed by GitHub
parent 58bf9b7bba
commit b2bcdd13ec

View File

@@ -11,6 +11,7 @@ const LIB_NAME: &'static str = "interpret";
const OCAML_DIR: &'static str = "ocaml"; const OCAML_DIR: &'static str = "ocaml";
const SPEC_DIR: &'static str = "ocaml/spec"; const SPEC_DIR: &'static str = "ocaml/spec";
const SPEC_REPOSITORY: &'static str = "https://github.com/bytecodealliance/wasm-spec-mirror"; const SPEC_REPOSITORY: &'static str = "https://github.com/bytecodealliance/wasm-spec-mirror";
const SPEC_REPOSITORY_BRANCH: &'static str = "fuzzing";
fn main() { fn main() {
if cfg!(feature = "build-libinterpret") { if cfg!(feature = "build-libinterpret") {
@@ -32,7 +33,7 @@ fn build() {
} else { } else {
// Ensure the spec repository is present. // Ensure the spec repository is present.
if is_spec_repository_empty(SPEC_DIR) { if is_spec_repository_empty(SPEC_DIR) {
retrieve_spec_repository(SPEC_REPOSITORY, SPEC_DIR) retrieve_spec_repository(SPEC_REPOSITORY, SPEC_REPOSITORY_BRANCH, SPEC_DIR)
} }
// Build the library to link to. // Build the library to link to.
@@ -71,12 +72,14 @@ fn is_spec_repository_empty(destination: &str) -> bool {
// Clone the spec repository into `destination`. This exists due to the large // Clone the spec repository into `destination`. This exists due to the large
// size of the dependencies (e.g. KaTeX) that are pulled if this were cloned // size of the dependencies (e.g. KaTeX) that are pulled if this were cloned
// recursively as a submodule. // recursively as a submodule.
fn retrieve_spec_repository(repository: &str, destination: &str) { fn retrieve_spec_repository(repository: &str, branch: &str, destination: &str) {
let status = Command::new("git") let status = Command::new("git")
.arg("clone") .arg("clone")
.arg("--depth") .arg("--depth")
.arg("1") .arg("1")
.arg(repository) .arg(repository)
.arg("-b")
.arg(branch)
.arg(destination) .arg(destination)
.status() .status()
.expect("Failed to execute 'git' command to clone spec repository."); .expect("Failed to execute 'git' command to clone spec repository.");