Second part of the refactor

This commit is contained in:
Syrus 2020-04-15 16:31:05 -07:00
parent 2dc501822b
commit ce14c6c079
398 changed files with 2267 additions and 4507 deletions

26
Cargo.lock generated
View File

@ -766,6 +766,8 @@ name = "generate-wasi-tests"
version = "0.16.2" version = "0.16.2"
dependencies = [ dependencies = [
"glob 0.3.0", "glob 0.3.0",
"serde",
"serde_json",
"tempfile", "tempfile",
] ]
@ -2046,9 +2048,9 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
[[package]] [[package]]
name = "serde" name = "serde"
version = "1.0.105" version = "1.0.106"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e707fbbf255b8fc8c3b99abb91e7257a622caeb20a9818cbadbeeede4e0932ff" checksum = "36df6ac6412072f67cf767ebbde4133a5b2e88e76dc6187fa7104cd16f783399"
dependencies = [ dependencies = [
"serde_derive", "serde_derive",
] ]
@ -2074,9 +2076,9 @@ dependencies = [
[[package]] [[package]]
name = "serde_derive" name = "serde_derive"
version = "1.0.105" version = "1.0.106"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac5d00fc561ba2724df6758a17de23df5914f20e41cb00f94d5b7ae42fffaff8" checksum = "9e549e3abf4fb8621bd1609f11dfc9f5e50320802273b12f3811a67e6716ea6c"
dependencies = [ dependencies = [
"proc-macro2 1.0.9", "proc-macro2 1.0.9",
"quote 1.0.2", "quote 1.0.2",
@ -2258,6 +2260,18 @@ dependencies = [
"winapi 0.3.8", "winapi 0.3.8",
] ]
[[package]]
name = "test-case"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "199464148b42bcf3da8b2a56f6ee87ca68f47402496d1268849291ec9fb463c8"
dependencies = [
"proc-macro2 1.0.9",
"quote 1.0.2",
"syn 1.0.16",
"version_check",
]
[[package]] [[package]]
name = "test-generator" name = "test-generator"
version = "0.1.0" version = "0.1.0"
@ -2763,11 +2777,14 @@ dependencies = [
"generate-emscripten-tests", "generate-emscripten-tests",
"generate-wasi-tests", "generate-wasi-tests",
"glob 0.3.0", "glob 0.3.0",
"lazy_static",
"libc", "libc",
"log", "log",
"rustc_version", "rustc_version",
"serde", "serde",
"serde_json",
"structopt", "structopt",
"test-case",
"test-generator", "test-generator",
"typetag", "typetag",
"wabt", "wabt",
@ -2979,6 +2996,7 @@ dependencies = [
"libc", "libc",
"log", "log",
"serde", "serde",
"thiserror",
"time", "time",
"typetag", "typetag",
"wasmer-runtime-core", "wasmer-runtime-core",

View File

@ -27,16 +27,20 @@ fern = { version = "0.5", features = ["colored"], optional = true }
log = "0.4" log = "0.4"
structopt = "0.3" structopt = "0.3"
wabt = { version = "0.9.1", optional = true } wabt = { version = "0.9.1", optional = true }
wasmer = { path = "lib/api" } wasmer = { path = "lib/api", default-features = false }
wasmer-clif-backend = { path = "lib/clif-backend", optional = true }
wasmer-singlepass-backend = { path = "lib/singlepass-backend", optional = true }
wasmer-middleware-common = { path = "lib/middleware-common" } wasmer-middleware-common = { path = "lib/middleware-common" }
wasmer-runtime = { path = "lib/runtime" } wasmer-runtime = { path = "lib/runtime", default-features = false }
wasmer-runtime-core = { path = "lib/runtime-core" } wasmer-runtime-core = { path = "lib/runtime-core" }
wasmer-emscripten = { path = "lib/emscripten" }
wasmer-llvm-backend = { path = "lib/llvm-backend", optional = true }
wasmer-wasi = { path = "lib/wasi", optional = true }
wasmer-kernel-loader = { path = "lib/kernel-loader", optional = true } wasmer-kernel-loader = { path = "lib/kernel-loader", optional = true }
# Backends
wasmer-singlepass-backend = { path = "lib/singlepass-backend", optional = true }
wasmer-clif-backend = { path = "lib/clif-backend", optional = true }
wasmer-llvm-backend = { path = "lib/llvm-backend", optional = true }
# Frontends
wasmer-emscripten = { path = "lib/emscripten" }
wasmer-wasi = { path = "lib/wasi", optional = true }
wasmer-wasi-experimental-io-devices = { path = "lib/wasi-experimental-io-devices", optional = true } wasmer-wasi-experimental-io-devices = { path = "lib/wasi-experimental-io-devices", optional = true }
[workspace] [workspace]
@ -76,21 +80,25 @@ rustc_version = "0.2"
[dev-dependencies] [dev-dependencies]
anyhow = "1.0.19" anyhow = "1.0.19"
wasmer-wast = { path = "tests/wast" } wasmer-wast = { path = "tests/wast" }
lazy_static = "1.4.0"
# To allow parametrized tests
test-case = "1.0.0"
criterion = "0.3" criterion = "0.3"
glob = "0.3" glob = "0.3"
libc = "0.2.60" # for `tests/dev-utils`'s Stdout capturing libc = "0.2.60" # for `tests/dev-utils`'s Stdout capturing
serde = { version = "1", features = ["derive"] } # used by the plugin example serde = { version = "1", features = ["derive"] } # used by the plugin example
serde_json = "1"
typetag = "0.1" # used by the plugin example typetag = "0.1" # used by the plugin example
wabt = "0.9.1" wabt = "0.9.1"
[features] [features]
default = ["fast-tests", "wasi", "backend-cranelift", "wabt"] # Don't add the backend features in default, please add them on the Makefile
# since we might want to autoconfigure them depending on the availability on the host.
default = ["wasi", "wabt"]
"loader-kernel" = ["wasmer-kernel-loader"] "loader-kernel" = ["wasmer-kernel-loader"]
debug = ["fern", "log/max_level_debug", "log/release_max_level_debug"] debug = ["fern", "log/max_level_debug", "log/release_max_level_debug"]
trace = ["fern", "log/max_level_trace", "log/release_max_level_trace"] trace = ["fern", "log/max_level_trace", "log/release_max_level_trace"]
docs = ["wasmer-runtime/docs"] docs = ["wasmer-runtime/docs"]
# This feature will allow cargo test to run much faster
fast-tests = []
backend-cranelift = [ backend-cranelift = [
"wasmer-clif-backend", "wasmer-clif-backend",
"wasmer-clif-backend/generate-debug-information", "wasmer-clif-backend/generate-debug-information",

124
Makefile
View File

@ -1,5 +1,42 @@
.PHONY: spectests emtests clean build install lint precommit docs examples .PHONY: spectests emtests clean build install lint precommit docs examples
ARCH := $(shell uname -m)
backends :=
ifeq ($(ARCH), x86_64)
# In X64, Cranelift is enabled
backends += cranelift
# LLVM is enabled if not in Windows
ifneq ($(OS), Windows_NT)
LLVM_VERSION := $(shell llvm-config --version)
# If findstring is not empty, then it have found the value
ifneq (, $(findstring 9,$(LLVM_VERSION)))
backends += llvm
endif
endif
endif
backends := $(filter-out ,$(backends))
# Singlepass is enabled
RUST_VERSION := $(shell rustc -V)
ifneq (, $(findstring nightly,$(RUST_VERSION)))
backends += singlepass
endif
bold:=$(shell tput bold)
green:=$(shell tput setaf 2)
reset:=$(shell tput sgr0)
$(info Available backends for this host: $(bold)$(green)${backends}$(reset))
backend_features_spaced := $(foreach backend,$(backends),backend-$(backend))
backend_features := --features "$(backend_features_spaced)"
# $(info Cargo features ${backend_features})
# Generate files # Generate files
generate-emtests: generate-emtests:
WASM_EMSCRIPTEN_GENERATE_EMTESTS=1 cargo build --release \ WASM_EMSCRIPTEN_GENERATE_EMTESTS=1 cargo build --release \
@ -25,57 +62,53 @@ emtests-generate: generate-emtests
wasitests-generate: generate-wasitests wasitests-generate: generate-wasitests
wasitests-setup-toolchain: wasitests-setup wasitests-setup-toolchain: wasitests-setup
WASITESTS_SET_UP_TOOLCHAIN=1 cargo build --release -vv WASM_WASI_SET_UP_TOOLCHAIN=1 cargo build --release -vv
wasitests-setup-toolchain-all: wasitests-setup wasitests-setup-toolchain-all: wasitests-setup
WASI_TEST_GENERATE_ALL=1 WASITESTS_SET_UP_TOOLCHAIN=1 cargo build --release -vv WASI_TEST_GENERATE_ALL=1 WASM_WASI_SET_UP_TOOLCHAIN=1 cargo build --release -vv
generate: generate-emtests generate-wasitests generate: generate-emtests generate-wasitests
# Spectests # Spectests
spectests-singlepass: spectests-singlepass:
WASMER_TEST_SINGLEPASS=1 cargo test singlepass::spec --release --no-default-features --features "wasi backend-singlepass" -- --nocapture cargo test singlepass::spec --release $(backend_features)
spectests-cranelift: spectests-cranelift:
WASMER_TEST_CRANELFIT=1 cargo test cranelift::spec --release --no-default-features --features "wasi backend-cranelift" -- --nocapture cargo test cranelift::spec --release $(backend_features)
spectests-llvm: spectests-llvm:
WASMER_TEST_LLVM=1 cargo test llvm::spec --release --no-default-features --features "wasi backend-llvm wasmer-llvm-backend/test" -- --nocapture --test-threads=1 cargo test llvm::spec --release $(backend_features) -- --test-threads=1
spectests-all: spectests:
WASMER_TEST_CRANELIFT=1 WASMER_TEST_LLVM=1 WASMER_TEST_SINGLEPASS=1 \ cargo test spec --release $(backend_features) -- --test-threads=1
cargo test spec --release --no-default-features --features "wasi backend-cranelift backend-singlepass backend-llvm wasmer-llvm-backend/test"
spectests: spectests-singlepass spectests-cranelift spectests-llvm
# Emscripten tests # Emscripten tests
emtests-singlepass: emtests-singlepass:
WASMER_TEST_SINGLEPASS=1 cargo test emtest --release --no-default-features --features "wasi backend-singlepass" -- --test-threads=1 cargo test singlepass::emscripten --release $(backend_features)
emtests-cranelift: emtests-cranelift:
WASMER_TEST_CRANELIFT=1 cargo test emtest --release --no-default-features --features "wasi backend-cranelift" -- --test-threads=1 cargo test cranelift::emscripten --release $(backend_features)
emtests-llvm: emtests-llvm:
WASMER_TEST_LLVM=1 cargo test emtest --release --no-default-features --features "wasi backend-llvm" -- --test-threads=1 cargo test llvm::emscripten --release $(backend_features) -- --test-threads=1
emtests-unit: emtests-all:
cargo test emscripten --release cargo test emscripten --release $(backend_features) -- --test-threads=1
emtests: emtests-unit emtests-singlepass emtests-cranelift emtests-llvm emtests: emtests-singlepass emtests-cranelift emtests-llvm
# Middleware tests # Middleware tests
middleware-singlepass: middleware-singlepass:
cargo test middleware --release --no-default-features --features "wasi backend-singlepass" cargo test middleware::singlepass --release $(backend_features)
middleware-cranelift: middleware-cranelift:
cargo test middleware --release --no-default-features --features "wasi backend-cranelift" cargo test middleware::cranelift --release $(backend_features)
middleware-llvm: middleware-llvm:
cargo test middleware --release --no-default-features --features "wasi backend-llvm" cargo test middleware::llvm --release $(backend_features)
middleware: middleware-singlepass middleware-cranelift middleware-llvm middleware: middleware-singlepass middleware-cranelift middleware-llvm
@ -86,13 +119,16 @@ wasitests-setup:
mkdir -p tests/wasi_test_resources/test_fs/temp mkdir -p tests/wasi_test_resources/test_fs/temp
wasitests-singlepass: wasitests-setup wasitests-singlepass: wasitests-setup
WASMER_TEST_SINGLEPASS=1 cargo test wasitest --release --no-default-features --features "wasi backend-singlepass" -- --test-threads=1 cargo test wasi::singlepass --release $(backend_features) -- --test-threads=1
wasitests-cranelift: wasitests-setup wasitests-cranelift: wasitests-setup
WASMER_TEST_CRANELIFT=1 cargo test wasitest --release --no-default-features --features "wasi backend-cranelift" -- --test-threads=1 --nocapture cargo test wasi::cranelift --release $(backend_features) -- --test-threads=1 --nocapture
wasitests-llvm: wasitests-setup wasitests-llvm: wasitests-setup
WASMER_TEST_LLVM=1 cargo test wasitest --release --no-default-features --features "wasi backend-llvm" -- --test-threads=1 cargo test wasi::llvm --release $(backend_features) -- --test-threads=1
wasitests-all: wasitests-setup
cargo test wasi --release $(backend_features) -- --test-threads=1
wasitests-unit: wasitests-setup wasitests-unit: wasitests-setup
cargo test --manifest-path lib/wasi/Cargo.toml --release cargo test --manifest-path lib/wasi/Cargo.toml --release
@ -103,15 +139,15 @@ wasitests: wasitests-unit wasitests-singlepass wasitests-cranelift wasitests-llv
# Backends # Backends
singlepass: wasitests-setup singlepass: wasitests-setup
cargo test -p wasmer-singlepass-backend --release cargo test -p wasmer-singlepass-backend --release
WASMER_TEST_SINGLEPASS=1 cargo test --release --no-default-features --features "wasi backend-singlepass" -- --test-threads=1 cargo test singlepass --release $(backend_features)
cranelift: wasitests-setup cranelift: wasitests-setup
cargo test -p wasmer-clif-backend --release cargo test -p wasmer-clif-backend --release
WASMER_TEST_CRANELIFT=1 cargo test --release --no-default-features --features "wasi backend-cranelift" -- --test-threads=1 cargo test cranelift --release $(backend_features)
llvm: wasitests-setup llvm: wasitests-setup
cargo test -p wasmer-llvm-backend --release cargo test -p wasmer-llvm-backend --release
WASMER_TEST_LLVM=1 cargo test --release --no-default-features --features "wasi backend-llvm" -- --test-threads=1 cargo test llvm --release $(backend_features) -- --test-threads=1
# All tests # All tests
@ -163,7 +199,7 @@ test-rest:
cargo test --release -p wasmer-wasi-experimental-io-devices cargo test --release -p wasmer-wasi-experimental-io-devices
cargo test --release -p wasmer-win-exception-handler cargo test --release -p wasmer-win-exception-handler
test: spectests emtests middleware wasitests test-rest examples test: singlepass cranelift llvm test-rest examples
test-android: test-android:
ci/run-docker.sh x86_64-linux-android --manifest-path=lib/singlepass-backend/Cargo.toml ci/run-docker.sh x86_64-linux-android --manifest-path=lib/singlepass-backend/Cargo.toml
@ -188,20 +224,20 @@ lint:
precommit: lint test precommit: lint test
debug: debug:
cargo build --release --features backend-cranelift,backend-singlepass,debug,trace cargo build --release --features "debug trace"
install: install:
cargo install --path . cargo install --path .
# Checks # Checks
check-bench-singlepass: check-bench-singlepass:
cargo check --benches --all --no-default-features --features "backend-singlepass" \ cargo check --benches --all singlepass \
--exclude wasmer-clif-backend --exclude wasmer-llvm-backend --exclude wasmer-kernel-loader --exclude wasmer-clif-backend --exclude wasmer-llvm-backend --exclude wasmer-kernel-loader
check-bench-clif: check-bench-clif:
cargo check --benches --all --no-default-features --features "backend-cranelift" \ cargo check --benches --all cranelift \
--exclude wasmer-singlepass-backend --exclude wasmer-llvm-backend --exclude wasmer-kernel-loader --exclude wasmer-singlepass-backend --exclude wasmer-llvm-backend --exclude wasmer-kernel-loader
check-bench-llvm: check-bench-llvm:
cargo check --benches --all --no-default-features --features "backend-llvm" \ cargo check --benches --all llvm \
--exclude wasmer-singlepass-backend --exclude wasmer-clif-backend --exclude wasmer-kernel-loader --exclude wasmer-singlepass-backend --exclude wasmer-clif-backend --exclude wasmer-kernel-loader
check-bench: check-bench-singlepass check-bench-llvm check-bench: check-bench-singlepass check-bench-llvm
@ -270,7 +306,7 @@ check: check-bench
# Release # Release
release: release:
cargo build --release --features backend-singlepass,backend-cranelift,backend-llvm,loader-kernel,experimental-io-devices,log/release_max_level_off cargo build --release $(backend_features) --features loader-kernel,experimental-io-devices,log/release_max_level_off
# Release with musl target # Release with musl target
release-musl: release-musl:
@ -278,28 +314,28 @@ release-musl:
# experimental-io-devices is not included due to missing x11-fb. # experimental-io-devices is not included due to missing x11-fb.
cargo build --release --target x86_64-unknown-linux-musl --features backend-singlepass,backend-cranelift,loader-kernel,log/release_max_level_off,wasi --no-default-features cargo build --release --target x86_64-unknown-linux-musl --features backend-singlepass,backend-cranelift,loader-kernel,log/release_max_level_off,wasi --no-default-features
# Only one backend (cranelift) # This way of releasing is deprecated, since backends are now detected
release-clif: # automatically
# If you are on macOS, you will need mingw-w64 for cross compiling to Windows release-clif: release
# brew install mingw-w64
cargo build --release --features backend-cranelift
release-singlepass: # This way of releasing is deprecated, since backends are now detected
cargo build --release --features backend-singlepass # automatically
release-singlepass: release
release-llvm: # This way of releasing is deprecated, since backends are now detected
cargo build --release --features backend-llvm,experimental-io-devices # automatically
release-llvm: release
bench-singlepass: bench-singlepass:
# NOTE this will run some benchmarks using clif; TODO: fix this # NOTE this will run some benchmarks using clif; TODO: fix this
cargo bench --all --no-default-features --features "backend-singlepass" \ cargo bench --all singlepass \
--exclude wasmer-clif-backend --exclude wasmer-llvm-backend --exclude wasmer-kernel-loader --exclude wasmer-clif-backend --exclude wasmer-llvm-backend --exclude wasmer-kernel-loader
bench-clif: bench-clif:
cargo bench --all --no-default-features --features "backend-cranelift" \ cargo bench --all cranelift \
--exclude wasmer-singlepass-backend --exclude wasmer-llvm-backend --exclude wasmer-kernel-loader --exclude wasmer-singlepass-backend --exclude wasmer-llvm-backend --exclude wasmer-kernel-loader
bench-llvm: bench-llvm:
# NOTE this will run some benchmarks using clif; TODO: fix this # NOTE this will run some benchmarks using clif; TODO: fix this
cargo bench --all --no-default-features --features "backend-llvm" \ cargo bench --all llvm \
--exclude wasmer-singlepass-backend --exclude wasmer-clif-backend --exclude wasmer-kernel-loader --exclude wasmer-singlepass-backend --exclude wasmer-clif-backend --exclude wasmer-kernel-loader
build-install-package: build-install-package:

228
build.rs
View File

@ -5,15 +5,19 @@
use generate_emscripten_tests; use generate_emscripten_tests;
use generate_wasi_tests; use generate_wasi_tests;
use std::env; use std::env;
use std::fmt::Write;
use std::fs; use std::fs;
use std::path::PathBuf; use std::path::PathBuf;
use std::process::Command; use std::process::Command;
use test_generator::{ use test_generator::{
build_ignores_from_textfile, extract_name, test_directory, test_directory_module, build_ignores_from_textfile, extract_name, test_directory, test_directory_module,
with_test_module, Test, Testsuite, with_backends, with_test_module, Test, Testsuite,
}; };
static EMTESTS_ENV_VAR: &str = "WASM_EMSCRIPTEN_GENERATE_EMTESTS";
static WASITESTS_ENV_VAR: &str = "WASM_WASI_GENERATE_WASITESTS";
static WASITESTS_SET_UP_TOOLCHAIN: &str = "WASM_WASI_SET_UP_TOOLCHAIN";
static WASITESTS_GENERATE_ALL: &str = "WASI_TEST_GENERATE_ALL";
/// Given a Testsuite and a path, process the path in case is a wast /// Given a Testsuite and a path, process the path in case is a wast
/// file. /// file.
fn wast_processor(out: &mut Testsuite, p: PathBuf) -> Option<Test> { fn wast_processor(out: &mut Testsuite, p: PathBuf) -> Option<Test> {
@ -41,71 +45,199 @@ fn wast_processor(out: &mut Testsuite, p: PathBuf) -> Option<Test> {
}) })
} }
/// Given a Testsuite and a path, process the path in case is a Emscripten
/// wasm file.
fn emscripten_processor(out: &mut Testsuite, p: PathBuf) -> Option<Test> {
let ext = p.extension()?;
// Only look at wast files.
if ext != "wasm" {
return None;
}
let outfile = {
let mut out_ext = p.clone();
out_ext.set_extension("out");
// let mut txt_ext = p.clone();
// txt_ext.set_extension("txt");
if out_ext.exists() {
out_ext
}
// else if txt_ext.exists() {
// txt_ext
// }
else {
return None;
}
};
let testname = extract_name(&p);
let compiler = out.path.get(0).unwrap();
let body = format!(
"crate::run_emscripten(r#\"{}\"#, r#\"{}\"#, \"{}\")",
p.display(),
outfile.display(),
compiler
);
Some(Test {
name: testname.to_string(),
body: body.to_string(),
})
}
/// Given a Testsuite and a path, process the path in case is a WASI
/// wasm file.
fn wasi_processor(out: &mut Testsuite, p: PathBuf) -> Option<Test> {
let ext = p.extension()?;
// Only look at wast files.
if ext != "wasm" {
return None;
}
let outfile = {
let mut out_ext = p.clone();
out_ext.set_extension("out");
// let mut txt_ext = p.clone();
// txt_ext.set_extension("txt");
if out_ext.exists() {
out_ext
}
// else if txt_ext.exists() {
// txt_ext
// }
else {
return None;
}
};
let testname = extract_name(&p);
let compiler = out.path.get(0).unwrap();
let body = format!(
"crate::run_wasi(r#\"{}\"#, r#\"{}\"#, \"{}\")",
p.display(),
outfile.display(),
compiler
);
Some(Test {
name: testname.to_string(),
body: body.to_string(),
})
}
fn is_truthy_env(name: &str) -> bool {
env::var(name).unwrap_or("0".to_string()) == "1"
}
fn main() -> anyhow::Result<()> { fn main() -> anyhow::Result<()> {
// println!("cargo:rustc-cfg=feature=\"backend-cranelift\"");
println!("cargo:rerun-if-changed=build.rs"); println!("cargo:rerun-if-changed=build.rs");
println!("cargo:rerun-if-changed=test/ignores.txt"); println!("cargo:rerun-if-changed=test/ignores.txt");
println!("cargo:rerun-if-env-changed={}", EMTESTS_ENV_VAR);
println!("cargo:rerun-if-env-changed={}", WASITESTS_ENV_VAR);
println!("cargo:rerun-if-env-changed={}", WASITESTS_SET_UP_TOOLCHAIN);
println!("cargo:rerun-if-env-changed={}", WASITESTS_GENERATE_ALL);
generate_wasi_tests::build(); let wasi_versions = if is_truthy_env(WASITESTS_GENERATE_ALL) {
generate_wasi_tests::ALL_WASI_VERSIONS
} else {
generate_wasi_tests::LATEST_WASI_VERSION
};
// Install the Rust WASI toolchains for each of the versions
if is_truthy_env(WASITESTS_SET_UP_TOOLCHAIN) {
generate_wasi_tests::install_toolchains(wasi_versions);
}
// Generate the WASI Wasm files
if is_truthy_env(WASITESTS_ENV_VAR) {
generate_wasi_tests::build(wasi_versions);
}
// Generate Emscripten Wasm files
if is_truthy_env(EMTESTS_ENV_VAR) {
generate_emscripten_tests::build(); generate_emscripten_tests::build();
}
let out_dir = PathBuf::from( let out_dir = PathBuf::from(
env::var_os("OUT_DIR").expect("The OUT_DIR environment variable must be set"), env::var_os("OUT_DIR").expect("The OUT_DIR environment variable must be set"),
); );
let ignores = build_ignores_from_textfile("tests/ignores.txt".into())?; let ignores = build_ignores_from_textfile("tests/ignores.txt".into())?;
let mut out = Testsuite {
// Spectests test generation
let mut spectests = Testsuite {
buffer: String::new(), buffer: String::new(),
path: vec![], path: vec![],
ignores: ignores, ignores: ignores.clone(),
}; };
let backends = vec!["singlepass", "cranelift", "llvm"];
for compiler in &["singlepass", "cranelift", "llvm"] { with_backends(&mut spectests, &backends, |mut spectests| {
writeln!(out.buffer, "#[cfg(feature=\"backend-{}\")]", compiler); with_test_module(&mut spectests, "spec", |spectests| {
writeln!(out.buffer, "#[cfg(test)]")?; let _spec_tests = test_directory(spectests, "tests/spectests", wast_processor)?;
writeln!(out.buffer, "#[allow(non_snake_case)]")?;
with_test_module(&mut out, compiler, |mut out| {
with_test_module(&mut out, "spec", |out| {
let spec_tests = test_directory(out, "tests/spectests", wast_processor)?;
// Skip running spec_testsuite tests if the submodule isn't checked
// out.
// if spec_tests > 0 {
// test_directory_module(
// out,
// "tests/spec_testsuite/proposals/simd",
// wast_processor,
// )?;
// test_directory_module(
// out,
// "tests/spec_testsuite/proposals/multi-value",
// wast_processor,
// )?;
// test_directory_module(
// out,
// "tests/spec_testsuite/proposals/reference-types",
// wast_processor,
// )?;
// test_directory_module(
// out,
// "tests/spec_testsuite/proposals/bulk-memory-operations",
// wast_processor,
// )?;
// } else {
// println!(
// "cargo:warning=The spec testsuite is disabled. To enable, run `git submodule \
// update --remote`."
// );
// }
Ok(()) Ok(())
})?; })?;
Ok(()) Ok(())
})?; })?;
}
// println!("{}", out.buffer); // Emscripten tests generation
// std::process::exit(1); let mut emtests = Testsuite {
buffer: String::new(),
path: vec![],
ignores: ignores.clone(),
};
with_backends(&mut emtests, &backends, |mut emtests| {
with_test_module(&mut emtests, "emscripten", |emtests| {
let _emscripten_tests = test_directory(
emtests,
"tests/emscripten_resources/emtests",
emscripten_processor,
)?;
Ok(())
})?;
Ok(())
})?;
// WASI tests generation
let mut wasitests = Testsuite {
buffer: String::new(),
path: vec![],
ignores: ignores.clone(),
};
with_backends(&mut wasitests, &backends, |mut wasitests| {
with_test_module(&mut wasitests, "wasi", |wasitests| {
test_directory_module(
wasitests,
"tests/wasi_test_resources/unstable",
wasi_processor,
)?;
test_directory_module(
wasitests,
"tests/wasi_test_resources/snapshot1",
wasi_processor,
)?;
Ok(())
})?;
Ok(())
})?;
let spectests_output = out_dir.join("generated_spectests.rs");
fs::write(&spectests_output, spectests.buffer)?;
let emtests_output = out_dir.join("generated_emtests.rs");
fs::write(&emtests_output, emtests.buffer)?;
// println!("WASI: {}", wasitests.buffer);
let wasitests_output = out_dir.join("generated_wasitests.rs");
fs::write(&wasitests_output, wasitests.buffer)?;
// Write out our auto-generated tests and opportunistically format them with // Write out our auto-generated tests and opportunistically format them with
// `rustfmt` if it's installed. // `rustfmt` if it's installed.
let output = out_dir.join("generated_tests.rs"); // Note: We need drop because we don't want to run `unwrap` or `expect` as
fs::write(&output, out.buffer)?; // the command might fail, but we don't care about it's result.
Command::new("rustfmt").arg(&output).status(); drop(Command::new("rustfmt").arg(&spectests_output).status());
drop(Command::new("rustfmt").arg(&emtests_output).status());
drop(Command::new("rustfmt").arg(&wasitests_output).status());
Ok(()) Ok(())
} }

View File

@ -208,6 +208,13 @@ impl Default for Backend {
#[cfg(all(feature = "default-backend-llvm", not(feature = "docs")))] #[cfg(all(feature = "default-backend-llvm", not(feature = "docs")))]
return Backend::LLVM; return Backend::LLVM;
#[cfg(not(any(
feature = "default-backend-singlepass",
feature = "default-backend-cranelift",
feature = "default-backend-llvm",
)))]
panic!("There is no default-backend set.");
} }
} }
@ -241,7 +248,7 @@ impl std::str::FromStr for Backend {
/// # Errors: /// # Errors:
/// If the operation fails, the function returns `Err(error::CompileError::...)`. /// If the operation fails, the function returns `Err(error::CompileError::...)`.
pub fn compile(wasm: &[u8]) -> error::CompileResult<Module> { pub fn compile(wasm: &[u8]) -> error::CompileResult<Module> {
wasmer_runtime_core::compile_with(&wasm[..], &default_compiler()) wasmer_runtime_core::compile_with(&wasm[..], &*default_compiler())
} }
/// The same as `compile` but takes a `CompilerConfig` for the purpose of /// The same as `compile` but takes a `CompilerConfig` for the purpose of
@ -250,7 +257,7 @@ pub fn compile_with_config(
wasm: &[u8], wasm: &[u8],
compiler_config: CompilerConfig, compiler_config: CompilerConfig,
) -> error::CompileResult<Module> { ) -> error::CompileResult<Module> {
wasmer_runtime_core::compile_with_config(&wasm[..], &default_compiler(), compiler_config) wasmer_runtime_core::compile_with_config(&wasm[..], &*default_compiler(), compiler_config)
} }
/// The same as `compile_with_config` but takes a `Compiler` for the purpose of /// The same as `compile_with_config` but takes a `Compiler` for the purpose of
@ -291,7 +298,7 @@ pub fn instantiate(wasm: &[u8], import_object: &ImportObject) -> error::Result<I
/// The output of this function can be controlled by the mutually /// The output of this function can be controlled by the mutually
/// exclusive `default-backend-llvm`, `default-backend-singlepass`, /// exclusive `default-backend-llvm`, `default-backend-singlepass`,
/// and `default-backend-cranelift` feature flags. /// and `default-backend-cranelift` feature flags.
pub fn default_compiler() -> impl Compiler { pub fn default_compiler() -> Box<dyn Compiler> {
#[cfg(any( #[cfg(any(
all( all(
feature = "default-backend-llvm", feature = "default-backend-llvm",
@ -320,7 +327,19 @@ pub fn default_compiler() -> impl Compiler {
#[cfg(any(feature = "default-backend-cranelift", feature = "docs"))] #[cfg(any(feature = "default-backend-cranelift", feature = "docs"))]
use wasmer_clif_backend::CraneliftCompiler as DefaultCompiler; use wasmer_clif_backend::CraneliftCompiler as DefaultCompiler;
DefaultCompiler::new() #[cfg(any(
feature = "default-backend-singlepass",
feature = "default-backend-cranelift",
feature = "default-backend-llvm",
))]
return Box::new(DefaultCompiler::new());
#[cfg(not(any(
feature = "default-backend-singlepass",
feature = "default-backend-cranelift",
feature = "default-backend-llvm",
)))]
panic!("There is no default-compiler set.");
} }
/// Get the `Compiler` as a trait object for the given `Backend`. /// Get the `Compiler` as a trait object for the given `Backend`.
@ -350,6 +369,13 @@ pub fn compiler_for_backend(backend: Backend) -> Option<Box<dyn Compiler>> {
return Some(Box::new(wasmer_clif_backend::CraneliftCompiler::new())); return Some(Box::new(wasmer_clif_backend::CraneliftCompiler::new()));
#[cfg(feature = "default-backend-llvm")] #[cfg(feature = "default-backend-llvm")]
return Some(Box::new(wasmer_llvm_backend::LLVMCompiler::new())); return Some(Box::new(wasmer_llvm_backend::LLVMCompiler::new()));
#[cfg(not(any(
feature = "default-backend-singlepass",
feature = "default-backend-cranelift",
feature = "default-backend-llvm",
)))]
panic!("There is no default-compiler set.");
} }
} }
} }

