diff --git a/Cargo.lock b/Cargo.lock index 6852fa86dec..ab6b3e2c8a7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,5 +1,3 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. [[package]] name = "MacTypes-sys" version = "2.1.0" @@ -167,6 +165,24 @@ dependencies = [ "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "bzip2" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bzip2-sys 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "bzip2-sys" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.34 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "capstone" version = "0.5.0" @@ -260,7 +276,7 @@ dependencies = [ [[package]] name = "cmake" -version = "0.1.37" +version = "0.1.38" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.34 (registry+https://github.com/rust-lang/crates.io-index)", @@ -383,7 +399,7 @@ dependencies = [ "cast 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)", "criterion-plot 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "csv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", + "csv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -480,10 +496,12 @@ dependencies = [ [[package]] name = "csv" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "csv-core 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -726,7 +744,7 @@ dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", - "http 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", + "http 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", "indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -759,7 +777,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "http" -version = "0.1.16" +version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", @@ -789,7 +807,7 @@ dependencies = [ "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", "futures-cpupool 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "h2 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", - "http 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", + "http 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", "httparse 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1297,6 +1315,11 @@ name = "plain" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "podio" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "proc-macro2" version = "0.4.27" @@ -1530,7 +1553,7 @@ dependencies = [ "encoding_rs 0.8.17 (registry+https://github.com/rust-lang/crates.io-index)", "flate2 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", - "http 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", + "http 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.12.25 (registry+https://github.com/rust-lang/crates.io-index)", "hyper-tls 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2171,7 +2194,7 @@ version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.34 (registry+https://github.com/rust-lang/crates.io-index)", - "cmake 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)", + "cmake 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)", "glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2385,7 +2408,7 @@ name = "wasmer-win-exception-handler" version = "0.2.0" dependencies = [ "bindgen 0.46.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cmake 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)", + "cmake 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "wasmer-runtime-core 0.2.1", @@ -2482,7 +2505,7 @@ dependencies = [ [[package]] name = "zbox" version = "0.6.1" -source = "git+https://github.com/wasmerio/zbox?branch=bundle-libsodium#c2a5a50317f587fd69585d1e8d9825daef24cc00" +source = "git+https://github.com/wasmerio/zbox?branch=bundle-libsodium#113c62bf3f94124c4978959043efcf98222fa626" dependencies = [ "android_logger 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2498,6 +2521,20 @@ dependencies = [ "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", "tar 0.4.22 (registry+https://github.com/rust-lang/crates.io-index)", + "tempfile 3.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "zip 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "zip" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bzip2 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", + "crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libflate 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", + "podio 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2549,6 +2586,8 @@ dependencies = [ "checksum build_const 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "39092a32794787acd8525ee150305ff051b0aa6cc2abaf193924f5ab05425f39" "checksum byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a019b10a2a7cdeb292db131fc8113e57ea2a908f6e7894b0c3c671893b65dbeb" "checksum bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)" = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c" +"checksum bzip2 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "42b7c3cbf0fa9c1b82308d57191728ca0256cb821220f4e2fd410a72ade26e3b" +"checksum bzip2-sys 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "6584aa36f5ad4c9247f5323b0a42f37802b37a836f0ad87084d7a33961abe25f" "checksum capstone 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "00be9d203fa0e078b93b24603633fb081851dfe0c1086364431f52587a47157e" "checksum capstone-sys 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2dc8d32bc5c1e6d0fcde10af411c98b07d93498d51654f678757f08fa2acd6a6" "checksum cast 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "926013f2860c46252efceabb19f4a6b308197505082c609025aa6706c011d427" @@ -2559,7 +2598,7 @@ dependencies = [ "checksum clang-sys 0.26.4 (registry+https://github.com/rust-lang/crates.io-index)" = "6ef0c1bcf2e99c649104bd7a7012d8f8802684400e03db0ec0af48583c6fa0e4" "checksum clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b957d88f4b6a63b9d70d5f454ac8011819c6efa7727858f458ab71c756ce2d3e" "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" -"checksum cmake 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)" = "c11b79fbf026d6ec02704f7248c6da99be02068bf57f624bb08af72ad29f2c06" +"checksum cmake 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)" = "96210eec534fc3fbfc0452a63769424eaa80205fda6cea98e5b61cb3d97bcec8" "checksum constant_time_eq 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8ff012e225ce166d4422e0e78419d901719760f62ae2b7969ca6b564d1b54a9e" "checksum core-foundation 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "286e0b41c3a20da26536c6000a280585d519fd07b3956b43aed8a79e9edce980" "checksum core-foundation-sys 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "716c271e8613ace48344f723b60b900a93150271e5be206212d052bbc0883efa" @@ -2581,7 +2620,7 @@ dependencies = [ "checksum crossbeam-queue 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7c979cd6cfe72335896575c6b5688da489e420d36a27a0b9eb0c73db574b4a4b" "checksum crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2760899e32a1d58d5abb31129f8fae5de75220bc2176e77ff7c627ae45c918d9" "checksum crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "f8306fcef4a7b563b76b7dd949ca48f52bc1141aa067d2ea09565f3e2652aa5c" -"checksum csv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "9fd1c44c58078cfbeaf11fbb3eac9ae5534c23004ed770cc4bfb48e658ae4f04" +"checksum csv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "f0782c7154d8dd08f4adeb5aa22ab178c10281915f7da68d10bb646f03aaee73" "checksum csv-core 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "fa5cdef62f37e6ffe7d1f07a381bc0db32b7a3ff1cac0de56cb0d81e71f53d65" "checksum digest 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "05f47366984d3ad862010e22c7ce81a7dbcaebbdfb37241a620f8b6596ee135c" "checksum dtoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6d301140eb411af13d3115f9a562c85cc6b541ade9dfa314132244aaee7489dd" @@ -2615,7 +2654,7 @@ dependencies = [ "checksum hashbrown 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3bae29b6653b3412c2e71e9d486db9f9df5d701941d86683005efb9f2d28e3da" "checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205" "checksum hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "805026a5d0141ffc30abb3be3173848ad46a1b1664fe632428479619a3644d77" -"checksum http 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "fe67e3678f2827030e89cc4b9e7ecd16d52f132c0b940ab5005f88e821500f6a" +"checksum http 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)" = "eed324f0f0daf6ec10c474f150505af2c143f251722bf9dbd1261bd1f2ee2c1a" "checksum httparse 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e8734b0cfd3bc3e101ec59100e101c2eecd19282202e87808b3037b442777a83" "checksum humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3ca7e5f2e110db35f93b837c81797f3714500b81d517bf20c431b16d3ca4f114" "checksum hyper 0.12.25 (registry+https://github.com/rust-lang/crates.io-index)" = "7d5b6658b016965ae301fa995306db965c93677880ea70765a84235a96eae896" @@ -2675,6 +2714,7 @@ dependencies = [ "checksum phf_shared 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)" = "234f71a15de2288bcb7e3b6515828d22af7ec8598ee6d24c3b526fa0a80b67a0" "checksum pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "676e8eb2b1b4c9043511a9b7bea0915320d7e502b0a079fb03f9635a5252b18c" "checksum plain 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6" +"checksum podio 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "780fb4b6698bbf9cf2444ea5d22411cef2953f0824b98f33cf454ec5615645bd" "checksum proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)" = "4d317f9caece796be1980837fd5cb3dfec5613ebdb04ad0956deea83ce168915" "checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0" "checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" @@ -2792,6 +2832,7 @@ dependencies = [ "checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" "checksum xattr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "244c3741f4240ef46274860397c7c74e50eb23624996930e484c16679633a54c" "checksum zbox 0.6.1 (git+https://github.com/wasmerio/zbox?branch=bundle-libsodium)" = "" +"checksum zip 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1cbbddef6339155bc4fa8e2609040078ff18f3011117b55caa9f0516d544a357" "checksum zstd 0.4.22+zstd.1.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "6f042dd18d52854d302d3d92f66d0a63c2d520d7b7034a9d43cde7441d1b4ddd" "checksum zstd-safe 1.4.7+zstd.1.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "63febf0b0dcd076db81e6b3110ed254cfb8ed54378a4c3cfbb68956e839d4f59" "checksum zstd-sys 1.4.8+zstd.1.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "4cb187d624025a7d9878ecf13437491869423426183ded2fa40d4651b85f7ae7" diff --git a/lib/emscripten/a.txt b/lib/emscripten/a.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/lib/emscripten/build/emtests.rs b/lib/emscripten/build/emtests.rs index 09c4419bff9..4a543683d6d 100644 --- a/lib/emscripten/build/emtests.rs +++ b/lib/emscripten/build/emtests.rs @@ -46,26 +46,42 @@ pub fn compile(file: &str, ignores: &Vec) -> Option { output_path.set_extension("js"); let output_str = output_path.to_str().unwrap(); - // Compile to wasm - let _wasm_compilation = Command::new("emcc") - .arg(file) - .arg("-s") - .arg("WASM=1") - .arg("-o") - .arg(output_str) - .output() - .expect("failed to execute process"); - - // panic!("{:?}", wasm_compilation); - // if output.stderr { - // panic!("{}", output.stderr); - // } - // Remove js file - - if Path::new(output_str).is_file() { - fs::remove_file(output_str).unwrap(); - } else { - println!("Output JS not found: {}", output_str); + let wasm_file_metadata = { + let mut wasm_file_path = PathBuf::from(file); + wasm_file_path.set_extension("wasm"); + if let Ok(wasm_file) = File::open(wasm_file_path) { + Some(wasm_file.metadata().unwrap()) + } else { + None + } + }; + + let real_file = File::open(file).unwrap(); + let file_metadata = real_file.metadata().unwrap(); + if wasm_file_metadata.is_none() + || file_metadata.modified().unwrap() >= wasm_file_metadata.unwrap().modified().unwrap() + { + // Compile to wasm + let _wasm_compilation = Command::new("emcc") + .arg(file) + .arg("-s") + .arg("WASM=1") + .arg("-o") + .arg(output_str) + .output() + .expect("failed to execute process"); + + // panic!("{:?}", wasm_compilation); + // if output.stderr { + // panic!("{}", output.stderr); + // } + // Remove js file + + if Path::new(output_str).is_file() { + fs::remove_file(output_str).unwrap(); + } else { + println!("Output JS not found: {}", output_str); + } } let mut output_path = PathBuf::from(file); diff --git a/lib/emscripten/emtests/hello.cpp b/lib/emscripten/emtests/hello.cpp new file mode 100644 index 00000000000..fd90a65b3d4 --- /dev/null +++ b/lib/emscripten/emtests/hello.cpp @@ -0,0 +1,4 @@ +#include +int main() { + std::cout << "hello world\n"; +} diff --git a/lib/emscripten/emtests/hello.out b/lib/emscripten/emtests/hello.out new file mode 100644 index 00000000000..9a71f81a4b4 --- /dev/null +++ b/lib/emscripten/emtests/hello.out @@ -0,0 +1,2 @@ +hello world + diff --git a/lib/emscripten/emtests/hello.wasm b/lib/emscripten/emtests/hello.wasm new file mode 100644 index 00000000000..4e954166551 Binary files /dev/null and b/lib/emscripten/emtests/hello.wasm differ diff --git a/lib/emscripten/emtests/ignores.txt b/lib/emscripten/emtests/ignores.txt index 5033a51c3fb..a68a29ef3b0 100644 --- a/lib/emscripten/emtests/ignores.txt +++ b/lib/emscripten/emtests/ignores.txt @@ -71,4 +71,47 @@ test_wprintf test_std_cout_new test_strptime_reentrant test_gmtime -test_time_c \ No newline at end of file +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 diff --git a/lib/emscripten/foo.txt b/lib/emscripten/foo.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/lib/emscripten/src/exception.rs b/lib/emscripten/src/exception.rs index 9044aff2a08..1f2b098d8ac 100644 --- a/lib/emscripten/src/exception.rs +++ b/lib/emscripten/src/exception.rs @@ -23,3 +23,8 @@ pub fn ___cxa_begin_catch(_ctx: &mut Ctx, _exception_object_ptr: u32) -> i32 { pub fn ___cxa_end_catch(_ctx: &mut Ctx) { debug!("emscripten::___cxa_end_catch"); } + +pub fn ___cxa_uncaught_exception(_ctx: &mut Ctx) -> i32 { + debug!("emscripten::___cxa_uncaught_exception"); + -1 +} diff --git a/lib/emscripten/src/lib.rs b/lib/emscripten/src/lib.rs index 958202c7a90..47ad8ace956 100644 --- a/lib/emscripten/src/lib.rs +++ b/lib/emscripten/src/lib.rs @@ -247,6 +247,12 @@ pub fn run_emscripten_instance( let data_ptr = &mut data as *mut _ as *mut c_void; instance.context_mut().data = data_ptr; + // ATINIT + // (used by C++) + if let Ok(_func) = instance.dyn_func("globalCtors") { + instance.call("globalCtors", &[])?; + } + if let Ok(_func) = instance.dyn_func("___emscripten_environ_constructor") { instance.call("___emscripten_environ_constructor", &[])?; } @@ -269,7 +275,7 @@ pub fn run_emscripten_instance( ), }; - // TODO atinit and atexit for emscripten + // TODO atexit for emscripten // println!("{:?}", data); Ok(()) } @@ -607,6 +613,7 @@ pub fn generate_emscripten_env(globals: &mut EmscriptenGlobals) -> ImportObject "___cxa_throw" => func!(crate::exception::___cxa_throw), "___cxa_begin_catch" => func!(crate::exception::___cxa_begin_catch), "___cxa_end_catch" => func!(crate::exception::___cxa_end_catch), + "___cxa_uncaught_exception" => func!(crate::exception::___cxa_uncaught_exception), // Time "_gettimeofday" => func!(crate::time::_gettimeofday), @@ -619,6 +626,7 @@ pub fn generate_emscripten_env(globals: &mut EmscriptenGlobals) -> ImportObject "_localtime" => func!(crate::time::_localtime), "_time" => func!(crate::time::_time), "_strftime" => func!(crate::time::_strftime), + "_strftime_l" => func!(crate::time::_strftime_l), "_localtime_r" => func!(crate::time::_localtime_r), "_gmtime_r" => func!(crate::time::_gmtime_r), "_mktime" => func!(crate::time::_mktime), diff --git a/lib/emscripten/src/time.rs b/lib/emscripten/src/time.rs index 28a60ec34b8..1f93f3894ae 100644 --- a/lib/emscripten/src/time.rs +++ b/lib/emscripten/src/time.rs @@ -310,3 +310,20 @@ pub fn _strftime( ); 0 } + +/// emscripten: _strftime_l +pub fn _strftime_l( + ctx: &mut Ctx, + s_ptr: c_int, + maxsize: u32, + format_ptr: c_int, + tm_ptr: c_int, + _last: c_int, +) -> i32 { + debug!( + "emscripten::_strftime_l {} {} {} {}", + s_ptr, maxsize, format_ptr, tm_ptr + ); + + _strftime(ctx, s_ptr, maxsize, format_ptr, tm_ptr) +} diff --git a/lib/emscripten/tests/emtests/mod.rs b/lib/emscripten/tests/emtests/mod.rs index 89a66bf2b84..64535122779 100644 --- a/lib/emscripten/tests/emtests/mod.rs +++ b/lib/emscripten/tests/emtests/mod.rs @@ -176,6 +176,7 @@ 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; diff --git a/lib/emscripten/tests/emtests/test_execvp.rs b/lib/emscripten/tests/emtests/test_execvp.rs index c9b4b511306..085e41d9ab7 100644 --- a/lib/emscripten/tests/emtests/test_execvp.rs +++ b/lib/emscripten/tests/emtests/test_execvp.rs @@ -1,17 +1,10 @@ #[test] -fn test_execvp() { - #[cfg(not(target_os = "windows"))] +#[ignore] +fn test_test_execvp() { assert_emscripten_output!( "../../emtests/test_execvp.wasm", "test_execvp", vec![], "../../emtests/test_execvp.out" ); - #[cfg(target_os = "windows")] - assert_emscripten_output!( - "../../emtests/test_execvp_windows.wasm", - "test_execvp", - vec![], - "../../emtests/test_execvp.out" - ); } diff --git a/lib/emscripten/tests/emtests/test_getcwd.rs b/lib/emscripten/tests/emtests/test_getcwd.rs index ec770b50577..98723df87bb 100644 --- a/lib/emscripten/tests/emtests/test_getcwd.rs +++ b/lib/emscripten/tests/emtests/test_getcwd.rs @@ -1,8 +1,8 @@ #[test] -fn test_getcwd() { +fn test_test_getcwd() { assert_emscripten_output!( "../../emtests/test_getcwd.wasm", - "getcwd", + "test_getcwd", vec![], "../../emtests/test_getcwd.out" ); diff --git a/lib/emscripten/tests/emtests/test_nl_types.rs b/lib/emscripten/tests/emtests/test_nl_types.rs index 101ee48941f..68b81c56218 100644 --- a/lib/emscripten/tests/emtests/test_nl_types.rs +++ b/lib/emscripten/tests/emtests/test_nl_types.rs @@ -1,4 +1,5 @@ #[test] +#[ignore] fn test_test_nl_types() { assert_emscripten_output!( "../../emtests/test_nl_types.wasm", diff --git a/lib/emscripten/tests/emtests/test_phiundef.rs b/lib/emscripten/tests/emtests/test_phiundef.rs index fbe4203f7c7..e3cba2c0f8d 100644 --- a/lib/emscripten/tests/emtests/test_phiundef.rs +++ b/lib/emscripten/tests/emtests/test_phiundef.rs @@ -1,4 +1,5 @@ #[test] +#[ignore] fn test_test_phiundef() { assert_emscripten_output!( "../../emtests/test_phiundef.wasm", diff --git a/lib/emscripten/tests/emtests/test_pipe.rs b/lib/emscripten/tests/emtests/test_pipe.rs index 9ffe0c82820..e7caee28b90 100644 --- a/lib/emscripten/tests/emtests/test_pipe.rs +++ b/lib/emscripten/tests/emtests/test_pipe.rs @@ -1,8 +1,10 @@ -use crate::emtests::_common::assert_emscripten_output; - #[test] -fn test_pipe() { - let wasm_bytes = include_bytes!("../../emtests/test_pipe.wasm"); - let expected_str = include_str!("../../emtests/test_pipe.out"); - assert_emscripten_output(wasm_bytes, expected_str); +#[ignore] +fn test_test_pipe() { + assert_emscripten_output!( + "../../emtests/test_pipe.wasm", + "test_pipe", + vec![], + "../../emtests/test_pipe.out" + ); } diff --git a/lib/emscripten/tests/emtests/test_printf_2.rs b/lib/emscripten/tests/emtests/test_printf_2.rs index 62151b8a4b0..ac15139bfcd 100644 --- a/lib/emscripten/tests/emtests/test_printf_2.rs +++ b/lib/emscripten/tests/emtests/test_printf_2.rs @@ -1,4 +1,5 @@ #[test] +#[ignore] fn test_test_printf_2() { assert_emscripten_output!( "../../emtests/test_printf_2.wasm", diff --git a/lib/emscripten/tests/emtests/test_printf_more.rs b/lib/emscripten/tests/emtests/test_printf_more.rs index 6dc34233f9d..b1e4fc00f4a 100644 --- a/lib/emscripten/tests/emtests/test_printf_more.rs +++ b/lib/emscripten/tests/emtests/test_printf_more.rs @@ -1,4 +1,5 @@ #[test] +#[ignore] fn test_test_printf_more() { assert_emscripten_output!( "../../emtests/test_printf_more.wasm", diff --git a/lib/emscripten/tests/emtests/test_regex.rs b/lib/emscripten/tests/emtests/test_regex.rs index 03ab62295a0..ae65d8ef954 100644 --- a/lib/emscripten/tests/emtests/test_regex.rs +++ b/lib/emscripten/tests/emtests/test_regex.rs @@ -1,4 +1,5 @@ #[test] +#[ignore] fn test_test_regex() { assert_emscripten_output!( "../../emtests/test_regex.wasm", diff --git a/lib/emscripten/tests/emtests/test_relocatable_void_function.rs b/lib/emscripten/tests/emtests/test_relocatable_void_function.rs index 7cdd382b87f..77dda77ba39 100644 --- a/lib/emscripten/tests/emtests/test_relocatable_void_function.rs +++ b/lib/emscripten/tests/emtests/test_relocatable_void_function.rs @@ -1,4 +1,5 @@ #[test] +#[ignore] fn test_test_relocatable_void_function() { assert_emscripten_output!( "../../emtests/test_relocatable_void_function.wasm", diff --git a/lib/emscripten/tests/emtests/test_rounding.rs b/lib/emscripten/tests/emtests/test_rounding.rs index defd8df6f6c..cbe0a8ff577 100644 --- a/lib/emscripten/tests/emtests/test_rounding.rs +++ b/lib/emscripten/tests/emtests/test_rounding.rs @@ -1,4 +1,5 @@ #[test] +#[ignore] fn test_test_rounding() { assert_emscripten_output!( "../../emtests/test_rounding.wasm", diff --git a/lib/emscripten/tests/emtests/test_set_align.rs b/lib/emscripten/tests/emtests/test_set_align.rs index 039d7f0c823..47aa7c3dd19 100644 --- a/lib/emscripten/tests/emtests/test_set_align.rs +++ b/lib/emscripten/tests/emtests/test_set_align.rs @@ -1,4 +1,5 @@ #[test] +#[ignore] fn test_test_set_align() { assert_emscripten_output!( "../../emtests/test_set_align.wasm", diff --git a/lib/emscripten/tests/emtests/test_sintvars.rs b/lib/emscripten/tests/emtests/test_sintvars.rs index cf506e10c57..f74daa8b1a3 100644 --- a/lib/emscripten/tests/emtests/test_sintvars.rs +++ b/lib/emscripten/tests/emtests/test_sintvars.rs @@ -1,4 +1,5 @@ #[test] +#[ignore] fn test_test_sintvars() { assert_emscripten_output!( "../../emtests/test_sintvars.wasm", diff --git a/lib/emscripten/tests/emtests/test_sizeof.rs b/lib/emscripten/tests/emtests/test_sizeof.rs index 516f0c58f0c..53e8cf19fc3 100644 --- a/lib/emscripten/tests/emtests/test_sizeof.rs +++ b/lib/emscripten/tests/emtests/test_sizeof.rs @@ -1,4 +1,5 @@ #[test] +#[ignore] fn test_test_sizeof() { assert_emscripten_output!( "../../emtests/test_sizeof.wasm", diff --git a/lib/emscripten/tests/emtests/test_sscanf.rs b/lib/emscripten/tests/emtests/test_sscanf.rs index 72353b9db61..e3072841fbb 100644 --- a/lib/emscripten/tests/emtests/test_sscanf.rs +++ b/lib/emscripten/tests/emtests/test_sscanf.rs @@ -1,4 +1,5 @@ #[test] +#[ignore] fn test_test_sscanf() { assert_emscripten_output!( "../../emtests/test_sscanf.wasm", diff --git a/lib/emscripten/tests/emtests/test_sscanf_3.rs b/lib/emscripten/tests/emtests/test_sscanf_3.rs index 816045fd543..c331db881f2 100644 --- a/lib/emscripten/tests/emtests/test_sscanf_3.rs +++ b/lib/emscripten/tests/emtests/test_sscanf_3.rs @@ -1,4 +1,5 @@ #[test] +#[ignore] fn test_test_sscanf_3() { assert_emscripten_output!( "../../emtests/test_sscanf_3.wasm", diff --git a/lib/emscripten/tests/emtests/test_sscanf_4.rs b/lib/emscripten/tests/emtests/test_sscanf_4.rs index d859d1767f5..a9a959f3816 100644 --- a/lib/emscripten/tests/emtests/test_sscanf_4.rs +++ b/lib/emscripten/tests/emtests/test_sscanf_4.rs @@ -1,4 +1,5 @@ #[test] +#[ignore] fn test_test_sscanf_4() { assert_emscripten_output!( "../../emtests/test_sscanf_4.wasm", diff --git a/lib/emscripten/tests/emtests/test_sscanf_5.rs b/lib/emscripten/tests/emtests/test_sscanf_5.rs index 22d4d5315f2..05801407fe2 100644 --- a/lib/emscripten/tests/emtests/test_sscanf_5.rs +++ b/lib/emscripten/tests/emtests/test_sscanf_5.rs @@ -1,4 +1,5 @@ #[test] +#[ignore] fn test_test_sscanf_5() { assert_emscripten_output!( "../../emtests/test_sscanf_5.wasm", diff --git a/lib/emscripten/tests/emtests/test_sscanf_6.rs b/lib/emscripten/tests/emtests/test_sscanf_6.rs index 52be269499b..d9771ca133e 100644 --- a/lib/emscripten/tests/emtests/test_sscanf_6.rs +++ b/lib/emscripten/tests/emtests/test_sscanf_6.rs @@ -1,4 +1,5 @@ #[test] +#[ignore] fn test_test_sscanf_6() { assert_emscripten_output!( "../../emtests/test_sscanf_6.wasm", diff --git a/lib/emscripten/tests/emtests/test_sscanf_caps.rs b/lib/emscripten/tests/emtests/test_sscanf_caps.rs index 5f2d64b9035..f88ec7e76c0 100644 --- a/lib/emscripten/tests/emtests/test_sscanf_caps.rs +++ b/lib/emscripten/tests/emtests/test_sscanf_caps.rs @@ -1,4 +1,5 @@ #[test] +#[ignore] fn test_test_sscanf_caps() { assert_emscripten_output!( "../../emtests/test_sscanf_caps.wasm", diff --git a/lib/emscripten/tests/emtests/test_sscanf_float.rs b/lib/emscripten/tests/emtests/test_sscanf_float.rs index 39d3b5cba93..f98c0b2d0a8 100644 --- a/lib/emscripten/tests/emtests/test_sscanf_float.rs +++ b/lib/emscripten/tests/emtests/test_sscanf_float.rs @@ -1,4 +1,5 @@ #[test] +#[ignore] fn test_test_sscanf_float() { assert_emscripten_output!( "../../emtests/test_sscanf_float.wasm", diff --git a/lib/emscripten/tests/emtests/test_sscanf_n.rs b/lib/emscripten/tests/emtests/test_sscanf_n.rs index 57f90b14242..596c70307b8 100644 --- a/lib/emscripten/tests/emtests/test_sscanf_n.rs +++ b/lib/emscripten/tests/emtests/test_sscanf_n.rs @@ -1,4 +1,5 @@ #[test] +#[ignore] fn test_test_sscanf_n() { assert_emscripten_output!( "../../emtests/test_sscanf_n.wasm", diff --git a/lib/emscripten/tests/emtests/test_strcasecmp.rs b/lib/emscripten/tests/emtests/test_strcasecmp.rs index 29401787253..4c0a9ed9ec6 100644 --- a/lib/emscripten/tests/emtests/test_strcasecmp.rs +++ b/lib/emscripten/tests/emtests/test_strcasecmp.rs @@ -1,4 +1,5 @@ #[test] +#[ignore] fn test_test_strcasecmp() { assert_emscripten_output!( "../../emtests/test_strcasecmp.wasm", diff --git a/lib/emscripten/tests/emtests/test_strcmp_uni.rs b/lib/emscripten/tests/emtests/test_strcmp_uni.rs index e729c00aeff..5691e4f5736 100644 --- a/lib/emscripten/tests/emtests/test_strcmp_uni.rs +++ b/lib/emscripten/tests/emtests/test_strcmp_uni.rs @@ -1,4 +1,5 @@ #[test] +#[ignore] fn test_test_strcmp_uni() { assert_emscripten_output!( "../../emtests/test_strcmp_uni.wasm", diff --git a/lib/emscripten/tests/emtests/test_strndup.rs b/lib/emscripten/tests/emtests/test_strndup.rs index 62ac406e98d..7fdb25bbe1a 100644 --- a/lib/emscripten/tests/emtests/test_strndup.rs +++ b/lib/emscripten/tests/emtests/test_strndup.rs @@ -1,4 +1,5 @@ #[test] +#[ignore] fn test_test_strndup() { assert_emscripten_output!( "../../emtests/test_strndup.wasm", diff --git a/lib/emscripten/tests/emtests/test_strstr.rs b/lib/emscripten/tests/emtests/test_strstr.rs index 080d3bbda15..86af149e822 100644 --- a/lib/emscripten/tests/emtests/test_strstr.rs +++ b/lib/emscripten/tests/emtests/test_strstr.rs @@ -1,4 +1,5 @@ #[test] +#[ignore] fn test_test_strstr() { assert_emscripten_output!( "../../emtests/test_strstr.wasm", diff --git a/lib/emscripten/tests/emtests/test_strtod.rs b/lib/emscripten/tests/emtests/test_strtod.rs index cab75598276..52bb1987e4c 100644 --- a/lib/emscripten/tests/emtests/test_strtod.rs +++ b/lib/emscripten/tests/emtests/test_strtod.rs @@ -1,4 +1,5 @@ #[test] +#[ignore] fn test_test_strtod() { assert_emscripten_output!( "../../emtests/test_strtod.wasm", diff --git a/lib/emscripten/tests/emtests/test_strtok.rs b/lib/emscripten/tests/emtests/test_strtok.rs index 1399ef683b8..cef228e857c 100644 --- a/lib/emscripten/tests/emtests/test_strtok.rs +++ b/lib/emscripten/tests/emtests/test_strtok.rs @@ -1,4 +1,5 @@ #[test] +#[ignore] fn test_test_strtok() { assert_emscripten_output!( "../../emtests/test_strtok.wasm", diff --git a/lib/emscripten/tests/emtests/test_strtol_bin.rs b/lib/emscripten/tests/emtests/test_strtol_bin.rs index fd847c186aa..48f459556a1 100644 --- a/lib/emscripten/tests/emtests/test_strtol_bin.rs +++ b/lib/emscripten/tests/emtests/test_strtol_bin.rs @@ -1,4 +1,5 @@ #[test] +#[ignore] fn test_test_strtol_bin() { assert_emscripten_output!( "../../emtests/test_strtol_bin.wasm", diff --git a/lib/emscripten/tests/emtests/test_strtol_dec.rs b/lib/emscripten/tests/emtests/test_strtol_dec.rs index a485bfa9757..7a3a6e89a6c 100644 --- a/lib/emscripten/tests/emtests/test_strtol_dec.rs +++ b/lib/emscripten/tests/emtests/test_strtol_dec.rs @@ -1,4 +1,5 @@ #[test] +#[ignore] fn test_test_strtol_dec() { assert_emscripten_output!( "../../emtests/test_strtol_dec.wasm", diff --git a/lib/emscripten/tests/emtests/test_strtol_hex.rs b/lib/emscripten/tests/emtests/test_strtol_hex.rs index 57f10825964..257e14b35cd 100644 --- a/lib/emscripten/tests/emtests/test_strtol_hex.rs +++ b/lib/emscripten/tests/emtests/test_strtol_hex.rs @@ -1,4 +1,5 @@ #[test] +#[ignore] fn test_test_strtol_hex() { assert_emscripten_output!( "../../emtests/test_strtol_hex.wasm", diff --git a/lib/emscripten/tests/emtests/test_strtol_oct.rs b/lib/emscripten/tests/emtests/test_strtol_oct.rs index 9e4340f04a5..ba9fa1a7853 100644 --- a/lib/emscripten/tests/emtests/test_strtol_oct.rs +++ b/lib/emscripten/tests/emtests/test_strtol_oct.rs @@ -1,4 +1,5 @@ #[test] +#[ignore] fn test_test_strtol_oct() { assert_emscripten_output!( "../../emtests/test_strtol_oct.wasm", diff --git a/lib/emscripten/tests/emtests/test_strtoll_bin.rs b/lib/emscripten/tests/emtests/test_strtoll_bin.rs index 1276f0c859b..0e067ef72bc 100644 --- a/lib/emscripten/tests/emtests/test_strtoll_bin.rs +++ b/lib/emscripten/tests/emtests/test_strtoll_bin.rs @@ -1,4 +1,5 @@ #[test] +#[ignore] fn test_test_strtoll_bin() { assert_emscripten_output!( "../../emtests/test_strtoll_bin.wasm", diff --git a/lib/emscripten/tests/emtests/test_strtoll_dec.rs b/lib/emscripten/tests/emtests/test_strtoll_dec.rs index 6e902d0ede6..a073eb05dd2 100644 --- a/lib/emscripten/tests/emtests/test_strtoll_dec.rs +++ b/lib/emscripten/tests/emtests/test_strtoll_dec.rs @@ -1,4 +1,5 @@ #[test] +#[ignore] fn test_test_strtoll_dec() { assert_emscripten_output!( "../../emtests/test_strtoll_dec.wasm", diff --git a/lib/emscripten/tests/emtests/test_strtoll_hex.rs b/lib/emscripten/tests/emtests/test_strtoll_hex.rs index cc98e0fd0e2..8bb61fa1b38 100644 --- a/lib/emscripten/tests/emtests/test_strtoll_hex.rs +++ b/lib/emscripten/tests/emtests/test_strtoll_hex.rs @@ -1,4 +1,5 @@ #[test] +#[ignore] fn test_test_strtoll_hex() { assert_emscripten_output!( "../../emtests/test_strtoll_hex.wasm", diff --git a/lib/emscripten/tests/emtests/test_strtoll_oct.rs b/lib/emscripten/tests/emtests/test_strtoll_oct.rs index 13ed7f5b284..8a96615d66d 100644 --- a/lib/emscripten/tests/emtests/test_strtoll_oct.rs +++ b/lib/emscripten/tests/emtests/test_strtoll_oct.rs @@ -1,4 +1,5 @@ #[test] +#[ignore] fn test_test_strtoll_oct() { assert_emscripten_output!( "../../emtests/test_strtoll_oct.wasm", diff --git a/lib/emscripten/tests/emtests/test_struct_varargs.rs b/lib/emscripten/tests/emtests/test_struct_varargs.rs index 71f66595b88..211164a29b8 100644 --- a/lib/emscripten/tests/emtests/test_struct_varargs.rs +++ b/lib/emscripten/tests/emtests/test_struct_varargs.rs @@ -1,4 +1,5 @@ #[test] +#[ignore] fn test_test_struct_varargs() { assert_emscripten_output!( "../../emtests/test_struct_varargs.wasm", diff --git a/lib/emscripten/tests/emtests/test_transtrcase.rs b/lib/emscripten/tests/emtests/test_transtrcase.rs index f9d1692876b..d0c7079c9a8 100644 --- a/lib/emscripten/tests/emtests/test_transtrcase.rs +++ b/lib/emscripten/tests/emtests/test_transtrcase.rs @@ -1,4 +1,5 @@ #[test] +#[ignore] fn test_test_transtrcase() { assert_emscripten_output!( "../../emtests/test_transtrcase.wasm", diff --git a/lib/emscripten/tests/emtests/test_trickystring.rs b/lib/emscripten/tests/emtests/test_trickystring.rs index cf569852845..f04295c9280 100644 --- a/lib/emscripten/tests/emtests/test_trickystring.rs +++ b/lib/emscripten/tests/emtests/test_trickystring.rs @@ -1,4 +1,5 @@ #[test] +#[ignore] fn test_test_trickystring() { assert_emscripten_output!( "../../emtests/test_trickystring.wasm", diff --git a/lib/emscripten/tests/emtests/test_unary_literal.rs b/lib/emscripten/tests/emtests/test_unary_literal.rs index 06f61b92c65..fc58fa28812 100644 --- a/lib/emscripten/tests/emtests/test_unary_literal.rs +++ b/lib/emscripten/tests/emtests/test_unary_literal.rs @@ -1,4 +1,5 @@ #[test] +#[ignore] fn test_test_unary_literal() { assert_emscripten_output!( "../../emtests/test_unary_literal.wasm", diff --git a/lib/emscripten/tests/emtests/test_vfs.rs b/lib/emscripten/tests/emtests/test_vfs.rs index 11acd461604..afd33904224 100644 --- a/lib/emscripten/tests/emtests/test_vfs.rs +++ b/lib/emscripten/tests/emtests/test_vfs.rs @@ -1,8 +1,10 @@ -use crate::emtests::_common::assert_emscripten_output; - #[test] -fn test_vfs() { - let wasm_bytes = include_bytes!("../../emtests/test_vfs_bundle.wasm"); - let expected_str = include_str!("../../emtests/test_vfs.out"); - assert_emscripten_output(wasm_bytes, expected_str); +#[ignore] +fn test_test_vfs() { + assert_emscripten_output!( + "../../emtests/test_vfs.wasm", + "test_vfs", + vec![], + "../../emtests/test_vfs.out" + ); } diff --git a/lib/emscripten/tests/emtests/test_vprintf.rs b/lib/emscripten/tests/emtests/test_vprintf.rs index 1a5cdb142a7..18fa6301886 100644 --- a/lib/emscripten/tests/emtests/test_vprintf.rs +++ b/lib/emscripten/tests/emtests/test_vprintf.rs @@ -1,4 +1,5 @@ #[test] +#[ignore] fn test_test_vprintf() { assert_emscripten_output!( "../../emtests/test_vprintf.wasm", diff --git a/lib/emscripten/tests/emtests/test_vsnprintf.rs b/lib/emscripten/tests/emtests/test_vsnprintf.rs index c5cbbf091da..f1125446453 100644 --- a/lib/emscripten/tests/emtests/test_vsnprintf.rs +++ b/lib/emscripten/tests/emtests/test_vsnprintf.rs @@ -1,4 +1,5 @@ #[test] +#[ignore] fn test_test_vsnprintf() { assert_emscripten_output!( "../../emtests/test_vsnprintf.wasm", diff --git a/lib/emscripten/tests/emtests/test_write_stdout_fileno.rs b/lib/emscripten/tests/emtests/test_write_stdout_fileno.rs index df3da00a53f..debdc6530b0 100644 --- a/lib/emscripten/tests/emtests/test_write_stdout_fileno.rs +++ b/lib/emscripten/tests/emtests/test_write_stdout_fileno.rs @@ -1,4 +1,5 @@ #[test] +#[ignore] fn test_test_write_stdout_fileno() { assert_emscripten_output!( "../../emtests/test_write_stdout_fileno.wasm", diff --git a/lib/emscripten/tests/emtests/test_zerodiv.rs b/lib/emscripten/tests/emtests/test_zerodiv.rs index 86712f6b5cd..df68359d3f6 100644 --- a/lib/emscripten/tests/emtests/test_zerodiv.rs +++ b/lib/emscripten/tests/emtests/test_zerodiv.rs @@ -1,4 +1,5 @@ #[test] +#[ignore] fn test_test_zerodiv() { assert_emscripten_output!( "../../emtests/test_zerodiv.wasm", diff --git a/src/bin/wasmer.rs b/src/bin/wasmer.rs index 6964d7ce1f3..34550355805 100644 --- a/src/bin/wasmer.rs +++ b/src/bin/wasmer.rs @@ -17,6 +17,20 @@ use wasmer_runtime_core::{self, backend::CompilerConfig}; #[cfg(feature = "wasi")] use wasmer_wasi; +// stub module to make conditional compilation happy +#[cfg(not(feature = "wasi"))] +mod wasmer_wasi { + use wasmer_runtime_core::{import::ImportObject, module::Module}; + + pub fn is_wasi_module(_module: &Module) -> bool { + false + } + + pub fn generate_import_object(_args: Vec>, _envs: Vec>) -> ImportObject { + unimplemented!() + } +} + #[derive(Debug, StructOpt)] #[structopt(name = "wasmer", about = "Wasm execution runtime.")] /// The options for the wasmer Command Line Interface @@ -213,7 +227,6 @@ fn execute_wasm(options: &Run) -> Result<(), String> { }; // TODO: refactor this - #[cfg(not(feature = "wasi"))] let (abi, import_object, _em_globals) = if wasmer_emscripten::is_emscripten_module(&module) { let mut emscripten_globals = wasmer_emscripten::EmscriptenGlobals::new(&module); ( @@ -222,34 +235,29 @@ fn execute_wasm(options: &Run) -> Result<(), String> { Some(emscripten_globals), // TODO Em Globals is here to extend, lifetime, find better solution ) } else { - ( - InstanceABI::None, - wasmer_runtime_core::import::ImportObject::new(), - None, - ) - }; - - #[cfg(feature = "wasi")] - let (abi, import_object) = if wasmer_wasi::is_wasi_module(&module) { - ( - InstanceABI::WASI, - wasmer_wasi::generate_import_object( - [options.path.to_str().unwrap().to_owned()] - .iter() - .chain(options.args.iter()) - .cloned() - .map(|arg| arg.into_bytes()) - .collect(), - env::vars() - .map(|(k, v)| format!("{}={}", k, v).into_bytes()) - .collect(), - ), - ) - } else { - ( - InstanceABI::None, - wasmer_runtime_core::import::ImportObject::new(), - ) + if cfg!(feature = "wasi") && wasmer_wasi::is_wasi_module(&module) { + ( + InstanceABI::WASI, + wasmer_wasi::generate_import_object( + [options.path.to_str().unwrap().to_owned()] + .iter() + .chain(options.args.iter()) + .cloned() + .map(|arg| arg.into_bytes()) + .collect(), + env::vars() + .map(|(k, v)| format!("{}={}", k, v).into_bytes()) + .collect(), + ), + None, + ) + } else { + ( + InstanceABI::None, + wasmer_runtime_core::import::ImportObject::new(), + None, + ) + } }; let mut instance = module