Skip to content

Commit

Permalink
Refactored build outside src
Browse files Browse the repository at this point in the history
  • Loading branch information
syrusakbary committed Dec 10, 2018
1 parent 35c9512 commit e58963d
Show file tree
Hide file tree
Showing 65 changed files with 73 additions and 66 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -1,3 +1,4 @@
/target
**/*.rs.bk
/artifacts
.DS_Store
2 changes: 1 addition & 1 deletion Cargo.toml
Expand Up @@ -7,7 +7,7 @@ repository = "https://github.com/wasmerio/wasmer"
publish = true
description = "High-Performance WebAssembly JIT interpreter"
license = "MIT"
build = "src/build_spectests.rs"
build = "build/mod.rs"
include = [
"examples/**/*",
"src/**/*",
Expand Down
8 changes: 8 additions & 0 deletions build/mod.rs
@@ -0,0 +1,8 @@
extern crate wabt;

// use emtests;
mod spectests;

fn main() {
spectests::build();
}
6 changes: 2 additions & 4 deletions src/build_spectests.rs → build/spectests.rs
@@ -1,8 +1,6 @@
//! This file will run at build time to autogenerate Rust tests based on
//! WebAssembly spec tests. It will convert the files indicated in TESTS
//! from "/spectests/{MODULE}.wast" to "/src/spectests/{MODULE}.rs".
extern crate wabt;

use std::collections::HashMap;
use std::env;
use std::fs;
Expand All @@ -12,7 +10,7 @@ use wabt::wasm2wat;

static ENV_VAR: &str = "WASM_GENERATE_SPECTESTS";

static BANNER: &str = "// Rust test file autogenerated with cargo build (src/build_spectests.rs).
static BANNER: &str = "// Rust test file autogenerated with cargo build (build/spectests.rs).
// Please do NOT modify it by hand, as it will be reseted on next build.\n";