View File

@ -12,6 +12,7 @@ edition = "2018"
[dependencies] [dependencies]
bincode = "1" bincode = "1"
byteorder = "1.3" byteorder = "1.3"
thiserror = "1.0.15"
generational-arena = { version = "0.2", features = ["serde"] } generational-arena = { version = "0.2", features = ["serde"] }
libc = "0.2.60" libc = "0.2.60"
log = "0.4" log = "0.4"

View File

@ -3,6 +3,7 @@
use crate::state::{WasiFile, WasiFs, WasiFsError, WasiState}; use crate::state::{WasiFile, WasiFs, WasiFsError, WasiState};
use crate::syscalls::types::{__WASI_STDERR_FILENO, __WASI_STDIN_FILENO, __WASI_STDOUT_FILENO}; use crate::syscalls::types::{__WASI_STDERR_FILENO, __WASI_STDIN_FILENO, __WASI_STDOUT_FILENO};
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use thiserror::Error;
/// Creates an empty [`WasiStateBuilder`]. /// Creates an empty [`WasiStateBuilder`].
/// ///
@ -56,15 +57,23 @@ impl std::fmt::Debug for WasiStateBuilder {
} }
/// Error type returned when bad data is given to [`WasiStateBuilder`]. /// Error type returned when bad data is given to [`WasiStateBuilder`].
#[derive(Debug, PartialEq, Eq)] #[derive(Error, Debug, PartialEq, Eq)]
pub enum WasiStateCreationError { pub enum WasiStateCreationError {
#[error("bad environment variable format: `{0}`")]
EnvironmentVariableFormatError(String), EnvironmentVariableFormatError(String),
#[error("argument contains null byte: `{0}`")]
ArgumentContainsNulByte(String), ArgumentContainsNulByte(String),
#[error("preopened directory not found: `{0}`")]
PreopenedDirectoryNotFound(PathBuf), PreopenedDirectoryNotFound(PathBuf),
#[error("preopened directory error: `{0}`")]
PreopenedDirectoryError(String), PreopenedDirectoryError(String),
#[error("mapped dir alias has wrong format: `{0}`")]
MappedDirAliasFormattingError(String), MappedDirAliasFormattingError(String),
#[error("wasi filesystem creation error: `{0}`")]
WasiFsCreationError(String), WasiFsCreationError(String),
#[error("wasi filesystem setup error: `{0}`")]
WasiFsSetupError(String), WasiFsSetupError(String),
#[error(transparent)]
WasiFsError(WasiFsError), WasiFsError(WasiFsError),
} }

View File

@ -9,60 +9,84 @@ use std::{
path::PathBuf, path::PathBuf,
time::SystemTime, time::SystemTime,
}; };
use thiserror::Error;
/// Error type for external users /// Error type for external users
#[derive(Copy, Clone, Debug, PartialEq, Eq)] #[derive(Error, Copy, Clone, Debug, PartialEq, Eq)]
#[allow(dead_code)] #[allow(dead_code)]
// dead code beacuse this is for external use // dead code beacuse this is for external use
pub enum WasiFsError { pub enum WasiFsError {
/// The fd given as a base was not a directory so the operation was not possible /// The fd given as a base was not a directory so the operation was not possible
#[error("fd not a directory")]
BaseNotDirectory, BaseNotDirectory,
/// Expected a file but found not a file /// Expected a file but found not a file
#[error("fd not a file")]
NotAFile, NotAFile,
/// The fd given was not usable /// The fd given was not usable
#[error("invalid fd")]
InvalidFd, InvalidFd,
/// File exists /// File exists
#[error("file exists")]
AlreadyExists, AlreadyExists,
/// Something failed when doing IO. These errors can generally not be handled. /// Something failed when doing IO. These errors can generally not be handled.
/// It may work if tried again. /// It may work if tried again.
#[error("io error")]
IOError, IOError,
/// The address was in use /// The address was in use
#[error("address is in use")]
AddressInUse, AddressInUse,
/// The address could not be found /// The address could not be found
#[error("address could not be found")]
AddressNotAvailable, AddressNotAvailable,
/// A pipe was closed /// A pipe was closed
#[error("broken pipe (was closed)")]
BrokenPipe, BrokenPipe,
/// The connection was aborted /// The connection was aborted
#[error("connection aborted")]
ConnectionAborted, ConnectionAborted,
/// The connection request was refused /// The connection request was refused
#[error("connection refused")]
ConnectionRefused, ConnectionRefused,
/// The connection was reset /// The connection was reset
#[error("connection reset")]
ConnectionReset, ConnectionReset,
/// The operation was interrupted before it could finish /// The operation was interrupted before it could finish
#[error("operation interrupted")]
Interrupted, Interrupted,
/// Invalid internal data, if the argument data is invalid, use `InvalidInput` /// Invalid internal data, if the argument data is invalid, use `InvalidInput`
#[error("invalid internal data")]
InvalidData, InvalidData,
/// The provided data is invalid /// The provided data is invalid
#[error("invalid input")]
InvalidInput, InvalidInput,
/// Could not perform the operation because there was not an open connection /// Could not perform the operation because there was not an open connection
#[error("connection is not open")]
NotConnected, NotConnected,
/// The requested file or directory could not be found /// The requested file or directory could not be found
#[error("entity not found")]
EntityNotFound, EntityNotFound,
/// The requested device couldn't be accessed /// The requested device couldn't be accessed
#[error("can't access device")]
NoDevice, NoDevice,
/// Caller was not allowed to perform this operation /// Caller was not allowed to perform this operation
#[error("permission denied")]
PermissionDenied, PermissionDenied,
/// The operation did not complete within the given amount of time /// The operation did not complete within the given amount of time
#[error("time out")]
TimedOut, TimedOut,
/// Found EOF when EOF was not expected /// Found EOF when EOF was not expected
#[error("unexpected eof")]
UnexpectedEof, UnexpectedEof,
/// Operation would block, this error lets the caller know that they can try again /// Operation would block, this error lets the caller know that they can try again
#[error("blocking operation. try again")]
WouldBlock, WouldBlock,
/// A call to write returned 0 /// A call to write returned 0
#[error("write returned 0")]
WriteZero, WriteZero,
/// A WASI error without an external name. If you encounter this it means /// A WASI error without an external name. If you encounter this it means
/// that there's probably a bug on our side (maybe as simple as forgetting to wrap /// that there's probably a bug on our side (maybe as simple as forgetting to wrap
/// this error, but perhaps something broke) /// this error, but perhaps something broke)
#[error("unknown error: {0}")]
UnknownError(__wasi_errno_t), UnknownError(__wasi_errno_t),
} }