const TESTS: [&str; 60] = [
Expand Down Expand Up @@ -620,7 +618,7 @@ fn wast_to_rust(wast_filepath: &str) -> (String, i32) {
(script_name, generator.command_no)
}

fn main() {
pub fn build() {
if env::var(ENV_VAR).unwrap_or("0".to_string()) != "1" {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/spectests/address.rs
@@ -1,4 +1,4 @@
// Rust test file autogenerated with cargo build (src/build_spectests.rs).
// Rust test file autogenerated with cargo build (build/spectests.rs).
// Please do NOT modify it by hand, as it will be reseted on next build.
// Test based on spectests/address.wast
#![allow(
Expand Down
2 changes: 1 addition & 1 deletion src/spectests/align.rs
@@ -1,4 +1,4 @@
// Rust test file autogenerated with cargo build (src/build_spectests.rs).
// Rust test file autogenerated with cargo build (build/spectests.rs).
// Please do NOT modify it by hand, as it will be reseted on next build.
// Test based on spectests/align.wast
#![allow(
Expand Down
2 changes: 1 addition & 1 deletion src/spectests/binary.rs
@@ -1,4 +1,4 @@
// Rust test file autogenerated with cargo build (src/build_spectests.rs).
// Rust test file autogenerated with cargo build (build/spectests.rs).
// Please do NOT modify it by hand, as it will be reseted on next build.
// Test based on spectests/binary.wast
#![allow(
Expand Down
2 changes: 1 addition & 1 deletion src/spectests/block.rs
@@ -1,4 +1,4 @@
// Rust test file autogenerated with cargo build (src/build_spectests.rs).
// Rust test file autogenerated with cargo build (build/spectests.rs).
// Please do NOT modify it by hand, as it will be reseted on next build.
// Test based on spectests/block.wast
#![allow(
Expand Down
2 changes: 1 addition & 1 deletion src/spectests/br.rs
@@ -1,4 +1,4 @@
// Rust test file autogenerated with cargo build (src/build_spectests.rs).
// Rust test file autogenerated with cargo build (build/spectests.rs).
// Please do NOT modify it by hand, as it will be reseted on next build.
// Test based on spectests/br.wast
#![allow(
Expand Down
2 changes: 1 addition & 1 deletion src/spectests/br_if.rs
@@ -1,4 +1,4 @@
// Rust test file autogenerated with cargo build (src/build_spectests.rs).
// Rust test file autogenerated with cargo build (build/spectests.rs).
// Please do NOT modify it by hand, as it will be reseted on next build.
// Test based on spectests/br_if.wast
#![allow(
Expand Down
2 changes: 1 addition & 1 deletion src/spectests/br_table.rs
@@ -1,4 +1,4 @@
// Rust test file autogenerated with cargo build (src/build_spectests.rs).
// Rust test file autogenerated with cargo build (build/spectests.rs).
// Please do NOT modify it by hand, as it will be reseted on next build.
// Test based on spectests/br_table.wast
#![allow(
Expand Down
2 changes: 1 addition & 1 deletion src/spectests/break_drop.rs
@@ -1,4 +1,4 @@
// Rust test file autogenerated with cargo build (src/build_spectests.rs).
// Rust test file autogenerated with cargo build (build/spectests.rs).
// Please do NOT modify it by hand, as it will be reseted on next build.
// Test based on spectests/break_drop.wast
#![allow(
Expand Down
2 changes: 1 addition & 1 deletion src/spectests/call.rs
@@ -1,4 +1,4 @@
// Rust test file autogenerated with cargo build (src/build_spectests.rs).
// Rust test file autogenerated with cargo build (build/spectests.rs).
// Please do NOT modify it by hand, as it will be reseted on next build.
// Test based on spectests/call.wast
#![allow(
Expand Down
2 changes: 1 addition & 1 deletion src/spectests/call_indirect.rs
@@ -1,4 +1,4 @@
// Rust test file autogenerated with cargo build (src/build_spectests.rs).
// Rust test file autogenerated with cargo build (build/spectests.rs).
// Please do NOT modify it by hand, as it will be reseted on next build.
// Test based on spectests/call_indirect.wast
#![allow(
Expand Down
2 changes: 1 addition & 1 deletion src/spectests/comments.rs
@@ -1,4 +1,4 @@
// Rust test file autogenerated with cargo build (src/build_spectests.rs).
// Rust test file autogenerated with cargo build (build/spectests.rs).
// Please do NOT modify it by hand, as it will be reseted on next build.
// Test based on spectests/comments.wast
#![allow(
Expand Down
2 changes: 1 addition & 1 deletion src/spectests/const_.rs
@@ -1,4 +1,4 @@
// Rust test file autogenerated with cargo build (src/build_spectests.rs).
// Rust test file autogenerated with cargo build (build/spectests.rs).
// Please do NOT modify it by hand, as it will be reseted on next build.
// Test based on spectests/const_.wast
#![allow(
Expand Down
2 changes: 1 addition & 1 deletion src/spectests/conversions.rs
@@ -1,4 +1,4 @@
// Rust test file autogenerated with cargo build (src/build_spectests.rs).
// Rust test file autogenerated with cargo build (build/spectests.rs).
// Please do NOT modify it by hand, as it will be reseted on next build.
// Test based on spectests/conversions.wast
#![allow(
Expand Down
2 changes: 1 addition & 1 deletion src/spectests/custom.rs
@@ -1,4 +1,4 @@
// Rust test file autogenerated with cargo build (src/build_spectests.rs).
// Rust test file autogenerated with cargo build (build/spectests.rs).
// Please do NOT modify it by hand, as it will be reseted on next build.
// Test based on spectests/custom.wast
#![allow(
Expand Down
2 changes: 1 addition & 1 deletion src/spectests/data.rs
@@ -1,4 +1,4 @@
// Rust test file autogenerated with cargo build (src/build_spectests.rs).
// Rust test file autogenerated with cargo build (build/spectests.rs).
// Please do NOT modify it by hand, as it will be reseted on next build.
// Test based on spectests/data.wast
#![allow(
Expand Down
2 changes: 1 addition & 1 deletion src/spectests/elem.rs
@@ -1,4 +1,4 @@
// Rust test file autogenerated with cargo build (src/build_spectests.rs).
// Rust test file autogenerated with cargo build (build/spectests.rs).
// Please do NOT modify it by hand, as it will be reseted on next build.
// Test based on spectests/elem.wast
#![allow(
Expand Down
2 changes: 1 addition & 1 deletion src/spectests/endianness.rs
@@ -1,4 +1,4 @@
// Rust test file autogenerated with cargo build (src/build_spectests.rs).
// Rust test file autogenerated with cargo build (build/spectests.rs).
// Please do NOT modify it by hand, as it will be reseted on next build.
// Test based on spectests/endianness.wast
#![allow(
Expand Down
2 changes: 1 addition & 1 deletion src/spectests/exports.rs
@@ -1,4 +1,4 @@
// Rust test file autogenerated with cargo build (src/build_spectests.rs).
// Rust test file autogenerated with cargo build (build/spectests.rs).
// Please do NOT modify it by hand, as it will be reseted on next build.
// Test based on spectests/exports.wast
#![allow(
Expand Down
2 changes: 1 addition & 1 deletion src/spectests/f32_.rs
@@ -1,4 +1,4 @@
// Rust test file autogenerated with cargo build (src/build_spectests.rs).
// Rust test file autogenerated with cargo build (build/spectests.rs).
// Please do NOT modify it by hand, as it will be reseted on next build.
// Test based on spectests/f32_.wast
#![allow(
Expand Down
2 changes: 1 addition & 1 deletion src/spectests/f32_bitwise.rs
@@ -1,4 +1,4 @@
// Rust test file autogenerated with cargo build (src/build_spectests.rs).
// Rust test file autogenerated with cargo build (build/spectests.rs).
// Please do NOT modify it by hand, as it will be reseted on next build.
// Test based on spectests/f32_bitwise.wast
#![allow(
Expand Down
2 changes: 1 addition & 1 deletion src/spectests/f32_cmp.rs
@@ -1,4 +1,4 @@
// Rust test file autogenerated with cargo build (src/build_spectests.rs).
// Rust test file autogenerated with cargo build (build/spectests.rs).
// Please do NOT modify it by hand, as it will be reseted on next build.
// Test based on spectests/f32_cmp.wast
#![allow(
Expand Down
2 changes: 1 addition & 1 deletion src/spectests/f64_.rs
@@ -1,4 +1,4 @@
// Rust test file autogenerated with cargo build (src/build_spectests.rs).
// Rust test file autogenerated with cargo build (build/spectests.rs).
// Please do NOT modify it by hand, as it will be reseted on next build.
// Test based on spectests/f64_.wast
#![allow(
Expand Down
2 changes: 1 addition & 1 deletion src/spectests/f64_bitwise.rs
@@ -1,4 +1,4 @@
// Rust test file autogenerated with cargo build (src/build_spectests.rs).
// Rust test file autogenerated with cargo build (build/spectests.rs).
// Please do NOT modify it by hand, as it will be reseted on next build.
// Test based on spectests/f64_bitwise.wast
#![allow(
Expand Down
2 changes: 1 addition & 1 deletion src/spectests/f64_cmp.rs
@@ -1,4 +1,4 @@
// Rust test file autogenerated with cargo build (src/build_spectests.rs).
// Rust test file autogenerated with cargo build (build/spectests.rs).
// Please do NOT modify it by hand, as it will be reseted on next build.
// Test based on spectests/f64_cmp.wast
#![allow(
Expand Down
2 changes: 1 addition & 1 deletion src/spectests/fac.rs
@@ -1,4 +1,4 @@
// Rust test file autogenerated with cargo build (src/build_spectests.rs).
// Rust test file autogenerated with cargo build (build/spectests.rs).
// Please do NOT modify it by hand, as it will be reseted on next build.
// Test based on spectests/fac.wast
#![allow(
Expand Down
2 changes: 1 addition & 1 deletion src/spectests/float_exprs.rs
@@ -1,4 +1,4 @@
// Rust test file autogenerated with cargo build (src/build_spectests.rs).
// Rust test file autogenerated with cargo build (build/spectests.rs).
// Please do NOT modify it by hand, as it will be reseted on next build.
// Test based on spectests/float_exprs.wast
#![allow(
Expand Down
2 changes: 1 addition & 1 deletion src/spectests/float_literals.rs
@@ -1,4 +1,4 @@
// Rust test file autogenerated with cargo build (src/build_spectests.rs).
// Rust test file autogenerated with cargo build (build/spectests.rs).
// Please do NOT modify it by hand, as it will be reseted on next build.
// Test based on spectests/float_literals.wast
#![allow(
Expand Down
2 changes: 1 addition & 1 deletion src/spectests/float_memory.rs
@@ -1,4 +1,4 @@
// Rust test file autogenerated with cargo build (src/build_spectests.rs).
// Rust test file autogenerated with cargo build (build/spectests.rs).
// Please do NOT modify it by hand, as it will be reseted on next build.
// Test based on spectests/float_memory.wast
#![allow(
Expand Down
2 changes: 1 addition & 1 deletion src/spectests/float_misc.rs
@@ -1,4 +1,4 @@
// Rust test file autogenerated with cargo build (src/build_spectests.rs).
// Rust test file autogenerated with cargo build (build/spectests.rs).
// Please do NOT modify it by hand, as it will be reseted on next build.
// Test based on spectests/float_misc.wast
#![allow(
Expand Down
2 changes: 1 addition & 1 deletion src/spectests/forward.rs
@@ -1,4 +1,4 @@
// Rust test file autogenerated with cargo build (src/build_spectests.rs).
// Rust test file autogenerated with cargo build (build/spectests.rs).
// Please do NOT modify it by hand, as it will be reseted on next build.
// Test based on spectests/forward.wast
#![allow(
Expand Down
2 changes: 1 addition & 1 deletion src/spectests/func.rs
@@ -1,4 +1,4 @@
// Rust test file autogenerated with cargo build (src/build_spectests.rs).
// Rust test file autogenerated with cargo build (build/spectests.rs).
// Please do NOT modify it by hand, as it will be reseted on next build.
// Test based on spectests/func.wast
#![allow(
Expand Down
2 changes: 1 addition & 1 deletion src/spectests/func_ptrs.rs
@@ -1,4 +1,4 @@
// Rust test file autogenerated with cargo build (src/build_spectests.rs).
// Rust test file autogenerated with cargo build (build/spectests.rs).
// Please do NOT modify it by hand, as it will be reseted on next build.
// Test based on spectests/func_ptrs.wast
#![allow(
Expand Down
2 changes: 1 addition & 1 deletion src/spectests/get_local.rs
@@ -1,4 +1,4 @@
// Rust test file autogenerated with cargo build (src/build_spectests.rs).
// Rust test file autogenerated with cargo build (build/spectests.rs).
// Please do NOT modify it by hand, as it will be reseted on next build.
// Test based on spectests/get_local.wast
#![allow(
Expand Down
2 changes: 1 addition & 1 deletion src/spectests/globals.rs
@@ -1,4 +1,4 @@
// Rust test file autogenerated with cargo build (src/build_spectests.rs).
// Rust test file autogenerated with cargo build (build/spectests.rs).
// Please do NOT modify it by hand, as it will be reseted on next build.
// Test based on spectests/globals.wast
#![allow(
Expand Down
2 changes: 1 addition & 1 deletion src/spectests/i32_.rs
@@ -1,4 +1,4 @@
// Rust test file autogenerated with cargo build (src/build_spectests.rs).
// Rust test file autogenerated with cargo build (build/spectests.rs).
// Please do NOT modify it by hand, as it will be reseted on next build.
// Test based on spectests/i32_.wast
#![allow(
Expand Down
2 changes: 1 addition & 1 deletion src/spectests/i64_.rs
@@ -1,4 +1,4 @@
// Rust test file autogenerated with cargo build (src/build_spectests.rs).
// Rust test file autogenerated with cargo build (build/spectests.rs).
// Please do NOT modify it by hand, as it will be reseted on next build.
// Test based on spectests/i64_.wast
#![allow(
Expand Down
2 changes: 1 addition & 1 deletion src/spectests/if_.rs
@@ -1,4 +1,4 @@
// Rust test file autogenerated with cargo build (src/build_spectests.rs).
// Rust test file autogenerated with cargo build (build/spectests.rs).
// Please do NOT modify it by hand, as it will be reseted on next build.
// Test based on spectests/if_.wast
#![allow(
Expand Down
2 changes: 1 addition & 1 deletion src/spectests/int_exprs.rs
@@ -1,4 +1,4 @@
// Rust test file autogenerated with cargo build (src/build_spectests.rs).
// Rust test file autogenerated with cargo build (build/spectests.rs).
// Please do NOT modify it by hand, as it will be reseted on next build.
// Test based on spectests/int_exprs.wast
#![allow(
Expand Down
2 changes: 1 addition & 1 deletion src/spectests/int_literals.rs
@@ -1,4 +1,4 @@
// Rust test file autogenerated with cargo build (src/build_spectests.rs).
// Rust test file autogenerated with cargo build (build/spectests.rs).
// Please do NOT modify it by hand, as it will be reseted on next build.
// Test based on spectests/int_literals.wast
#![allow(
Expand Down
2 changes: 1 addition & 1 deletion src/spectests/labels.rs
@@ -1,4 +1,4 @@
// Rust test file autogenerated with cargo build (src/build_spectests.rs).
// Rust test file autogenerated with cargo build (build/spectests.rs).
// Please do NOT modify it by hand, as it will be reseted on next build.
// Test based on spectests/labels.wast
#![allow(
Expand Down
2 changes: 1 addition & 1 deletion src/spectests/left_to_right.rs
@@ -1,4 +1,4 @@
// Rust test file autogenerated with cargo build (src/build_spectests.rs).
// Rust test file autogenerated with cargo build (build/spectests.rs).
// Please do NOT modify it by hand, as it will be reseted on next build.
// Test based on spectests/left_to_right.wast
#![allow(
Expand Down
2 changes: 1 addition & 1 deletion src/spectests/loop_.rs
@@ -1,4 +1,4 @@
// Rust test file autogenerated with cargo build (src/build_spectests.rs).
// Rust test file autogenerated with cargo build (build/spectests.rs).
// Please do NOT modify it by hand, as it will be reseted on next build.
// Test based on spectests/loop_.wast
#![allow(
Expand Down
2 changes: 1 addition & 1 deletion src/spectests/memory.rs
@@ -1,4 +1,4 @@
// Rust test file autogenerated with cargo build (src/build_spectests.rs).
// Rust test file autogenerated with cargo build (build/spectests.rs).
// Please do NOT modify it by hand, as it will be reseted on next build.
// Test based on spectests/memory.wast
#![allow(
Expand Down
2 changes: 1 addition & 1 deletion src/spectests/memory_grow.rs
@@ -1,4 +1,4 @@
// Rust test file autogenerated with cargo build (src/build_spectests.rs).
// Rust test file autogenerated with cargo build (build/spectests.rs).
// Please do NOT modify it by hand, as it will be reseted on next build.
// Test based on spectests/memory_grow.wast
#![allow(
Expand Down
2 changes: 1 addition & 1 deletion src/spectests/memory_redundancy.rs
@@ -1,4 +1,4 @@
// Rust test file autogenerated with cargo build (src/build_spectests.rs).
// Rust test file autogenerated with cargo build (build/spectests.rs).
// Please do NOT modify it by hand, as it will be reseted on next build.
// Test based on spectests/memory_redundancy.wast
#![allow(
Expand Down
2 changes: 1 addition & 1 deletion src/spectests/memory_trap.rs
@@ -1,4 +1,4 @@
// Rust test file autogenerated with cargo build (src/build_spectests.rs).
// Rust test file autogenerated with cargo build (build/spectests.rs).
// Please do NOT modify it by hand, as it will be reseted on next build.
// Test based on spectests/memory_trap.wast
#![allow(
Expand Down
2 changes: 1 addition & 1 deletion src/spectests/mod.rs
@@ -1,4 +1,4 @@
// Rust test file autogenerated with cargo build (src/build_spectests.rs).
// Rust test file autogenerated with cargo build (build/spectests.rs).
// Please do NOT modify it by hand, as it will be reseted on next build.

// The _common module is not autogenerated, as it provides common functions for the spectests
Expand Down
2 changes: 1 addition & 1 deletion src/spectests/nop.rs
@@ -1,4 +1,4 @@
// Rust test file autogenerated with cargo build (src/build_spectests.rs).
// Rust test file autogenerated with cargo build (build/spectests.rs).
// Please do NOT modify it by hand, as it will be reseted on next build.
// Test based on spectests/nop.wast
#![allow(
Expand Down
2 changes: 1 addition & 1 deletion src/spectests/return_.rs
@@ -1,4 +1,4 @@
// Rust test file autogenerated with cargo build (src/build_spectests.rs).
// Rust test file autogenerated with cargo build (build/spectests.rs).
// Please do NOT modify it by hand, as it will be reseted on next build.
// Test based on spectests/return_.wast
#![allow(
Expand Down
2 changes: 1 addition & 1 deletion src/spectests/select.rs
@@ -1,4 +1,4 @@
// Rust test file autogenerated with cargo build (src/build_spectests.rs).
// Rust test file autogenerated with cargo build (build/spectests.rs).
// Please do NOT modify it by hand, as it will be reseted on next build.
// Test based on spectests/select.wast
#![allow(
Expand Down
2 changes: 1 addition & 1 deletion src/spectests/set_local.rs
@@ -1,4 +1,4 @@
// Rust test file autogenerated with cargo build (src/build_spectests.rs).
// Rust test file autogenerated with cargo build (build/spectests.rs).
// Please do NOT modify it by hand, as it will be reseted on next build.
// Test based on spectests/set_local.wast
#![allow(
Expand Down
2 changes: 1 addition & 1 deletion src/spectests/stack.rs
@@ -1,4 +1,4 @@
// Rust test file autogenerated with cargo build (src/build_spectests.rs).
// Rust test file autogenerated with cargo build (build/spectests.rs).
// Please do NOT modify it by hand, as it will be reseted on next build.
// Test based on spectests/stack.wast
#![allow(
Expand Down
2 changes: 1 addition & 1 deletion src/spectests/start.rs
@@ -1,4 +1,4 @@
// Rust test file autogenerated with cargo build (src/build_spectests.rs).
// Rust test file autogenerated with cargo build (build/spectests.rs).
// Please do NOT modify it by hand, as it will be reseted on next build.
// Test based on spectests/start.wast
#![allow(
Expand Down
2 changes: 1 addition & 1 deletion src/spectests/store_retval.rs
@@ -1,4 +1,4 @@
// Rust test file autogenerated with cargo build (src/build_spectests.rs).
// Rust test file autogenerated with cargo build (build/spectests.rs).
// Please do NOT modify it by hand, as it will be reseted on next build.
// Test based on spectests/store_retval.wast
#![allow(
Expand Down
2 changes: 1 addition & 1 deletion src/spectests/switch.rs
@@ -1,4 +1,4 @@
// Rust test file autogenerated with cargo build (src/build_spectests.rs).
// Rust test file autogenerated with cargo build (build/spectests.rs).
// Please do NOT modify it by hand, as it will be reseted on next build.
// Test based on spectests/switch.wast
#![allow(
Expand Down
2 changes: 1 addition & 1 deletion src/spectests/tee_local.rs
@@ -1,4 +1,4 @@
// Rust test file autogenerated with cargo build (src/build_spectests.rs).
// Rust test file autogenerated with cargo build (build/spectests.rs).
// Please do NOT modify it by hand, as it will be reseted on next build.
// Test based on spectests/tee_local.wast
#![allow(
Expand Down
2 changes: 1 addition & 1 deletion src/spectests/token.rs
@@ -1,4 +1,4 @@
// Rust test file autogenerated with cargo build (src/build_spectests.rs).
// Rust test file autogenerated with cargo build (build/spectests.rs).
// Please do NOT modify it by hand, as it will be reseted on next build.
// Test based on spectests/token.wast
#![allow(
Expand Down
2 changes: 1 addition & 1 deletion src/spectests/traps.rs
@@ -1,4 +1,4 @@
// Rust test file autogenerated with cargo build (src/build_spectests.rs).
// Rust test file autogenerated with cargo build (build/spectests.rs).
// Please do NOT modify it by hand, as it will be reseted on next build.
// Test based on spectests/traps.wast
#![allow(
Expand Down

0 comments on commit e58963d

Please sign in to comment.