View File

@ -7,18 +7,28 @@
unused_unsafe, unused_unsafe,
unreachable_patterns unreachable_patterns
)] )]
use std::env;
#[cfg(all(target_os = "linux", feature = "loader-kernel"))] #[cfg(all(target_os = "linux", feature = "loader-kernel"))]
use wasmer_bin::commands::Kernel; use wasmer_bin::commands::Kernel;
use wasmer_bin::commands::{Cache, Run, SelfUpdate, Validate}; #[cfg(any(
feature = "backend-cranelift",
feature = "backend-llvm",
feature = "backend-singlepass"
))]
use wasmer_bin::commands::Run;
use wasmer_bin::commands::{Cache, SelfUpdate, Validate};
use structopt::{clap, StructOpt}; use structopt::StructOpt;
#[derive(Debug, StructOpt)] #[derive(Debug, StructOpt)]
#[structopt(name = "wasmer", about = "WebAssembly standalone runtime.", author)] #[structopt(name = "wasmer", about = "WebAssembly standalone runtime.", author)]
/// The options for the wasmer Command Line Interface /// The options for the wasmer Command Line Interface
enum CLIOptions { enum CLIOptions {
/// Run a WebAssembly file. Formats accepted: wasm, wat /// Run a WebAssembly file. Formats accepted: wasm, wat
#[cfg(any(
feature = "backend-cranelift",
feature = "backend-llvm",
feature = "backend-singlepass"
))]
#[structopt(name = "run")] #[structopt(name = "run")]
Run(Run), Run(Run),
@ -45,18 +55,36 @@ fn main() {
// Eg. `wasmer <SUBCOMMAND>` // Eg. `wasmer <SUBCOMMAND>`
// In case that fails, we fallback trying the Run subcommand directly. // In case that fails, we fallback trying the Run subcommand directly.
// Eg. `wasmer myfile.wasm --dir=.` // Eg. `wasmer myfile.wasm --dir=.`
let args = env::args(); #[cfg(any(
let options = CLIOptions::from_iter_safe(args).unwrap_or_else(|e| { feature = "backend-cranelift",
feature = "backend-llvm",
feature = "backend-singlepass"
))]
let options = CLIOptions::from_iter_safe(std::env::args()).unwrap_or_else(|e| {
match e.kind { match e.kind {
// This fixes a issue that: // This fixes a issue that:
// 1. Shows the version twice when doing `wasmer -V` // 1. Shows the version twice when doing `wasmer -V`
// 2. Shows the run help (instead of normal help) when doing `wasmer --help` // 2. Shows the run help (instead of normal help) when doing `wasmer --help`
clap::ErrorKind::VersionDisplayed | clap::ErrorKind::HelpDisplayed => e.exit(), structopt::clap::ErrorKind::VersionDisplayed
| structopt::clap::ErrorKind::HelpDisplayed => e.exit(),
_ => CLIOptions::Run(Run::from_args()), _ => CLIOptions::Run(Run::from_args()),
} }
}); });
// Do not try to wrap in Run, if the Run subcommand is not available
#[cfg(not(any(
feature = "backend-cranelift",
feature = "backend-llvm",
feature = "backend-singlepass"
)))]
let options = CLIOptions::from_args();
match options { match options {
#[cfg(any(
feature = "backend-cranelift",
feature = "backend-llvm",
feature = "backend-singlepass"
))]
CLIOptions::Run(mut options) => options.execute(), CLIOptions::Run(mut options) => options.execute(),
CLIOptions::SelfUpdate => SelfUpdate::execute(), CLIOptions::SelfUpdate => SelfUpdate::execute(),
CLIOptions::Cache(cache) => cache.execute(), CLIOptions::Cache(cache) => cache.execute(),

View File

@ -1,10 +1,21 @@
mod cache; mod cache;
#[cfg(all(target_os = "linux", feature = "loader-kernel"))] #[cfg(all(target_os = "linux", feature = "loader-kernel"))]
mod kernel; mod kernel;
#[cfg(any(
feature = "backend-cranelift",
feature = "backend-llvm",
feature = "backend-singlepass"
))]
mod run; mod run;
mod selfupdate; mod selfupdate;
mod validate; mod validate;
#[cfg(all(target_os = "linux", feature = "loader-kernel"))] #[cfg(all(target_os = "linux", feature = "loader-kernel"))]
pub use kernel::*; pub use kernel::*;
pub use {cache::*, run::*, selfupdate::*, validate::*}; #[cfg(any(
feature = "backend-cranelift",
feature = "backend-llvm",
feature = "backend-singlepass"
))]
pub use run::*;
pub use {cache::*, selfupdate::*, validate::*};

View File

@ -474,7 +474,12 @@ impl LLVMCallbacks for LLVMCLIOptions {
/// Execute a wasm/wat file /// Execute a wasm/wat file
fn execute_wasm(options: &Run) -> Result<(), String> { fn execute_wasm(options: &Run) -> Result<(), String> {
if options.generate_debug_info && options.backend != Backend::Cranelift { #[cfg(feature = "backend-cranelift")]
let in_cranelift = options.backend == Backend::Cranelift;
#[cfg(not(feature = "backend-cranelift"))]
let in_cranelift = false;
if options.generate_debug_info && !in_cranelift {
return Err("Generating debug information is currently only available with the `cranelift` backend.".to_owned()); return Err("Generating debug information is currently only available with the `cranelift` backend.".to_owned());
} }

View File

@ -0,0 +1,35 @@
;; Spilled stack tests
;; https://github.com/wasmerio/wasmer/pull/1191
(module
;; Auxiliary definitions
(type $out-i32 (func (result i32)))
(func $const-i32 (type $out-i32) (i32.const 0x132))
(table funcref
(elem
$const-i32
)
)
(memory 1)
(func (export "call-indirect-from-spilled-stack") (result i32)
(i64.add (i64.const 0) (i64.const 0))
(i64.add (i64.const 0) (i64.const 0))
(i64.add (i64.const 0) (i64.const 0))
(i64.add (i64.const 0) (i64.const 0))
(i64.add (i64.const 0) (i64.const 0))
(i64.add (i64.const 0) (i64.const 0))
(i64.add (i64.const 0) (i64.const 0))
(i64.add (i64.const 0) (i64.const 0))
(i64.add (i64.const 0) (i64.const 0))
(i64.add (i64.const 0x100000000) (i64.const 0))
(i32.wrap_i64)
(call_indirect (type $out-i32))
(return)
)
)
(assert_return (invoke "call-indirect-from-spilled-stack") (i32.const 0x132))

View File

@ -0,0 +1,10 @@
;; We assert that we can call a function that traps repitedly
(module
(func (export "throw_trap")
unreachable
))
(assert_trap (invoke "as-call_indirect-last") "unreachable")
(assert_trap (invoke "as-call_indirect-last") "unreachable")
(assert_trap (invoke "as-call_indirect-last") "unreachable")

View File

@ -1,16 +1,16 @@
;; Wasmer-specific tests. ;; NaN canonicalization tests.
;;
;; Things that are covered by spectests canonicalization
;; (`fabs`, `fneg`, `fcopysign`, `reinterpret`, `const`)
;; won't be duplicated here.
(module (module
;; Auxiliary definitions ;; Auxiliary definitions
(type $out-i32 (func (result i32)))
(type $f32-id (func (param f32) (result f32))) (type $f32-id (func (param f32) (result f32)))
(type $f64-id (func (param f64) (result f64))) (type $f64-id (func (param f64) (result f64)))
(func $const-i32 (type $out-i32) (i32.const 0x132))
(table funcref (table funcref
(elem (elem
$const-i32
$nan-canonicalization-f32-func-call-target $nan-canonicalization-f32-func-call-target
$nan-canonicalization-f64-func-call-target $nan-canonicalization-f64-func-call-target
) )
@ -18,26 +18,6 @@
(memory 1) (memory 1)
;; https://github.com/wasmerio/wasmer/pull/1191
(func (export "call-indirect-from-spilled-stack") (result i32)
(i64.add (i64.const 0) (i64.const 0))
(i64.add (i64.const 0) (i64.const 0))
(i64.add (i64.const 0) (i64.const 0))
(i64.add (i64.const 0) (i64.const 0))
(i64.add (i64.const 0) (i64.const 0))
(i64.add (i64.const 0) (i64.const 0))
(i64.add (i64.const 0) (i64.const 0))
(i64.add (i64.const 0) (i64.const 0))
(i64.add (i64.const 0) (i64.const 0))
(i64.add (i64.const 0x100000000) (i64.const 0))
(i32.wrap_i64)
(call_indirect (type $out-i32))
(return)
)
;; NaN canonicalization tests.
;; Things that are covered by spectests canonicalization (`fabs`, `fneg`, `fcopysign`, `reinterpret`, `const`) won't be duplicated here.
(func (export "nan-canonicalization-f32-add") (param i32) (result i32) (func (export "nan-canonicalization-f32-add") (param i32) (result i32)
(i32.reinterpret_f32 (f32.add (f32.reinterpret_i32 (get_local 0)) (f32.const 0))) (i32.reinterpret_f32 (f32.add (f32.reinterpret_i32 (get_local 0)) (f32.const 0)))
) )
@ -173,7 +153,6 @@
) )
) )
(assert_return (invoke "call-indirect-from-spilled-stack") (i32.const 0x132))
(assert_return (invoke "nan-canonicalization-f32-add" (i32.const 0x7fc00001)) (i32.const 0x7fc00000)) (assert_return (invoke "nan-canonicalization-f32-add" (i32.const 0x7fc00001)) (i32.const 0x7fc00000))
(assert_return (invoke "nan-canonicalization-f32-sub" (i32.const 0x7fc00001)) (i32.const 0x7fc00000)) (assert_return (invoke "nan-canonicalization-f32-sub" (i32.const 0x7fc00001)) (i32.const 0x7fc00000))
(assert_return (invoke "nan-canonicalization-f32-mul" (i32.const 0x7fc00001)) (i32.const 0x7fc00000)) (assert_return (invoke "nan-canonicalization-f32-mul" (i32.const 0x7fc00001)) (i32.const 0x7fc00000))

View File

@ -1 +0,0 @@
clock_gettime

View File

@ -1,11 +0,0 @@
INIT
UNEXISTENT_ENVVAR = [NULL]
Setting UNEXISTENT_ENVVAR=PUTENV (via putenv)
UNEXISTENT_ENVVAR = PUTENV
Setting UNEXISTENT_ENVVAR=SETENV (via setenv, overwrite)
UNEXISTENT_ENVVAR = SETENV
Setting UNEXISTENT_ENVVAR=SETENV_NEW (via setenv, NO overwrite)
UNEXISTENT_ENVVAR = SETENV
Unsetting UNEXISTENT_ENVVAR
UNEXISTENT_ENVVAR = [NULL]
END

View File

@ -1,2 +1 @@
hello world hello world

View File

@ -1,109 +0,0 @@
test_ccall
test_demangle_stacks
emscripten_get_compiler_setting
fs_exports
getvalue_setvalue
legacy_exported_runtime_numbers
modularize_closure_pre
stackalloc
test_demangle_stacks_noassert
test_dlmalloc_partial_2
test_em_asm
test_em_asm_2
test_em_asm_parameter_pack
test_em_asm_signatures
test_em_asm_unicode
test_em_asm_unused_arguments
test_em_js
test_emscripten_api
test_exceptions_2
test_exceptions_multi
test_exceptions_std
test_exceptions_white_list
test_fast_math
test_float_builtins
test_getopt
test_getopt_long
test_getloadavg
test_i16_emcc_intrinsic
test_i64
test_i64_7z
test_i64_varargs
test_indirectbr_many
test_llvm_intrinsics
test_longjmp_exc
test_lower_intrinsics
test_main_thread_async_em_asm
test_mainenv
test_mathfuncptr
test_memcpy_memcmp
test_mmap
test_perrar
test_poll
test_posixtime
test_siglongjmp
test_sscanf_hex
test_sscanf_whitespace
test_sscanf_other_whitespace
test_sscanf_skip
test_stack_varargs
test_stack_void
test_statvfs
test_strings
test_strptime_days
test_strtold
test_tracing
test_uname
test_utf
test_varargs_multi
test_varargs
test_zero_multiplication
test_strftime
test_wprintf
test_std_cout_new
test_strptime_reentrant
test_gmtime
test_time_c
test_execvp
test_nl_types
test_phiundef
test_pipe
test_printf_2
test_printf_more
test_regex
test_relocatable_void_function
test_rounding
test_set_align
test_sintvars
test_sizeof
test_sscanf
test_sscanf_3
test_sscanf_4
test_sscanf_5
test_sscanf_6
test_sscanf_caps
test_sscanf_float
test_sscanf_n
test_strcasecmp
test_strcmp_uni
test_strndup
test_strstr
test_strtod
test_strtok
test_strtol_bin
test_strtol_dec
test_strtol_hex
test_strtol_oct
test_strtoll_bin
test_strtoll_dec
test_strtoll_hex
test_strtoll_oct
test_struct_varargs
test_transtrcase
test_trickystring
test_unary_literal
test_vfs
test_vprintf
test_vsnprintf
test_write_stdout_fileno
test_zerodiv

View File

@ -1 +0,0 @@
localtime

View File

@ -1,29 +0,0 @@
ab1.23cd
n=7
Characters: a A
Decimals: 1977 650000 12 4
Preceding with blanks: 1977 -1977
Preceding with zeros: 0000001977 -000001977
Force sign: +1977 -1977 +1977 -1977
Force sign or space: 1977 -1977 1977 -1977
Sign overrides space: +1977 -1977 +1977 -1977
Some different radixes: 100 64 144 0x64 0144
floats: 3.14 +3e+00 3.141600E+00 00003.14
negative floats: -3.14 -3e+00 -3.141600E+00 -0003.14
Force sign or space: 3.14 -3.14 3.14 -3.14
Width trick: 10
A string %
Null string: (null)
inf
INF
-inf
-INF
nan
NAN
nan
nan
nan
nan
inf
-inf

View File

@ -1,4 +0,0 @@
Hello, World!
Hello, World!

View File

@ -1 +0,0 @@
ok:-32768*

View File

@ -1 +0,0 @@
0:-1.00,-0.33 1:0.33,-1.00 2:-0.33,1.00 3:1.00,0.33

View File

@ -1,2 +0,0 @@
*6,6
7,95*

View File

@ -1,3 +0,0 @@
0*0*0*0*6*5*4*3*3*9*8
0*0*0*0*6*5*4*3*3*9*8
6294967296*0*0*0*0*6*5*4*3*3*9*8

View File

@ -1,5 +0,0 @@
*15,15*
*15,10*
*6,10*
*10,0*
*7,1*

View File

@ -1,10 +0,0 @@
-2
-1
0
6
7
9
null
null
null
null

View File

@ -1,8 +0,0 @@
value = real 1.00 imag 3.00
abs = 3.16
value = real 1.00 imag -3.00
value = real -2.69 imag 0.38
value = real 1.00 imag -3.00
value = real 1.25 imag 0.00
value = real 0.50 imag 0.00
value = real 0.00 imag 1.00

View File

@ -1,2 +0,0 @@
15.000000
15.000000

View File

@ -1 +0,0 @@
0.842701, 0.999978, -0.842701, 0.157299, 0.000022, 1.966105

View File

@ -1,4 +0,0 @@
<Domain error>
<Resource temporarily unavailable>
<34>
<123>

View File

@ -1 +0,0 @@
_execvp

View File

@ -1 +0,0 @@
total: 19

View File

@ -1 +0,0 @@
source: 3.1415926535 buffer: '31415927' decimal: 1 sign: 0

View File

@ -1,2 +1,73 @@
mod emtests; mod utils;
pub mod utils;
use crate::utils::stdio::StdioCapturer;
use anyhow::{anyhow, bail};
use wasmer::compiler::{compile_with, compiler_for_backend, Backend};
use wasmer_emscripten::{generate_emscripten_env, run_emscripten_instance, EmscriptenGlobals};
use lazy_static::lazy_static;
use std::sync::Mutex;
lazy_static! {
// We want to run emscripten tests one by one
// Based from: https://stackoverflow.com/questions/51694017/how-can-i-avoid-running-some-tests-in-parallel
static ref EMSCRIPTEN_LOCK: Mutex<()> = Mutex::new(());
}
// The generated tests (from build.rs) look like:
// #[cfg(test)]
// mod singlepass {
// mod wasi {
// #[test]
// fn test_hello_world() -> anyhow::Result<()> {
// crate::run_wasi(
// "tests/emscripten_resources/emtests/test_hello_world.wasm",
// "tests/emscripten_resources/emtests/test_hello_world.out",
// "singlepass"
// )
// }
// }
// }
include!(concat!(env!("OUT_DIR"), "/generated_emtests.rs"));
fn run_emscripten(wasm_program_path: &str, output_path: &str, backend: &str) -> anyhow::Result<()> {
let _shared = EMSCRIPTEN_LOCK.lock().unwrap_or_else(|e| e.into_inner());
let backend = utils::get_backend_from_str(backend)?;
let program_name = "name";
let wasm_binary = std::fs::read(wasm_program_path)?;
let compiler = compiler_for_backend(backend).expect("Backend not recognized");
let module = compile_with(&wasm_binary, &*compiler).unwrap();
let mut emscripten_globals = EmscriptenGlobals::new(&module).expect("globals are valid");
let import_object = generate_emscripten_env(&mut emscripten_globals);
let mut instance = module
.instantiate(&import_object)
.map_err(|err| anyhow!("Can't instantiate the WebAssembly module: {:?}", err))?;
let capturer = StdioCapturer::new();
run_emscripten_instance(
&module,
&mut instance,
&mut emscripten_globals,
program_name,
vec![],
None,
vec![],
)
.expect("run_emscripten_instance finishes");
let output = capturer.end().unwrap().0;
let expected_output = String::from_utf8(std::fs::read(output_path)?)?;
assert!(
output.contains(&expected_output),
"Output: `{}` does not contain expected output: `{}`",
output,
expected_output
);
Ok(())
}

View File

@ -1,110 +0,0 @@
use std::env;
use wasmer::compiler::Backend;
pub fn get_backend() -> Option<Backend> {
#[cfg(feature = "backend-cranelift")]
{
if let Ok(v) = env::var("WASMER_TEST_CRANELIFT") {
if v == "1" {
return Some(Backend::Cranelift);
}
}
}
#[cfg(feature = "backend-llvm")]
{
if let Ok(v) = env::var("WASMER_TEST_LLVM") {
if v == "1" {
return Some(Backend::LLVM);
}
}
}
#[cfg(feature = "backend-singlepass")]
{
if let Ok(v) = env::var("WASMER_TEST_SINGLEPASS") {
if v == "1" {
return Some(Backend::Singlepass);
}
}
}
None
}
macro_rules! assert_emscripten_output {
($file:expr, $name:expr, $args:expr, $expected:expr) => {{
use wasmer_emscripten::{
EmscriptenGlobals,
generate_emscripten_env,
};
use crate::utils::stdio::StdioCapturer;
let wasm_bytes = include_bytes!($file);
let backend = $crate::emtests::_common::get_backend().expect("Please set one of `WASMER_TEST_CRANELIFT`, `WASMER_TEST_LLVM`, or `WASMER_TEST_SINGELPASS` to `1`.");
let compiler = wasmer::compiler::compiler_for_backend(backend).expect("The desired compiler was not found!");
let module = wasmer::compiler::compile_with_config_with(&wasm_bytes[..], Default::default(), &*compiler).expect("WASM can't be compiled");
let mut emscripten_globals = EmscriptenGlobals::new(&module).expect("globals are valid");
let import_object = generate_emscripten_env(&mut emscripten_globals);
let mut instance = module.instantiate(&import_object)
.map_err(|err| format!("Can't instantiate the WebAssembly module: {:?}", err)).unwrap(); // NOTE: Need to figure what the unwrap is for ??
let capturer = StdioCapturer::new();
wasmer_emscripten::run_emscripten_instance(
&module,
&mut instance,
&mut emscripten_globals,
$name,
$args,
None,
vec![],
).expect("run_emscripten_instance finishes");
let output = capturer.end().unwrap().0;
let expected_output = include_str!($expected);
assert!(
output.contains(expected_output),
"Output: `{}` does not contain expected output: `{}`",
output,
expected_output
);
}};
}
// pub fn assert_emscripten_output(wasm_bytes: &[u8], raw_expected_str: &str) {
// use wasmer_clif_backend::CraneliftCompiler;
// use wasmer_emscripten::{generate_emscripten_env, stdio::StdioCapturer, EmscriptenGlobals};
// let module = wasmer::compiler::compile_with(&wasm_bytes[..], &CraneliftCompiler::new())
// .expect("WASM can't be compiled");
// let mut emscripten_globals = EmscriptenGlobals::new(&module);
// let import_object = generate_emscripten_env(&mut emscripten_globals);
// let mut instance = module
// .instantiate(&import_object)
// .map_err(|err| format!("Can't instantiate the WebAssembly module: {:?}", err))
// .unwrap();
// let capturer = StdioCapturer::new();
// wasmer_emscripten::run_emscripten_instance(&module, &mut instance, "test", vec![])
// .expect("run_emscripten_instance finishes");
// let raw_output_string = capturer.end().unwrap().0;
// // trim the strings to avoid cross-platform line ending and white space issues
// let output = raw_output_string.trim();
// let expected_output = raw_expected_str.trim();
// let contains_output = output.contains(expected_output);
// assert!(
// contains_output,
// "Output: `{}` does not contain expected output: `{}`",
// output, expected_output
// );
// }

View File

@ -1,9 +0,0 @@
#[test]
fn test_clock_gettime() {
assert_emscripten_output!(
"../emscripten_resources/emtests/clock_gettime.wasm",
"clock_gettime",
vec![],
"../emscripten_resources/emtests/clock_gettime.out"
);
}

View File

@ -1,10 +0,0 @@
#[test]
#[ignore]
fn test_emscripten_get_compiler_setting() {
assert_emscripten_output!(
"../emscripten_resources/emtests/emscripten_get_compiler_setting.wasm",
"emscripten_get_compiler_setting",
vec![],
"../emscripten_resources/emtests/emscripten_get_compiler_setting.out"
);
}

View File

@ -1,9 +0,0 @@
#[test]
fn test_env() {
assert_emscripten_output!(
"../emscripten_resources/emtests/env.wasm",
"env",
vec![],
"../emscripten_resources/emtests/env.out"
);
}

View File

@ -1,10 +0,0 @@
#[test]
#[ignore]
fn test_fs_exports() {
assert_emscripten_output!(
"../emscripten_resources/emtests/FS_exports.wasm",
"fs_exports",
vec![],
"../emscripten_resources/emtests/FS_exports.txt"
);
}

View File

@ -1,10 +0,0 @@
#[test]
#[ignore]
fn test_getvalue_setvalue() {
assert_emscripten_output!(
"../emscripten_resources/emtests/getValue_setValue.wasm",
"getvalue_setvalue",
vec![],
"../emscripten_resources/emtests/getValue_setValue.txt"
);
}

View File

@ -1,10 +0,0 @@
#[test]
#[ignore]
fn test_legacy_exported_runtime_numbers() {
assert_emscripten_output!(
"../emscripten_resources/emtests/legacy_exported_runtime_numbers.wasm",
"legacy_exported_runtime_numbers",
vec![],
"../emscripten_resources/emtests/legacy_exported_runtime_numbers.txt"
);
}

View File

@ -1,9 +0,0 @@
#[test]
fn test_localtime() {
assert_emscripten_output!(
"../emscripten_resources/emtests/localtime.wasm",
"localtime",
vec![],
"../emscripten_resources/emtests/localtime.out"
);
}

View File

@ -1,185 +0,0 @@
// Rust test file autogenerated with cargo build (generate-emscripten-tests).
// 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 macros for the emtests
#[macro_use]
mod _common;
mod clock_gettime;
mod emscripten_get_compiler_setting;
mod env;
mod fs_exports;
mod getvalue_setvalue;
mod legacy_exported_runtime_numbers;
mod localtime;
mod modularize_closure_pre;
mod printf;
mod puts;
mod stackalloc;
mod test_addr_of_stacked;
mod test_alloca;
mod test_alloca_stack;
mod test_array2;
mod test_array2b;
mod test_atomic;
mod test_atox;
mod test_bsearch;
mod test_ccall;
mod test_complex;
mod test_demangle_stacks;
mod test_demangle_stacks_noassert;
mod test_dlmalloc_partial_2;
mod test_double_varargs;
mod test_em_asm;
mod test_em_asm_2;
mod test_em_asm_parameter_pack;
mod test_em_asm_signatures;
mod test_em_asm_unicode;
mod test_em_asm_unused_arguments;
mod test_em_js;
mod test_emscripten_api;
mod test_erf;
mod test_errar;
mod test_exceptions_2;
mod test_exceptions_multi;
mod test_exceptions_std;
mod test_exceptions_white_list;
mod test_execvp;
mod test_fast_math;
mod test_flexarray_struct;
mod test_float32_precise;
mod test_float_builtins;
mod test_frexp;
mod test_funcptr;
mod test_funcptr_namecollide;
mod test_funcptrfunc;
mod test_funcs;
mod test_functionpointer_libfunc_varargs;
mod test_fwrite_0;
mod test_getcwd;
mod test_getgep;
mod test_getloadavg;
mod test_getopt;
mod test_getopt_long;
mod test_globaldoubles;
mod test_globals;
mod test_gmtime;
mod test_hello_world;
mod test_i16_emcc_intrinsic;
mod test_i32_mul_precise;
mod test_i64;
mod test_i64_4;
mod test_i64_7z;
mod test_i64_cmp2;
mod test_i64_i16;
mod test_i64_llabs;
mod test_i64_precise;
mod test_i64_precise_needed;
mod test_i64_precise_unneeded;
mod test_i64_qdouble;
mod test_i64_umul;
mod test_i64_varargs;
mod test_i64_zextneg;
mod test_if;
mod test_if_else;
mod test_indirectbr;
mod test_indirectbr_many;
mod test_isnan;
mod test_libcextra;
mod test_libgen;
mod test_literal_negative_zero;
mod test_llrint;
mod test_llvm_fabs;
mod test_llvm_intrinsics;
mod test_llvmswitch;
mod test_longjmp;
mod test_longjmp2;
mod test_longjmp3;
mod test_longjmp4;
mod test_longjmp_exc;
mod test_longjmp_funcptr;
mod test_longjmp_repeat;
mod test_longjmp_stacked;
mod test_longjmp_throw;
mod test_longjmp_unwind;
mod test_loop;
mod test_lower_intrinsics;
mod test_main_thread_async_em_asm;
mod test_mainenv;
mod test_mathfuncptr;
mod test_memcpy2;
mod test_memcpy3;
mod test_memcpy_memcmp;
mod test_memmove;
mod test_memmove2;
mod test_memmove3;
mod test_memset;
mod test_mmap;
mod test_negative_zero;
mod test_nested_struct_varargs;
mod test_nl_types;
mod test_perrar;
mod test_phiundef;
mod test_pipe;
mod test_poll;
mod test_posixtime;
mod test_printf_2;
mod test_printf_more;
mod test_regex;
mod test_relocatable_void_function;
mod test_rounding;
mod test_set_align;
mod test_siglongjmp;
mod test_sintvars;
mod test_sizeof;
mod test_sscanf;
mod test_sscanf_3;
mod test_sscanf_4;
mod test_sscanf_5;
mod test_sscanf_6;
mod test_sscanf_caps;
mod test_sscanf_float;
mod test_sscanf_hex;
mod test_sscanf_n;
mod test_sscanf_other_whitespace;
mod test_sscanf_skip;
mod test_sscanf_whitespace;
mod test_stack_varargs;
mod test_stack_void;
mod test_statvfs;
mod test_std_cout_new;
mod test_strcasecmp;
mod test_strcmp_uni;
mod test_strftime;
mod test_strings;
mod test_strndup;
mod test_strptime_days;
mod test_strptime_reentrant;
mod test_strstr;
mod test_strtod;
mod test_strtok;
mod test_strtol_bin;
mod test_strtol_dec;
mod test_strtol_hex;
mod test_strtol_oct;
mod test_strtold;
mod test_strtoll_bin;
mod test_strtoll_dec;
mod test_strtoll_hex;
mod test_strtoll_oct;
mod test_struct_varargs;
mod test_time_c;
mod test_tracing;
mod test_transtrcase;
mod test_trickystring;
mod test_uname;
mod test_unary_literal;
mod test_utf;
mod test_varargs;
mod test_varargs_multi;
mod test_vfs;
mod test_vprintf;
mod test_vsnprintf;
mod test_wprintf;
mod test_write_stdout_fileno;
mod test_zero_multiplication;
mod test_zerodiv;

View File

@ -1,10 +0,0 @@
#[test]
#[ignore]
fn test_modularize_closure_pre() {
assert_emscripten_output!(
"../emscripten_resources/emtests/modularize_closure_pre.wasm",
"modularize_closure_pre",
vec![],
"../emscripten_resources/emtests/modularize_closure_pre.out"
);
}

View File

@ -1,9 +0,0 @@
#[test]
fn test_printf() {
assert_emscripten_output!(
"../emscripten_resources/emtests/printf.wasm",
"printf",
vec![],
"../emscripten_resources/emtests/printf.out"
);
}

View File

@ -1,9 +0,0 @@
#[test]
fn test_puts() {
assert_emscripten_output!(
"../emscripten_resources/emtests/puts.wasm",
"puts",
vec![],
"../emscripten_resources/emtests/puts.out"
);
}

View File

@ -1,10 +0,0 @@
#[test]
#[ignore]
fn test_stackalloc() {
assert_emscripten_output!(
"../emscripten_resources/emtests/stackAlloc.wasm",
"stackalloc",
vec![],
"../emscripten_resources/emtests/stackAlloc.txt"
);
}

View File

@ -1,9 +0,0 @@
#[test]
fn test_test_addr_of_stacked() {
assert_emscripten_output!(
"../emscripten_resources/emtests/test_addr_of_stacked.wasm",
"test_addr_of_stacked",
vec![],
"../emscripten_resources/emtests/test_addr_of_stacked.out"
);
}

View File

@ -1,9 +0,0 @@
#[test]
fn test_test_alloca() {
assert_emscripten_output!(
"../emscripten_resources/emtests/test_alloca.wasm",
"test_alloca",
vec![],
"../emscripten_resources/emtests/test_alloca.out"
);
}

View File

@ -1,9 +0,0 @@
#[test]
fn test_test_alloca_stack() {
assert_emscripten_output!(
"../emscripten_resources/emtests/test_alloca_stack.wasm",
"test_alloca_stack",
vec![],
"../emscripten_resources/emtests/test_alloca_stack.out"
);
}

View File

@ -1,9 +0,0 @@
#[test]
fn test_test_array2() {
assert_emscripten_output!(
"../emscripten_resources/emtests/test_array2.wasm",
"test_array2",
vec![],
"../emscripten_resources/emtests/test_array2.out"
);
}

View File

@ -1,9 +0,0 @@
#[test]
fn test_test_array2b() {
assert_emscripten_output!(
"../emscripten_resources/emtests/test_array2b.wasm",
"test_array2b",
vec![],
"../emscripten_resources/emtests/test_array2b.out"
);
}

View File

@ -1,9 +0,0 @@
#[test]
fn test_test_atomic() {
assert_emscripten_output!(
"../emscripten_resources/emtests/test_atomic.wasm",
"test_atomic",
vec![],
"../emscripten_resources/emtests/test_atomic.out"
);
}

View File

@ -1,9 +0,0 @@
#[test]
fn test_test_atox() {
assert_emscripten_output!(
"../emscripten_resources/emtests/test_atoX.wasm",
"test_atox",
vec![],
"../emscripten_resources/emtests/test_atoX.out"
);
}

View File

@ -1,9 +0,0 @@
#[test]
fn test_test_bsearch() {
assert_emscripten_output!(
"../emscripten_resources/emtests/test_bsearch.wasm",
"test_bsearch",
vec![],
"../emscripten_resources/emtests/test_bsearch.out"
);
}

View File

@ -1,10 +0,0 @@
#[test]
#[ignore]
fn test_test_ccall() {
assert_emscripten_output!(
"../emscripten_resources/emtests/test_ccall.wasm",
"test_ccall",
vec![],
"../emscripten_resources/emtests/test_ccall.out"
);
}

View File

@ -1,9 +0,0 @@
#[test]
fn test_test_complex() {
assert_emscripten_output!(
"../emscripten_resources/emtests/test_complex.wasm",
"test_complex",
vec![],
"../emscripten_resources/emtests/test_complex.out"
);
}

View File

@ -1,10 +0,0 @@
#[test]
#[ignore]
fn test_test_demangle_stacks() {
assert_emscripten_output!(
"../emscripten_resources/emtests/test_demangle_stacks.wasm",
"test_demangle_stacks",
vec![],
"../emscripten_resources/emtests/test_demangle_stacks.out"
);
}

View File

@ -1,10 +0,0 @@
#[test]
#[ignore]
fn test_test_demangle_stacks_noassert() {
assert_emscripten_output!(
"../emscripten_resources/emtests/test_demangle_stacks_noassert.wasm",
"test_demangle_stacks_noassert",
vec![],
"../emscripten_resources/emtests/test_demangle_stacks_noassert.out"
);
}

View File

@ -1,10 +0,0 @@
#[test]
#[ignore]
fn test_test_dlmalloc_partial_2() {
assert_emscripten_output!(
"../emscripten_resources/emtests/test_dlmalloc_partial_2.wasm",
"test_dlmalloc_partial_2",
vec![],
"../emscripten_resources/emtests/test_dlmalloc_partial_2.out"
);
}

View File

@ -1,9 +0,0 @@
#[test]
fn test_test_double_varargs() {
assert_emscripten_output!(
"../emscripten_resources/emtests/test_double_varargs.wasm",
"test_double_varargs",
vec![],
"../emscripten_resources/emtests/test_double_varargs.out"
);
}

View File

@ -1,10 +0,0 @@
#[test]
#[ignore]
fn test_test_em_asm() {
assert_emscripten_output!(
"../emscripten_resources/emtests/test_em_asm.wasm",
"test_em_asm",
vec![],
"../emscripten_resources/emtests/test_em_asm.out"
);
}

View File

@ -1,10 +0,0 @@
#[test]
#[ignore]
fn test_test_em_asm_2() {
assert_emscripten_output!(
"../emscripten_resources/emtests/test_em_asm_2.wasm",
"test_em_asm_2",
vec![],
"../emscripten_resources/emtests/test_em_asm_2.out"
);
}

View File

@ -1,10 +0,0 @@
#[test]
#[ignore]
fn test_test_em_asm_parameter_pack() {
assert_emscripten_output!(
"../emscripten_resources/emtests/test_em_asm_parameter_pack.wasm",
"test_em_asm_parameter_pack",
vec![],
"../emscripten_resources/emtests/test_em_asm_parameter_pack.out"
);
}

View File

@ -1,10 +0,0 @@
#[test]
#[ignore]
fn test_test_em_asm_signatures() {
assert_emscripten_output!(
"../emscripten_resources/emtests/test_em_asm_signatures.wasm",
"test_em_asm_signatures",
vec![],
"../emscripten_resources/emtests/test_em_asm_signatures.out"
);
}

View File

@ -1,10 +0,0 @@
#[test]
#[ignore]
fn test_test_em_asm_unicode() {
assert_emscripten_output!(
"../emscripten_resources/emtests/test_em_asm_unicode.wasm",
"test_em_asm_unicode",
vec![],
"../emscripten_resources/emtests/test_em_asm_unicode.out"
);
}

View File

@ -1,10 +0,0 @@
#[test]
#[ignore]
fn test_test_em_asm_unused_arguments() {
assert_emscripten_output!(
"../emscripten_resources/emtests/test_em_asm_unused_arguments.wasm",
"test_em_asm_unused_arguments",
vec![],
"../emscripten_resources/emtests/test_em_asm_unused_arguments.out"
);
}

View File

@ -1,10 +0,0 @@
#[test]
#[ignore]
fn test_test_em_js() {
assert_emscripten_output!(
"../emscripten_resources/emtests/test_em_js.wasm",
"test_em_js",
vec![],
"../emscripten_resources/emtests/test_em_js.out"
);
}

View File

@ -1,10 +0,0 @@
#[test]
#[ignore]
fn test_test_emscripten_api() {
assert_emscripten_output!(
"../emscripten_resources/emtests/test_emscripten_api.wasm",
"test_emscripten_api",
vec![],
"../emscripten_resources/emtests/test_emscripten_api.out"
);
}

View File

@ -1,9 +0,0 @@
#[test]
fn test_test_erf() {
assert_emscripten_output!(
"../emscripten_resources/emtests/test_erf.wasm",
"test_erf",
vec![],
"../emscripten_resources/emtests/test_erf.out"
);
}

View File

@ -1,9 +0,0 @@
#[test]
fn test_test_errar() {
assert_emscripten_output!(
"../emscripten_resources/emtests/test_errar.wasm",
"test_errar",
vec![],
"../emscripten_resources/emtests/test_errar.out"
);
}

View File

@ -1,10 +0,0 @@
#[test]
#[ignore]
fn test_test_exceptions_2() {
assert_emscripten_output!(
"../emscripten_resources/emtests/test_exceptions_2.wasm",
"test_exceptions_2",
vec![],
"../emscripten_resources/emtests/test_exceptions_2.out"
);
}

View File

@ -1,10 +0,0 @@
#[test]
#[ignore]
fn test_test_exceptions_multi() {
assert_emscripten_output!(
"../emscripten_resources/emtests/test_exceptions_multi.wasm",
"test_exceptions_multi",
vec![],
"../emscripten_resources/emtests/test_exceptions_multi.out"
);
}

View File

@ -1,10 +0,0 @@
#[test]
#[ignore]
fn test_test_exceptions_std() {
assert_emscripten_output!(
"../emscripten_resources/emtests/test_exceptions_std.wasm",
"test_exceptions_std",
vec![],
"../emscripten_resources/emtests/test_exceptions_std.out"
);
}

View File

@ -1,10 +0,0 @@
#[test]
#[ignore]
fn test_test_exceptions_white_list() {
assert_emscripten_output!(
"../emscripten_resources/emtests/test_exceptions_white_list.wasm",
"test_exceptions_white_list",
vec![],
"../emscripten_resources/emtests/test_exceptions_white_list.out"
);
}

View File

@ -1,10 +0,0 @@
#[test]
#[ignore]
fn test_test_execvp() {
assert_emscripten_output!(
"../emscripten_resources/emtests/test_execvp.wasm",
"test_execvp",
vec![],
"../emscripten_resources/emtests/test_execvp.out"
);
}

View File

@ -1,10 +0,0 @@
#[test]
#[ignore]
fn test_test_fast_math() {
assert_emscripten_output!(
"../emscripten_resources/emtests/test_fast_math.wasm",
"test_fast_math",
vec![],
"../emscripten_resources/emtests/test_fast_math.out"
);
}

View File

@ -1,9 +0,0 @@
#[test]
fn test_test_flexarray_struct() {
assert_emscripten_output!(
"../emscripten_resources/emtests/test_flexarray_struct.wasm",
"test_flexarray_struct",
vec![],
"../emscripten_resources/emtests/test_flexarray_struct.out"
);
}

View File

@ -1,9 +0,0 @@
#[test]
fn test_test_float32_precise() {
assert_emscripten_output!(
"../emscripten_resources/emtests/test_float32_precise.wasm",
"test_float32_precise",
vec![],
"../emscripten_resources/emtests/test_float32_precise.out"
);
}

View File

@ -1,10 +0,0 @@
#[test]
#[ignore]
fn test_test_float_builtins() {
assert_emscripten_output!(
"../emscripten_resources/emtests/test_float_builtins.wasm",
"test_float_builtins",
vec![],
"../emscripten_resources/emtests/test_float_builtins.out"
);
}

View File

@ -1,9 +0,0 @@
#[test]
fn test_test_frexp() {
assert_emscripten_output!(
"../emscripten_resources/emtests/test_frexp.wasm",
"test_frexp",
vec![],
"../emscripten_resources/emtests/test_frexp.out"
);
}

View File

@ -1,9 +0,0 @@
#[test]
fn test_test_funcptr() {
assert_emscripten_output!(
"../emscripten_resources/emtests/test_funcptr.wasm",
"test_funcptr",
vec![],
"../emscripten_resources/emtests/test_funcptr.out"
);
}

View File

@ -1,9 +0,0 @@
#[test]
fn test_test_funcptr_namecollide() {
assert_emscripten_output!(
"../emscripten_resources/emtests/test_funcptr_namecollide.wasm",
"test_funcptr_namecollide",
vec![],
"../emscripten_resources/emtests/test_funcptr_namecollide.out"
);
}

View File

@ -1,9 +0,0 @@
#[test]
fn test_test_funcptrfunc() {
assert_emscripten_output!(
"../emscripten_resources/emtests/test_funcptrfunc.wasm",
"test_funcptrfunc",
vec![],
"../emscripten_resources/emtests/test_funcptrfunc.out"
);
}

View File

@ -1,9 +0,0 @@
#[test]
fn test_test_funcs() {
assert_emscripten_output!(
"../emscripten_resources/emtests/test_funcs.wasm",
"test_funcs",
vec![],
"../emscripten_resources/emtests/test_funcs.out"
);
}

View File

@ -1,9 +0,0 @@
#[test]
fn test_test_functionpointer_libfunc_varargs() {
assert_emscripten_output!(
"../emscripten_resources/emtests/test_functionpointer_libfunc_varargs.wasm",
"test_functionpointer_libfunc_varargs",
vec![],
"../emscripten_resources/emtests/test_functionpointer_libfunc_varargs.out"
);
}

View File

@ -1,9 +0,0 @@
#[test]
fn test_test_fwrite_0() {
assert_emscripten_output!(
"../emscripten_resources/emtests/test_fwrite_0.wasm",
"test_fwrite_0",
vec![],
"../emscripten_resources/emtests/test_fwrite_0.out"
);
}

View File

@ -1,9 +0,0 @@
#[test]
fn test_test_getcwd() {
assert_emscripten_output!(
"../emscripten_resources/emtests/test_getcwd.wasm",
"test_getcwd",
vec![],
"../emscripten_resources/emtests/test_getcwd.out"
);
}

View File

@ -1,9 +0,0 @@
#[test]
fn test_test_getgep() {
assert_emscripten_output!(
"../emscripten_resources/emtests/test_getgep.wasm",
"test_getgep",
vec![],
"../emscripten_resources/emtests/test_getgep.out"
);
}

View File

@ -1,10 +0,0 @@
#[test]
#[ignore]
fn test_test_getloadavg() {
assert_emscripten_output!(
"../emscripten_resources/emtests/test_getloadavg.wasm",
"test_getloadavg",
vec![],
"../emscripten_resources/emtests/test_getloadavg.out"
);
}

View File

@ -1,10 +0,0 @@
#[test]
#[ignore]
fn test_test_getopt() {
assert_emscripten_output!(
"../emscripten_resources/emtests/test_getopt.wasm",
"test_getopt",
vec![],
"../emscripten_resources/emtests/test_getopt.out"
);
}

View File

@ -1,10 +0,0 @@
#[test]
#[ignore]
fn test_test_getopt_long() {
assert_emscripten_output!(
"../emscripten_resources/emtests/test_getopt_long.wasm",
"test_getopt_long",
vec![],
"../emscripten_resources/emtests/test_getopt_long.out"
);
}

View File

@ -1,9 +0,0 @@
#[test]
fn test_test_globaldoubles() {
assert_emscripten_output!(
"../emscripten_resources/emtests/test_globaldoubles.wasm",
"test_globaldoubles",
vec![],
"../emscripten_resources/emtests/test_globaldoubles.out"
);
}

View File

@ -1,9 +0,0 @@
#[test]
fn test_test_globals() {
assert_emscripten_output!(
"../emscripten_resources/emtests/test_globals.wasm",
"test_globals",
vec![],
"../emscripten_resources/emtests/test_globals.out"
);
}

View File

@ -1,10 +0,0 @@
#[test]
#[ignore]
fn test_test_gmtime() {
assert_emscripten_output!(
"../emscripten_resources/emtests/test_gmtime.wasm",
"test_gmtime",
vec![],
"../emscripten_resources/emtests/test_gmtime.out"
);
}

Some files were not shown because too many files have changed in this diff Show More