From ce14c6c0795ae85c2cbc84486f9d1c4a576b17d0 Mon Sep 17 00:00:00 2001 From: Syrus Date: Wed, 15 Apr 2020 16:31:05 -0700 Subject: [PATCH] Second part of the refactor --- Cargo.lock | 26 +- Cargo.toml | 28 +- Makefile | 124 ++- build.rs | 234 +++-- lib/runtime/src/lib.rs | 34 +- lib/wasi/Cargo.toml | 1 + lib/wasi/src/state/builder.rs | 11 +- lib/wasi/src/state/types.rs | 26 +- src/bin/wasmer.rs | 40 +- src/commands.rs | 13 +- src/commands/run.rs | 7 +- tests/custom/call-indirect-spilled-stack.wast | 35 + tests/{spectests => custom}/fac.wast | 0 tests/custom/multiple-traps.wast | 10 + .../nan-canonicalization.wast} | 31 +- .../emtests/clock_gettime.out | 1 - tests/emscripten_resources/emtests/env.out | 11 - tests/emscripten_resources/emtests/hello.out | 1 - .../emscripten_resources/emtests/ignores.txt | 109 --- .../emtests/localtime.out | 1 - tests/emscripten_resources/emtests/printf.out | 29 - tests/emscripten_resources/emtests/puts.out | 4 - .../emtests/test_addr_of_stacked.out | 1 - .../emtests/test_alloca.out | 1 - .../emtests/test_alloca_stack.out | 1 - .../emtests/test_array2.out | 1 - .../emtests/test_array2b.out | 2 - .../emtests/test_atoX.out | 3 - .../emtests/test_atomic.out | 5 - .../emtests/test_bsearch.out | 10 - .../emtests/test_complex.out | 8 - .../emtests/test_double_varargs.out | 2 - .../emscripten_resources/emtests/test_erf.out | 1 - .../emtests/test_errar.out | 4 - .../emtests/test_execvp.out | 1 - .../emtests/test_fast_math.out | 1 - .../emtests/test_fcvt.out | 1 - tests/emtest.rs | 75 +- tests/emtests/_common.rs | 110 --- tests/emtests/clock_gettime.rs | 9 - .../emscripten_get_compiler_setting.rs | 10 - tests/emtests/env.rs | 9 - tests/emtests/fs_exports.rs | 10 - tests/emtests/getvalue_setvalue.rs | 10 - .../legacy_exported_runtime_numbers.rs | 10 - tests/emtests/localtime.rs | 9 - tests/emtests/mod.rs | 185 ---- tests/emtests/modularize_closure_pre.rs | 10 - tests/emtests/printf.rs | 9 - tests/emtests/puts.rs | 9 - tests/emtests/stackalloc.rs | 10 - tests/emtests/syscalls.rs | 0 tests/emtests/test_addr_of_stacked.rs | 9 - tests/emtests/test_alloca.rs | 9 - tests/emtests/test_alloca_stack.rs | 9 - tests/emtests/test_array2.rs | 9 - tests/emtests/test_array2b.rs | 9 - tests/emtests/test_atomic.rs | 9 - tests/emtests/test_atox.rs | 9 - tests/emtests/test_bsearch.rs | 9 - tests/emtests/test_ccall.rs | 10 - tests/emtests/test_complex.rs | 9 - tests/emtests/test_demangle_stacks.rs | 10 - .../emtests/test_demangle_stacks_noassert.rs | 10 - tests/emtests/test_dlmalloc_partial_2.rs | 10 - tests/emtests/test_double_varargs.rs | 9 - tests/emtests/test_em_asm.rs | 10 - tests/emtests/test_em_asm_2.rs | 10 - tests/emtests/test_em_asm_parameter_pack.rs | 10 - tests/emtests/test_em_asm_signatures.rs | 10 - tests/emtests/test_em_asm_unicode.rs | 10 - tests/emtests/test_em_asm_unused_arguments.rs | 10 - tests/emtests/test_em_js.rs | 10 - tests/emtests/test_emscripten_api.rs | 10 - tests/emtests/test_erf.rs | 9 - tests/emtests/test_errar.rs | 9 - tests/emtests/test_exceptions_2.rs | 10 - tests/emtests/test_exceptions_multi.rs | 10 - tests/emtests/test_exceptions_std.rs | 10 - tests/emtests/test_exceptions_white_list.rs | 10 - tests/emtests/test_execvp.rs | 10 - tests/emtests/test_fast_math.rs | 10 - tests/emtests/test_flexarray_struct.rs | 9 - tests/emtests/test_float32_precise.rs | 9 - tests/emtests/test_float_builtins.rs | 10 - tests/emtests/test_frexp.rs | 9 - tests/emtests/test_funcptr.rs | 9 - tests/emtests/test_funcptr_namecollide.rs | 9 - tests/emtests/test_funcptrfunc.rs | 9 - tests/emtests/test_funcs.rs | 9 - .../test_functionpointer_libfunc_varargs.rs | 9 - tests/emtests/test_fwrite_0.rs | 9 - tests/emtests/test_getcwd.rs | 9 - tests/emtests/test_getgep.rs | 9 - tests/emtests/test_getloadavg.rs | 10 - tests/emtests/test_getopt.rs | 10 - tests/emtests/test_getopt_long.rs | 10 - tests/emtests/test_globaldoubles.rs | 9 - tests/emtests/test_globals.rs | 9 - tests/emtests/test_gmtime.rs | 10 - tests/emtests/test_hello_world.rs | 9 - tests/emtests/test_i16_emcc_intrinsic.rs | 10 - tests/emtests/test_i32_mul_precise.rs | 9 - tests/emtests/test_i64.rs | 10 - tests/emtests/test_i64_4.rs | 9 - tests/emtests/test_i64_7z.rs | 10 - tests/emtests/test_i64_cmp2.rs | 9 - tests/emtests/test_i64_i16.rs | 9 - tests/emtests/test_i64_llabs.rs | 9 - tests/emtests/test_i64_precise.rs | 9 - tests/emtests/test_i64_precise_needed.rs | 9 - tests/emtests/test_i64_precise_unneeded.rs | 9 - tests/emtests/test_i64_qdouble.rs | 9 - tests/emtests/test_i64_umul.rs | 9 - tests/emtests/test_i64_varargs.rs | 10 - tests/emtests/test_i64_zextneg.rs | 9 - tests/emtests/test_if.rs | 9 - tests/emtests/test_if_else.rs | 9 - tests/emtests/test_indirectbr.rs | 9 - tests/emtests/test_indirectbr_many.rs | 10 - tests/emtests/test_isnan.rs | 9 - tests/emtests/test_libcextra.rs | 9 - tests/emtests/test_libgen.rs | 9 - tests/emtests/test_literal_negative_zero.rs | 9 - tests/emtests/test_llrint.rs | 9 - tests/emtests/test_llvm_fabs.rs | 9 - tests/emtests/test_llvm_intrinsics.rs | 10 - tests/emtests/test_llvmswitch.rs | 9 - tests/emtests/test_longjmp.rs | 9 - tests/emtests/test_longjmp2.rs | 9 - tests/emtests/test_longjmp3.rs | 9 - tests/emtests/test_longjmp4.rs | 9 - tests/emtests/test_longjmp_exc.rs | 10 - tests/emtests/test_longjmp_funcptr.rs | 9 - tests/emtests/test_longjmp_repeat.rs | 9 - tests/emtests/test_longjmp_stacked.rs | 9 - tests/emtests/test_longjmp_throw.rs | 9 - tests/emtests/test_longjmp_unwind.rs | 9 - tests/emtests/test_loop.rs | 9 - tests/emtests/test_lower_intrinsics.rs | 10 - .../emtests/test_main_thread_async_em_asm.rs | 10 - tests/emtests/test_mainenv.rs | 10 - tests/emtests/test_mathfuncptr.rs | 10 - tests/emtests/test_memcpy2.rs | 9 - tests/emtests/test_memcpy3.rs | 9 - tests/emtests/test_memcpy_memcmp.rs | 10 - tests/emtests/test_memmove.rs | 9 - tests/emtests/test_memmove2.rs | 9 - tests/emtests/test_memmove3.rs | 9 - tests/emtests/test_memset.rs | 9 - tests/emtests/test_mmap.rs | 10 - tests/emtests/test_negative_zero.rs | 9 - tests/emtests/test_nested_struct_varargs.rs | 9 - tests/emtests/test_nl_types.rs | 10 - tests/emtests/test_perrar.rs | 10 - tests/emtests/test_phiundef.rs | 10 - tests/emtests/test_pipe.rs | 10 - tests/emtests/test_poll.rs | 10 - tests/emtests/test_posixtime.rs | 10 - tests/emtests/test_printf_2.rs | 10 - tests/emtests/test_printf_more.rs | 10 - tests/emtests/test_regex.rs | 10 - .../emtests/test_relocatable_void_function.rs | 10 - tests/emtests/test_rounding.rs | 10 - tests/emtests/test_set_align.rs | 10 - tests/emtests/test_siglongjmp.rs | 10 - tests/emtests/test_sintvars.rs | 10 - tests/emtests/test_sizeof.rs | 10 - tests/emtests/test_sscanf.rs | 10 - tests/emtests/test_sscanf_3.rs | 10 - tests/emtests/test_sscanf_4.rs | 10 - tests/emtests/test_sscanf_5.rs | 10 - tests/emtests/test_sscanf_6.rs | 10 - tests/emtests/test_sscanf_caps.rs | 10 - tests/emtests/test_sscanf_float.rs | 10 - tests/emtests/test_sscanf_hex.rs | 10 - tests/emtests/test_sscanf_n.rs | 10 - tests/emtests/test_sscanf_other_whitespace.rs | 10 - tests/emtests/test_sscanf_skip.rs | 10 - tests/emtests/test_sscanf_whitespace.rs | 10 - tests/emtests/test_stack_varargs.rs | 10 - tests/emtests/test_stack_void.rs | 10 - tests/emtests/test_statvfs.rs | 10 - tests/emtests/test_std_cout_new.rs | 10 - tests/emtests/test_strcasecmp.rs | 10 - tests/emtests/test_strcmp_uni.rs | 10 - tests/emtests/test_strftime.rs | 10 - tests/emtests/test_strings.rs | 10 - tests/emtests/test_strndup.rs | 10 - tests/emtests/test_strptime_days.rs | 10 - tests/emtests/test_strptime_reentrant.rs | 10 - tests/emtests/test_strstr.rs | 10 - tests/emtests/test_strtod.rs | 10 - tests/emtests/test_strtok.rs | 10 - tests/emtests/test_strtol_bin.rs | 10 - tests/emtests/test_strtol_dec.rs | 10 - tests/emtests/test_strtol_hex.rs | 10 - tests/emtests/test_strtol_oct.rs | 10 - tests/emtests/test_strtold.rs | 10 - tests/emtests/test_strtoll_bin.rs | 10 - tests/emtests/test_strtoll_dec.rs | 10 - tests/emtests/test_strtoll_hex.rs | 10 - tests/emtests/test_strtoll_oct.rs | 10 - tests/emtests/test_struct_varargs.rs | 10 - tests/emtests/test_time_c.rs | 10 - tests/emtests/test_tracing.rs | 10 - tests/emtests/test_transtrcase.rs | 10 - tests/emtests/test_trickystring.rs | 10 - tests/emtests/test_uname.rs | 10 - tests/emtests/test_unary_literal.rs | 10 - tests/emtests/test_utf.rs | 10 - tests/emtests/test_varargs.rs | 10 - tests/emtests/test_varargs_multi.rs | 10 - tests/emtests/test_vfs.rs | 10 - tests/emtests/test_vprintf.rs | 10 - tests/emtests/test_vsnprintf.rs | 10 - tests/emtests/test_wprintf.rs | 10 - tests/emtests/test_write_stdout_fileno.rs | 10 - tests/emtests/test_zero_multiplication.rs | 10 - tests/emtests/test_zerodiv.rs | 10 - tests/exception_handling.rs | 26 - .../generate-emscripten-tests/src/emtests.rs | 166 +--- tests/generate-emscripten-tests/src/lib.rs | 11 +- tests/generate-wasi-tests/Cargo.toml | 4 +- tests/generate-wasi-tests/src/lib.rs | 31 +- .../src/set_up_toolchain.rs | 19 +- tests/generate-wasi-tests/src/util.rs | 9 - tests/generate-wasi-tests/src/wasitests.rs | 285 ++---- tests/ignores.txt | 127 +++ tests/imports.rs | 845 +++++++++--------- tests/middleware_common.rs | 331 +++---- tests/spectest.rs | 24 +- tests/test-generator/src/lib.rs | 26 +- tests/utils/backend.rs | 20 + tests/utils/mod.rs | 5 +- .../wasi_test_resources/close_preopen_fd.out | 3 - tests/wasi_test_resources/close_preopen_fd.rs | 2 +- tests/wasi_test_resources/create_dir.out | 5 - tests/wasi_test_resources/create_dir.rs | 2 +- tests/wasi_test_resources/envvar.out | 6 - tests/wasi_test_resources/envvar.rs | 2 +- tests/wasi_test_resources/fd_allocate.out | 2 - tests/wasi_test_resources/fd_allocate.rs | 2 +- tests/wasi_test_resources/fd_append.out | 1 - tests/wasi_test_resources/fd_append.rs | 2 +- tests/wasi_test_resources/fd_close.out | 3 - tests/wasi_test_resources/fd_close.rs | 2 +- tests/wasi_test_resources/fd_pread.out | 9 - tests/wasi_test_resources/fd_pread.rs | 2 +- tests/wasi_test_resources/fd_read.out | 3 - tests/wasi_test_resources/fd_read.rs | 2 +- tests/wasi_test_resources/fd_sync.out | 2 - tests/wasi_test_resources/fd_sync.rs | 2 +- tests/wasi_test_resources/file_metadata.out | 3 - tests/wasi_test_resources/file_metadata.rs | 2 +- tests/wasi_test_resources/fs_sandbox_test.out | 1 - tests/wasi_test_resources/fseek.out | 11 - tests/wasi_test_resources/fseek.rs | 2 +- tests/wasi_test_resources/hello.out | 1 - tests/wasi_test_resources/ignores.txt | 6 - tests/wasi_test_resources/isatty.out | 3 - tests/wasi_test_resources/mapdir.out | 7 - tests/wasi_test_resources/mapdir.rs | 2 +- tests/wasi_test_resources/path_link.out | 9 - tests/wasi_test_resources/path_link.rs | 2 +- tests/wasi_test_resources/path_rename.out | 2 - tests/wasi_test_resources/path_rename.rs | 2 +- tests/wasi_test_resources/path_symlink.out | 4 - tests/wasi_test_resources/path_symlink.rs | 2 +- tests/wasi_test_resources/poll_oneoff.out | 5 - tests/wasi_test_resources/poll_oneoff.rs | 2 +- tests/wasi_test_resources/quine.out | 15 - tests/wasi_test_resources/quine.rs | 2 +- tests/wasi_test_resources/readlink.out | 4 - tests/wasi_test_resources/readlink.rs | 2 +- .../snapshot1/close_preopen_fd.out | 14 + .../snapshot1/close_preopen_fd.wasm | Bin 61993 -> 62042 bytes .../snapshot1/create_dir.out | 11 + .../snapshot1/create_dir.wasm | Bin 85641 -> 85684 bytes .../wasi_test_resources/snapshot1/envvar.out | 18 + .../wasi_test_resources/snapshot1/envvar.wasm | Bin 66017 -> 66073 bytes .../snapshot1/fd_allocate.out | 14 + .../snapshot1/fd_allocate.wasm | Bin 71482 -> 71526 bytes .../snapshot1/fd_append.out | 14 + .../snapshot1/fd_append.wasm | Bin 71341 -> 71384 bytes .../snapshot1/fd_close.out | 14 + .../snapshot1/fd_close.wasm | Bin 71664 -> 71705 bytes .../snapshot1/fd_pread.out | 14 + .../snapshot1/fd_pread.wasm | Bin 70581 -> 70625 bytes .../wasi_test_resources/snapshot1/fd_read.out | 14 + .../snapshot1/fd_read.wasm | Bin 69992 -> 70036 bytes .../wasi_test_resources/snapshot1/fd_sync.out | 14 + .../snapshot1/fd_sync.wasm | Bin 71718 -> 71761 bytes .../snapshot1/file_metadata.out | 11 + .../snapshot1/file_metadata.wasm | Bin 69052 -> 69095 bytes .../snapshot1/fs_sandbox_test.out | 9 + .../snapshot1/fs_sandbox_test.wasm | Bin 62337 -> 62386 bytes tests/wasi_test_resources/snapshot1/fseek.out | 14 + .../wasi_test_resources/snapshot1/fseek.wasm | Bin 72098 -> 72141 bytes tests/wasi_test_resources/snapshot1/hello.out | 9 + .../wasi_test_resources/snapshot1/hello.wasm | Bin 61524 -> 61573 bytes .../wasi_test_resources/snapshot1/isatty.out | 9 + .../wasi_test_resources/snapshot1/isatty.wasm | Bin 61622 -> 61671 bytes .../wasi_test_resources/snapshot1/mapdir.out | 14 + .../wasi_test_resources/snapshot1/mapdir.wasm | Bin 73403 -> 73446 bytes .../snapshot1/path_link.out | 18 + .../snapshot1/path_link.wasm | Bin 72456 -> 72500 bytes .../snapshot1/path_rename.out | 14 + .../snapshot1/path_rename.wasm | Bin 76005 -> 76049 bytes .../snapshot1/path_symlink.out | 18 + .../snapshot1/path_symlink.wasm | Bin 70632 -> 70675 bytes .../snapshot1/poll_oneoff.out | 18 + .../snapshot1/poll_oneoff.wasm | Bin 77974 -> 78017 bytes tests/wasi_test_resources/snapshot1/quine.out | 11 + .../wasi_test_resources/snapshot1/quine.wasm | Bin 70097 -> 70141 bytes .../snapshot1/readlink.out | 14 + .../snapshot1/readlink.wasm | Bin 72086 -> 72130 bytes .../snapshot1/wasi_sees_virtual_root.out | 22 + .../snapshot1/wasi_sees_virtual_root.wasm | Bin 73219 -> 73262 bytes .../wasi_test_resources/snapshot1/writing.out | 22 + .../snapshot1/writing.wasm | Bin 72360 -> 72404 bytes .../unstable/close_preopen_fd.out | 14 + .../unstable/create_dir.out | 11 + tests/wasi_test_resources/unstable/envvar.out | 18 + .../unstable/fd_allocate.out | 14 + .../unstable/fd_append.out | 14 + .../wasi_test_resources/unstable/fd_close.out | 14 + .../wasi_test_resources/unstable/fd_pread.out | 14 + .../wasi_test_resources/unstable/fd_read.out | 14 + .../wasi_test_resources/unstable/fd_sync.out | 14 + .../unstable/file_metadata.out | 11 + .../unstable/fs_sandbox_test.out | 9 + tests/wasi_test_resources/unstable/fseek.out | 14 + tests/wasi_test_resources/unstable/hello.out | 9 + tests/wasi_test_resources/unstable/isatty.out | 9 + tests/wasi_test_resources/unstable/mapdir.out | 14 + .../unstable/path_link.out | 18 + .../unstable/path_rename.out | 14 + .../unstable/path_symlink.out | 18 + .../unstable/poll_oneoff.out | 18 + tests/wasi_test_resources/unstable/quine.out | 11 + .../wasi_test_resources/unstable/readlink.out | 14 + .../unstable/wasi_sees_virtual_root.out | 22 + .../wasi_test_resources/unstable/writing.out | 22 + .../wasi_sees_virtual_root.out | 13 - .../wasi_sees_virtual_root.rs | 2 +- tests/wasi_test_resources/writing.out | 2 - tests/wasi_test_resources/writing.rs | 2 +- tests/wasitest.rs | 111 ++- tests/wasitests/README.md | 5 - tests/wasitests/_common.rs | 80 -- tests/wasitests/mod.rs | 53 -- tests/wasitests/snapshot1_close_preopen_fd.rs | 19 - tests/wasitests/snapshot1_create_dir.rs | 15 - tests/wasitests/snapshot1_envvar.rs | 15 - tests/wasitests/snapshot1_fd_allocate.rs | 19 - tests/wasitests/snapshot1_fd_append.rs | 18 - tests/wasitests/snapshot1_fd_close.rs | 19 - tests/wasitests/snapshot1_fd_pread.rs | 19 - tests/wasitests/snapshot1_fd_read.rs | 19 - tests/wasitests/snapshot1_fd_sync.rs | 18 - tests/wasitests/snapshot1_file_metadata.rs | 15 - tests/wasitests/snapshot1_fs_sandbox_test.rs | 15 - tests/wasitests/snapshot1_fseek.rs | 18 - tests/wasitests/snapshot1_hello.rs | 15 - tests/wasitests/snapshot1_isatty.rs | 15 - tests/wasitests/snapshot1_mapdir.rs | 18 - tests/wasitests/snapshot1_path_link.rs | 24 - tests/wasitests/snapshot1_path_rename.rs | 18 - tests/wasitests/snapshot1_path_symlink.rs | 24 - tests/wasitests/snapshot1_poll_oneoff.rs | 25 - tests/wasitests/snapshot1_quine.rs | 15 - tests/wasitests/snapshot1_readlink.rs | 18 - .../snapshot1_wasi_sees_virtual_root.rs | 28 - tests/wasitests/snapshot1_writing.rs | 28 - tests/wasitests/unstable_close_preopen_fd.rs | 18 - tests/wasitests/unstable_create_dir.rs | 15 - tests/wasitests/unstable_envvar.rs | 15 - tests/wasitests/unstable_fd_allocate.rs | 18 - tests/wasitests/unstable_fd_append.rs | 18 - tests/wasitests/unstable_fd_close.rs | 18 - tests/wasitests/unstable_fd_pread.rs | 18 - tests/wasitests/unstable_fd_read.rs | 18 - tests/wasitests/unstable_fd_sync.rs | 18 - tests/wasitests/unstable_file_metadata.rs | 15 - tests/wasitests/unstable_fs_sandbox_test.rs | 15 - tests/wasitests/unstable_fseek.rs | 18 - tests/wasitests/unstable_hello.rs | 15 - tests/wasitests/unstable_isatty.rs | 15 - tests/wasitests/unstable_mapdir.rs | 18 - tests/wasitests/unstable_path_link.rs | 24 - tests/wasitests/unstable_path_rename.rs | 18 - tests/wasitests/unstable_path_symlink.rs | 24 - tests/wasitests/unstable_poll_oneoff.rs | 24 - tests/wasitests/unstable_quine.rs | 15 - tests/wasitests/unstable_readlink.rs | 18 - .../unstable_wasi_sees_virtual_root.rs | 28 - tests/wasitests/unstable_writing.rs | 28 - 398 files changed, 2267 insertions(+), 4507 deletions(-) create mode 100644 tests/custom/call-indirect-spilled-stack.wast rename tests/{spectests => custom}/fac.wast (100%) create mode 100644 tests/custom/multiple-traps.wast rename tests/{spectests/wasmer.wast => custom/nan-canonicalization.wast} (92%) delete mode 100644 tests/emscripten_resources/emtests/clock_gettime.out delete mode 100644 tests/emscripten_resources/emtests/env.out delete mode 100644 tests/emscripten_resources/emtests/ignores.txt delete mode 100644 tests/emscripten_resources/emtests/localtime.out delete mode 100644 tests/emscripten_resources/emtests/printf.out delete mode 100644 tests/emscripten_resources/emtests/puts.out delete mode 100644 tests/emscripten_resources/emtests/test_addr_of_stacked.out delete mode 100644 tests/emscripten_resources/emtests/test_alloca.out delete mode 100644 tests/emscripten_resources/emtests/test_alloca_stack.out delete mode 100644 tests/emscripten_resources/emtests/test_array2.out delete mode 100644 tests/emscripten_resources/emtests/test_array2b.out delete mode 100644 tests/emscripten_resources/emtests/test_atoX.out delete mode 100644 tests/emscripten_resources/emtests/test_atomic.out delete mode 100644 tests/emscripten_resources/emtests/test_bsearch.out delete mode 100644 tests/emscripten_resources/emtests/test_complex.out delete mode 100644 tests/emscripten_resources/emtests/test_double_varargs.out delete mode 100644 tests/emscripten_resources/emtests/test_erf.out delete mode 100644 tests/emscripten_resources/emtests/test_errar.out delete mode 100644 tests/emscripten_resources/emtests/test_execvp.out delete mode 100644 tests/emscripten_resources/emtests/test_fast_math.out delete mode 100644 tests/emscripten_resources/emtests/test_fcvt.out delete mode 100644 tests/emtests/_common.rs delete mode 100644 tests/emtests/clock_gettime.rs delete mode 100644 tests/emtests/emscripten_get_compiler_setting.rs delete mode 100644 tests/emtests/env.rs delete mode 100644 tests/emtests/fs_exports.rs delete mode 100644 tests/emtests/getvalue_setvalue.rs delete mode 100644 tests/emtests/legacy_exported_runtime_numbers.rs delete mode 100644 tests/emtests/localtime.rs delete mode 100644 tests/emtests/mod.rs delete mode 100644 tests/emtests/modularize_closure_pre.rs delete mode 100644 tests/emtests/printf.rs delete mode 100644 tests/emtests/puts.rs delete mode 100644 tests/emtests/stackalloc.rs delete mode 100644 tests/emtests/syscalls.rs delete mode 100644 tests/emtests/test_addr_of_stacked.rs delete mode 100644 tests/emtests/test_alloca.rs delete mode 100644 tests/emtests/test_alloca_stack.rs delete mode 100644 tests/emtests/test_array2.rs delete mode 100644 tests/emtests/test_array2b.rs delete mode 100644 tests/emtests/test_atomic.rs delete mode 100644 tests/emtests/test_atox.rs delete mode 100644 tests/emtests/test_bsearch.rs delete mode 100644 tests/emtests/test_ccall.rs delete mode 100644 tests/emtests/test_complex.rs delete mode 100644 tests/emtests/test_demangle_stacks.rs delete mode 100644 tests/emtests/test_demangle_stacks_noassert.rs delete mode 100644 tests/emtests/test_dlmalloc_partial_2.rs delete mode 100644 tests/emtests/test_double_varargs.rs delete mode 100644 tests/emtests/test_em_asm.rs delete mode 100644 tests/emtests/test_em_asm_2.rs delete mode 100644 tests/emtests/test_em_asm_parameter_pack.rs delete mode 100644 tests/emtests/test_em_asm_signatures.rs delete mode 100644 tests/emtests/test_em_asm_unicode.rs delete mode 100644 tests/emtests/test_em_asm_unused_arguments.rs delete mode 100644 tests/emtests/test_em_js.rs delete mode 100644 tests/emtests/test_emscripten_api.rs delete mode 100644 tests/emtests/test_erf.rs delete mode 100644 tests/emtests/test_errar.rs delete mode 100644 tests/emtests/test_exceptions_2.rs delete mode 100644 tests/emtests/test_exceptions_multi.rs delete mode 100644 tests/emtests/test_exceptions_std.rs delete mode 100644 tests/emtests/test_exceptions_white_list.rs delete mode 100644 tests/emtests/test_execvp.rs delete mode 100644 tests/emtests/test_fast_math.rs delete mode 100644 tests/emtests/test_flexarray_struct.rs delete mode 100644 tests/emtests/test_float32_precise.rs delete mode 100644 tests/emtests/test_float_builtins.rs delete mode 100644 tests/emtests/test_frexp.rs delete mode 100644 tests/emtests/test_funcptr.rs delete mode 100644 tests/emtests/test_funcptr_namecollide.rs delete mode 100644 tests/emtests/test_funcptrfunc.rs delete mode 100644 tests/emtests/test_funcs.rs delete mode 100644 tests/emtests/test_functionpointer_libfunc_varargs.rs delete mode 100644 tests/emtests/test_fwrite_0.rs delete mode 100644 tests/emtests/test_getcwd.rs delete mode 100644 tests/emtests/test_getgep.rs delete mode 100644 tests/emtests/test_getloadavg.rs delete mode 100644 tests/emtests/test_getopt.rs delete mode 100644 tests/emtests/test_getopt_long.rs delete mode 100644 tests/emtests/test_globaldoubles.rs delete mode 100644 tests/emtests/test_globals.rs delete mode 100644 tests/emtests/test_gmtime.rs delete mode 100644 tests/emtests/test_hello_world.rs delete mode 100644 tests/emtests/test_i16_emcc_intrinsic.rs delete mode 100644 tests/emtests/test_i32_mul_precise.rs delete mode 100644 tests/emtests/test_i64.rs delete mode 100644 tests/emtests/test_i64_4.rs delete mode 100644 tests/emtests/test_i64_7z.rs delete mode 100644 tests/emtests/test_i64_cmp2.rs delete mode 100644 tests/emtests/test_i64_i16.rs delete mode 100644 tests/emtests/test_i64_llabs.rs delete mode 100644 tests/emtests/test_i64_precise.rs delete mode 100644 tests/emtests/test_i64_precise_needed.rs delete mode 100644 tests/emtests/test_i64_precise_unneeded.rs delete mode 100644 tests/emtests/test_i64_qdouble.rs delete mode 100644 tests/emtests/test_i64_umul.rs delete mode 100644 tests/emtests/test_i64_varargs.rs delete mode 100644 tests/emtests/test_i64_zextneg.rs delete mode 100644 tests/emtests/test_if.rs delete mode 100644 tests/emtests/test_if_else.rs delete mode 100644 tests/emtests/test_indirectbr.rs delete mode 100644 tests/emtests/test_indirectbr_many.rs delete mode 100644 tests/emtests/test_isnan.rs delete mode 100644 tests/emtests/test_libcextra.rs delete mode 100644 tests/emtests/test_libgen.rs delete mode 100644 tests/emtests/test_literal_negative_zero.rs delete mode 100644 tests/emtests/test_llrint.rs delete mode 100644 tests/emtests/test_llvm_fabs.rs delete mode 100644 tests/emtests/test_llvm_intrinsics.rs delete mode 100644 tests/emtests/test_llvmswitch.rs delete mode 100644 tests/emtests/test_longjmp.rs delete mode 100644 tests/emtests/test_longjmp2.rs delete mode 100644 tests/emtests/test_longjmp3.rs delete mode 100644 tests/emtests/test_longjmp4.rs delete mode 100644 tests/emtests/test_longjmp_exc.rs delete mode 100644 tests/emtests/test_longjmp_funcptr.rs delete mode 100644 tests/emtests/test_longjmp_repeat.rs delete mode 100644 tests/emtests/test_longjmp_stacked.rs delete mode 100644 tests/emtests/test_longjmp_throw.rs delete mode 100644 tests/emtests/test_longjmp_unwind.rs delete mode 100644 tests/emtests/test_loop.rs delete mode 100644 tests/emtests/test_lower_intrinsics.rs delete mode 100644 tests/emtests/test_main_thread_async_em_asm.rs delete mode 100644 tests/emtests/test_mainenv.rs delete mode 100644 tests/emtests/test_mathfuncptr.rs delete mode 100644 tests/emtests/test_memcpy2.rs delete mode 100644 tests/emtests/test_memcpy3.rs delete mode 100644 tests/emtests/test_memcpy_memcmp.rs delete mode 100644 tests/emtests/test_memmove.rs delete mode 100644 tests/emtests/test_memmove2.rs delete mode 100644 tests/emtests/test_memmove3.rs delete mode 100644 tests/emtests/test_memset.rs delete mode 100644 tests/emtests/test_mmap.rs delete mode 100644 tests/emtests/test_negative_zero.rs delete mode 100644 tests/emtests/test_nested_struct_varargs.rs delete mode 100644 tests/emtests/test_nl_types.rs delete mode 100644 tests/emtests/test_perrar.rs delete mode 100644 tests/emtests/test_phiundef.rs delete mode 100644 tests/emtests/test_pipe.rs delete mode 100644 tests/emtests/test_poll.rs delete mode 100644 tests/emtests/test_posixtime.rs delete mode 100644 tests/emtests/test_printf_2.rs delete mode 100644 tests/emtests/test_printf_more.rs delete mode 100644 tests/emtests/test_regex.rs delete mode 100644 tests/emtests/test_relocatable_void_function.rs delete mode 100644 tests/emtests/test_rounding.rs delete mode 100644 tests/emtests/test_set_align.rs delete mode 100644 tests/emtests/test_siglongjmp.rs delete mode 100644 tests/emtests/test_sintvars.rs delete mode 100644 tests/emtests/test_sizeof.rs delete mode 100644 tests/emtests/test_sscanf.rs delete mode 100644 tests/emtests/test_sscanf_3.rs delete mode 100644 tests/emtests/test_sscanf_4.rs delete mode 100644 tests/emtests/test_sscanf_5.rs delete mode 100644 tests/emtests/test_sscanf_6.rs delete mode 100644 tests/emtests/test_sscanf_caps.rs delete mode 100644 tests/emtests/test_sscanf_float.rs delete mode 100644 tests/emtests/test_sscanf_hex.rs delete mode 100644 tests/emtests/test_sscanf_n.rs delete mode 100644 tests/emtests/test_sscanf_other_whitespace.rs delete mode 100644 tests/emtests/test_sscanf_skip.rs delete mode 100644 tests/emtests/test_sscanf_whitespace.rs delete mode 100644 tests/emtests/test_stack_varargs.rs delete mode 100644 tests/emtests/test_stack_void.rs delete mode 100644 tests/emtests/test_statvfs.rs delete mode 100644 tests/emtests/test_std_cout_new.rs delete mode 100644 tests/emtests/test_strcasecmp.rs delete mode 100644 tests/emtests/test_strcmp_uni.rs delete mode 100644 tests/emtests/test_strftime.rs delete mode 100644 tests/emtests/test_strings.rs delete mode 100644 tests/emtests/test_strndup.rs delete mode 100644 tests/emtests/test_strptime_days.rs delete mode 100644 tests/emtests/test_strptime_reentrant.rs delete mode 100644 tests/emtests/test_strstr.rs delete mode 100644 tests/emtests/test_strtod.rs delete mode 100644 tests/emtests/test_strtok.rs delete mode 100644 tests/emtests/test_strtol_bin.rs delete mode 100644 tests/emtests/test_strtol_dec.rs delete mode 100644 tests/emtests/test_strtol_hex.rs delete mode 100644 tests/emtests/test_strtol_oct.rs delete mode 100644 tests/emtests/test_strtold.rs delete mode 100644 tests/emtests/test_strtoll_bin.rs delete mode 100644 tests/emtests/test_strtoll_dec.rs delete mode 100644 tests/emtests/test_strtoll_hex.rs delete mode 100644 tests/emtests/test_strtoll_oct.rs delete mode 100644 tests/emtests/test_struct_varargs.rs delete mode 100644 tests/emtests/test_time_c.rs delete mode 100644 tests/emtests/test_tracing.rs delete mode 100644 tests/emtests/test_transtrcase.rs delete mode 100644 tests/emtests/test_trickystring.rs delete mode 100644 tests/emtests/test_uname.rs delete mode 100644 tests/emtests/test_unary_literal.rs delete mode 100644 tests/emtests/test_utf.rs delete mode 100644 tests/emtests/test_varargs.rs delete mode 100644 tests/emtests/test_varargs_multi.rs delete mode 100644 tests/emtests/test_vfs.rs delete mode 100644 tests/emtests/test_vprintf.rs delete mode 100644 tests/emtests/test_vsnprintf.rs delete mode 100644 tests/emtests/test_wprintf.rs delete mode 100644 tests/emtests/test_write_stdout_fileno.rs delete mode 100644 tests/emtests/test_zero_multiplication.rs delete mode 100644 tests/emtests/test_zerodiv.rs delete mode 100644 tests/exception_handling.rs create mode 100644 tests/utils/backend.rs delete mode 100644 tests/wasi_test_resources/close_preopen_fd.out delete mode 100644 tests/wasi_test_resources/create_dir.out delete mode 100644 tests/wasi_test_resources/envvar.out delete mode 100644 tests/wasi_test_resources/fd_allocate.out delete mode 100644 tests/wasi_test_resources/fd_append.out delete mode 100644 tests/wasi_test_resources/fd_close.out delete mode 100644 tests/wasi_test_resources/fd_pread.out delete mode 100644 tests/wasi_test_resources/fd_read.out delete mode 100644 tests/wasi_test_resources/fd_sync.out delete mode 100644 tests/wasi_test_resources/file_metadata.out delete mode 100644 tests/wasi_test_resources/fs_sandbox_test.out delete mode 100644 tests/wasi_test_resources/fseek.out delete mode 100644 tests/wasi_test_resources/hello.out delete mode 100644 tests/wasi_test_resources/ignores.txt delete mode 100644 tests/wasi_test_resources/isatty.out delete mode 100644 tests/wasi_test_resources/mapdir.out delete mode 100644 tests/wasi_test_resources/path_link.out delete mode 100644 tests/wasi_test_resources/path_rename.out delete mode 100644 tests/wasi_test_resources/path_symlink.out delete mode 100644 tests/wasi_test_resources/poll_oneoff.out delete mode 100644 tests/wasi_test_resources/quine.out delete mode 100644 tests/wasi_test_resources/readlink.out create mode 100644 tests/wasi_test_resources/snapshot1/close_preopen_fd.out create mode 100644 tests/wasi_test_resources/snapshot1/create_dir.out create mode 100644 tests/wasi_test_resources/snapshot1/envvar.out create mode 100644 tests/wasi_test_resources/snapshot1/fd_allocate.out create mode 100644 tests/wasi_test_resources/snapshot1/fd_append.out create mode 100644 tests/wasi_test_resources/snapshot1/fd_close.out create mode 100644 tests/wasi_test_resources/snapshot1/fd_pread.out create mode 100644 tests/wasi_test_resources/snapshot1/fd_read.out create mode 100644 tests/wasi_test_resources/snapshot1/fd_sync.out create mode 100644 tests/wasi_test_resources/snapshot1/file_metadata.out create mode 100644 tests/wasi_test_resources/snapshot1/fs_sandbox_test.out create mode 100644 tests/wasi_test_resources/snapshot1/fseek.out create mode 100644 tests/wasi_test_resources/snapshot1/hello.out create mode 100644 tests/wasi_test_resources/snapshot1/isatty.out create mode 100644 tests/wasi_test_resources/snapshot1/mapdir.out create mode 100644 tests/wasi_test_resources/snapshot1/path_link.out create mode 100644 tests/wasi_test_resources/snapshot1/path_rename.out create mode 100644 tests/wasi_test_resources/snapshot1/path_symlink.out create mode 100644 tests/wasi_test_resources/snapshot1/poll_oneoff.out create mode 100644 tests/wasi_test_resources/snapshot1/quine.out create mode 100644 tests/wasi_test_resources/snapshot1/readlink.out create mode 100644 tests/wasi_test_resources/snapshot1/wasi_sees_virtual_root.out create mode 100644 tests/wasi_test_resources/snapshot1/writing.out create mode 100644 tests/wasi_test_resources/unstable/close_preopen_fd.out create mode 100644 tests/wasi_test_resources/unstable/create_dir.out create mode 100644 tests/wasi_test_resources/unstable/envvar.out create mode 100644 tests/wasi_test_resources/unstable/fd_allocate.out create mode 100644 tests/wasi_test_resources/unstable/fd_append.out create mode 100644 tests/wasi_test_resources/unstable/fd_close.out create mode 100644 tests/wasi_test_resources/unstable/fd_pread.out create mode 100644 tests/wasi_test_resources/unstable/fd_read.out create mode 100644 tests/wasi_test_resources/unstable/fd_sync.out create mode 100644 tests/wasi_test_resources/unstable/file_metadata.out create mode 100644 tests/wasi_test_resources/unstable/fs_sandbox_test.out create mode 100644 tests/wasi_test_resources/unstable/fseek.out create mode 100644 tests/wasi_test_resources/unstable/hello.out create mode 100644 tests/wasi_test_resources/unstable/isatty.out create mode 100644 tests/wasi_test_resources/unstable/mapdir.out create mode 100644 tests/wasi_test_resources/unstable/path_link.out create mode 100644 tests/wasi_test_resources/unstable/path_rename.out create mode 100644 tests/wasi_test_resources/unstable/path_symlink.out create mode 100644 tests/wasi_test_resources/unstable/poll_oneoff.out create mode 100644 tests/wasi_test_resources/unstable/quine.out create mode 100644 tests/wasi_test_resources/unstable/readlink.out create mode 100644 tests/wasi_test_resources/unstable/wasi_sees_virtual_root.out create mode 100644 tests/wasi_test_resources/unstable/writing.out delete mode 100644 tests/wasi_test_resources/wasi_sees_virtual_root.out delete mode 100644 tests/wasi_test_resources/writing.out delete mode 100644 tests/wasitests/README.md delete mode 100644 tests/wasitests/_common.rs delete mode 100644 tests/wasitests/mod.rs delete mode 100644 tests/wasitests/snapshot1_close_preopen_fd.rs delete mode 100644 tests/wasitests/snapshot1_create_dir.rs delete mode 100644 tests/wasitests/snapshot1_envvar.rs delete mode 100644 tests/wasitests/snapshot1_fd_allocate.rs delete mode 100644 tests/wasitests/snapshot1_fd_append.rs delete mode 100644 tests/wasitests/snapshot1_fd_close.rs delete mode 100644 tests/wasitests/snapshot1_fd_pread.rs delete mode 100644 tests/wasitests/snapshot1_fd_read.rs delete mode 100644 tests/wasitests/snapshot1_fd_sync.rs delete mode 100644 tests/wasitests/snapshot1_file_metadata.rs delete mode 100644 tests/wasitests/snapshot1_fs_sandbox_test.rs delete mode 100644 tests/wasitests/snapshot1_fseek.rs delete mode 100644 tests/wasitests/snapshot1_hello.rs delete mode 100644 tests/wasitests/snapshot1_isatty.rs delete mode 100644 tests/wasitests/snapshot1_mapdir.rs delete mode 100644 tests/wasitests/snapshot1_path_link.rs delete mode 100644 tests/wasitests/snapshot1_path_rename.rs delete mode 100644 tests/wasitests/snapshot1_path_symlink.rs delete mode 100644 tests/wasitests/snapshot1_poll_oneoff.rs delete mode 100644 tests/wasitests/snapshot1_quine.rs delete mode 100644 tests/wasitests/snapshot1_readlink.rs delete mode 100644 tests/wasitests/snapshot1_wasi_sees_virtual_root.rs delete mode 100644 tests/wasitests/snapshot1_writing.rs delete mode 100644 tests/wasitests/unstable_close_preopen_fd.rs delete mode 100644 tests/wasitests/unstable_create_dir.rs delete mode 100644 tests/wasitests/unstable_envvar.rs delete mode 100644 tests/wasitests/unstable_fd_allocate.rs delete mode 100644 tests/wasitests/unstable_fd_append.rs delete mode 100644 tests/wasitests/unstable_fd_close.rs delete mode 100644 tests/wasitests/unstable_fd_pread.rs delete mode 100644 tests/wasitests/unstable_fd_read.rs delete mode 100644 tests/wasitests/unstable_fd_sync.rs delete mode 100644 tests/wasitests/unstable_file_metadata.rs delete mode 100644 tests/wasitests/unstable_fs_sandbox_test.rs delete mode 100644 tests/wasitests/unstable_fseek.rs delete mode 100644 tests/wasitests/unstable_hello.rs delete mode 100644 tests/wasitests/unstable_isatty.rs delete mode 100644 tests/wasitests/unstable_mapdir.rs delete mode 100644 tests/wasitests/unstable_path_link.rs delete mode 100644 tests/wasitests/unstable_path_rename.rs delete mode 100644 tests/wasitests/unstable_path_symlink.rs delete mode 100644 tests/wasitests/unstable_poll_oneoff.rs delete mode 100644 tests/wasitests/unstable_quine.rs delete mode 100644 tests/wasitests/unstable_readlink.rs delete mode 100644 tests/wasitests/unstable_wasi_sees_virtual_root.rs delete mode 100644 tests/wasitests/unstable_writing.rs diff --git a/Cargo.lock b/Cargo.lock index 21128ecc0..604b35181 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -766,6 +766,8 @@ name = "generate-wasi-tests" version = "0.16.2" dependencies = [ "glob 0.3.0", + "serde", + "serde_json", "tempfile", ] @@ -2046,9 +2048,9 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.105" +version = "1.0.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e707fbbf255b8fc8c3b99abb91e7257a622caeb20a9818cbadbeeede4e0932ff" +checksum = "36df6ac6412072f67cf767ebbde4133a5b2e88e76dc6187fa7104cd16f783399" dependencies = [ "serde_derive", ] @@ -2074,9 +2076,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.105" +version = "1.0.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac5d00fc561ba2724df6758a17de23df5914f20e41cb00f94d5b7ae42fffaff8" +checksum = "9e549e3abf4fb8621bd1609f11dfc9f5e50320802273b12f3811a67e6716ea6c" dependencies = [ "proc-macro2 1.0.9", "quote 1.0.2", @@ -2258,6 +2260,18 @@ dependencies = [ "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]] name = "test-generator" version = "0.1.0" @@ -2763,11 +2777,14 @@ dependencies = [ "generate-emscripten-tests", "generate-wasi-tests", "glob 0.3.0", + "lazy_static", "libc", "log", "rustc_version", "serde", + "serde_json", "structopt", + "test-case", "test-generator", "typetag", "wabt", @@ -2979,6 +2996,7 @@ dependencies = [ "libc", "log", "serde", + "thiserror", "time", "typetag", "wasmer-runtime-core", diff --git a/Cargo.toml b/Cargo.toml index 075edb4d9..3a0c77216 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,16 +27,20 @@ fern = { version = "0.5", features = ["colored"], optional = true } log = "0.4" structopt = "0.3" wabt = { version = "0.9.1", optional = true } -wasmer = { path = "lib/api" } -wasmer-clif-backend = { path = "lib/clif-backend", optional = true } -wasmer-singlepass-backend = { path = "lib/singlepass-backend", optional = true } +wasmer = { path = "lib/api", default-features = false } 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-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 } + +# 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 } [workspace] @@ -76,21 +80,25 @@ rustc_version = "0.2" [dev-dependencies] anyhow = "1.0.19" wasmer-wast = { path = "tests/wast" } +lazy_static = "1.4.0" +# To allow parametrized tests +test-case = "1.0.0" criterion = "0.3" glob = "0.3" libc = "0.2.60" # for `tests/dev-utils`'s Stdout capturing serde = { version = "1", features = ["derive"] } # used by the plugin example +serde_json = "1" typetag = "0.1" # used by the plugin example wabt = "0.9.1" [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"] debug = ["fern", "log/max_level_debug", "log/release_max_level_debug"] trace = ["fern", "log/max_level_trace", "log/release_max_level_trace"] docs = ["wasmer-runtime/docs"] -# This feature will allow cargo test to run much faster -fast-tests = [] backend-cranelift = [ "wasmer-clif-backend", "wasmer-clif-backend/generate-debug-information", diff --git a/Makefile b/Makefile index b12fc95d5..f3331c8aa 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,42 @@ .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-emtests: WASM_EMSCRIPTEN_GENERATE_EMTESTS=1 cargo build --release \ @@ -25,57 +62,53 @@ emtests-generate: generate-emtests wasitests-generate: generate-wasitests 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 - 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 # Spectests 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: - 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: - 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: - WASMER_TEST_CRANELIFT=1 WASMER_TEST_LLVM=1 WASMER_TEST_SINGLEPASS=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 +spectests: + cargo test spec --release $(backend_features) -- --test-threads=1 # Emscripten tests 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: - 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: - 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: - cargo test emscripten --release +emtests-all: + 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-singlepass: - cargo test middleware --release --no-default-features --features "wasi backend-singlepass" + cargo test middleware::singlepass --release $(backend_features) middleware-cranelift: - cargo test middleware --release --no-default-features --features "wasi backend-cranelift" + cargo test middleware::cranelift --release $(backend_features) 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 @@ -86,13 +119,16 @@ wasitests-setup: mkdir -p tests/wasi_test_resources/test_fs/temp 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 - 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 - 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 cargo test --manifest-path lib/wasi/Cargo.toml --release @@ -103,15 +139,15 @@ wasitests: wasitests-unit wasitests-singlepass wasitests-cranelift wasitests-llv # Backends singlepass: wasitests-setup 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 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 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 @@ -163,7 +199,7 @@ test-rest: cargo test --release -p wasmer-wasi-experimental-io-devices 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: ci/run-docker.sh x86_64-linux-android --manifest-path=lib/singlepass-backend/Cargo.toml @@ -188,20 +224,20 @@ lint: precommit: lint test debug: - cargo build --release --features backend-cranelift,backend-singlepass,debug,trace + cargo build --release --features "debug trace" install: cargo install --path . # Checks 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 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 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 check-bench: check-bench-singlepass check-bench-llvm @@ -270,7 +306,7 @@ check: check-bench # 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-musl: @@ -278,28 +314,28 @@ release-musl: # 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 -# Only one backend (cranelift) -release-clif: - # If you are on macOS, you will need mingw-w64 for cross compiling to Windows - # brew install mingw-w64 - cargo build --release --features backend-cranelift +# This way of releasing is deprecated, since backends are now detected +# automatically +release-clif: release -release-singlepass: - cargo build --release --features backend-singlepass +# This way of releasing is deprecated, since backends are now detected +# automatically +release-singlepass: release -release-llvm: - cargo build --release --features backend-llvm,experimental-io-devices +# This way of releasing is deprecated, since backends are now detected +# automatically +release-llvm: release bench-singlepass: # 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 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 bench-llvm: # 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 build-install-package: diff --git a/build.rs b/build.rs index 47cdcf25d..2f13a0109 100644 --- a/build.rs +++ b/build.rs @@ -5,15 +5,19 @@ use generate_emscripten_tests; use generate_wasi_tests; use std::env; -use std::fmt::Write; use std::fs; use std::path::PathBuf; use std::process::Command; use test_generator::{ 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 /// file. fn wast_processor(out: &mut Testsuite, p: PathBuf) -> Option { @@ -41,71 +45,199 @@ fn wast_processor(out: &mut Testsuite, p: PathBuf) -> Option { }) } +/// 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 { + 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 { + 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<()> { + // println!("cargo:rustc-cfg=feature=\"backend-cranelift\""); println!("cargo:rerun-if-changed=build.rs"); 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(); - generate_emscripten_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(); + } let out_dir = PathBuf::from( 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 mut out = Testsuite { + + // Spectests test generation + let mut spectests = Testsuite { buffer: String::new(), path: vec![], - ignores: ignores, + ignores: ignores.clone(), }; - - for compiler in &["singlepass", "cranelift", "llvm"] { - writeln!(out.buffer, "#[cfg(feature=\"backend-{}\")]", compiler); - writeln!(out.buffer, "#[cfg(test)]")?; - 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(()) - })?; + let backends = vec!["singlepass", "cranelift", "llvm"]; + with_backends(&mut spectests, &backends, |mut spectests| { + with_test_module(&mut spectests, "spec", |spectests| { + let _spec_tests = test_directory(spectests, "tests/spectests", wast_processor)?; Ok(()) })?; - } + Ok(()) + })?; + + // Emscripten tests generation + 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)?; - // println!("{}", out.buffer); - // std::process::exit(1); // Write out our auto-generated tests and opportunistically format them with // `rustfmt` if it's installed. - let output = out_dir.join("generated_tests.rs"); - fs::write(&output, out.buffer)?; - Command::new("rustfmt").arg(&output).status(); + // Note: We need drop because we don't want to run `unwrap` or `expect` as + // the command might fail, but we don't care about it's result. + 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(()) } diff --git a/lib/runtime/src/lib.rs b/lib/runtime/src/lib.rs index 91d86dada..7f7c8a459 100644 --- a/lib/runtime/src/lib.rs +++ b/lib/runtime/src/lib.rs @@ -208,6 +208,13 @@ impl Default for Backend { #[cfg(all(feature = "default-backend-llvm", not(feature = "docs")))] 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: /// If the operation fails, the function returns `Err(error::CompileError::...)`. pub fn compile(wasm: &[u8]) -> error::CompileResult { - 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 @@ -250,7 +257,7 @@ pub fn compile_with_config( wasm: &[u8], compiler_config: CompilerConfig, ) -> error::CompileResult { - 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 @@ -291,7 +298,7 @@ pub fn instantiate(wasm: &[u8], import_object: &ImportObject) -> error::Result impl Compiler { +pub fn default_compiler() -> Box { #[cfg(any( all( feature = "default-backend-llvm", @@ -320,7 +327,19 @@ pub fn default_compiler() -> impl Compiler { #[cfg(any(feature = "default-backend-cranelift", feature = "docs"))] 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`. @@ -350,6 +369,13 @@ pub fn compiler_for_backend(backend: Backend) -> Option> { return Some(Box::new(wasmer_clif_backend::CraneliftCompiler::new())); #[cfg(feature = "default-backend-llvm")] 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."); } } } diff --git a/lib/wasi/Cargo.toml b/lib/wasi/Cargo.toml index e26bf73e3..5d955c8f5 100644 --- a/lib/wasi/Cargo.toml +++ b/lib/wasi/Cargo.toml @@ -12,6 +12,7 @@ edition = "2018" [dependencies] bincode = "1" byteorder = "1.3" +thiserror = "1.0.15" generational-arena = { version = "0.2", features = ["serde"] } libc = "0.2.60" log = "0.4" diff --git a/lib/wasi/src/state/builder.rs b/lib/wasi/src/state/builder.rs index 94b7e05ee..a0d69c7b5 100644 --- a/lib/wasi/src/state/builder.rs +++ b/lib/wasi/src/state/builder.rs @@ -3,6 +3,7 @@ use crate::state::{WasiFile, WasiFs, WasiFsError, WasiState}; use crate::syscalls::types::{__WASI_STDERR_FILENO, __WASI_STDIN_FILENO, __WASI_STDOUT_FILENO}; use std::path::{Path, PathBuf}; +use thiserror::Error; /// Creates an empty [`WasiStateBuilder`]. /// @@ -56,15 +57,23 @@ impl std::fmt::Debug for WasiStateBuilder { } /// Error type returned when bad data is given to [`WasiStateBuilder`]. -#[derive(Debug, PartialEq, Eq)] +#[derive(Error, Debug, PartialEq, Eq)] pub enum WasiStateCreationError { + #[error("bad environment variable format: `{0}`")] EnvironmentVariableFormatError(String), + #[error("argument contains null byte: `{0}`")] ArgumentContainsNulByte(String), + #[error("preopened directory not found: `{0}`")] PreopenedDirectoryNotFound(PathBuf), + #[error("preopened directory error: `{0}`")] PreopenedDirectoryError(String), + #[error("mapped dir alias has wrong format: `{0}`")] MappedDirAliasFormattingError(String), + #[error("wasi filesystem creation error: `{0}`")] WasiFsCreationError(String), + #[error("wasi filesystem setup error: `{0}`")] WasiFsSetupError(String), + #[error(transparent)] WasiFsError(WasiFsError), } diff --git a/lib/wasi/src/state/types.rs b/lib/wasi/src/state/types.rs index 3308887de..22d0b239c 100644 --- a/lib/wasi/src/state/types.rs +++ b/lib/wasi/src/state/types.rs @@ -9,60 +9,84 @@ use std::{ path::PathBuf, time::SystemTime, }; +use thiserror::Error; /// Error type for external users -#[derive(Copy, Clone, Debug, PartialEq, Eq)] +#[derive(Error, Copy, Clone, Debug, PartialEq, Eq)] #[allow(dead_code)] // dead code beacuse this is for external use pub enum WasiFsError { /// The fd given as a base was not a directory so the operation was not possible + #[error("fd not a directory")] BaseNotDirectory, /// Expected a file but found not a file + #[error("fd not a file")] NotAFile, /// The fd given was not usable + #[error("invalid fd")] InvalidFd, /// File exists + #[error("file exists")] AlreadyExists, /// Something failed when doing IO. These errors can generally not be handled. /// It may work if tried again. + #[error("io error")] IOError, /// The address was in use + #[error("address is in use")] AddressInUse, /// The address could not be found + #[error("address could not be found")] AddressNotAvailable, /// A pipe was closed + #[error("broken pipe (was closed)")] BrokenPipe, /// The connection was aborted + #[error("connection aborted")] ConnectionAborted, /// The connection request was refused + #[error("connection refused")] ConnectionRefused, /// The connection was reset + #[error("connection reset")] ConnectionReset, /// The operation was interrupted before it could finish + #[error("operation interrupted")] Interrupted, /// Invalid internal data, if the argument data is invalid, use `InvalidInput` + #[error("invalid internal data")] InvalidData, /// The provided data is invalid + #[error("invalid input")] InvalidInput, /// Could not perform the operation because there was not an open connection + #[error("connection is not open")] NotConnected, /// The requested file or directory could not be found + #[error("entity not found")] EntityNotFound, /// The requested device couldn't be accessed + #[error("can't access device")] NoDevice, /// Caller was not allowed to perform this operation + #[error("permission denied")] PermissionDenied, /// The operation did not complete within the given amount of time + #[error("time out")] TimedOut, /// Found EOF when EOF was not expected + #[error("unexpected eof")] UnexpectedEof, /// Operation would block, this error lets the caller know that they can try again + #[error("blocking operation. try again")] WouldBlock, /// A call to write returned 0 + #[error("write returned 0")] WriteZero, /// 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 /// this error, but perhaps something broke) + #[error("unknown error: {0}")] UnknownError(__wasi_errno_t), } diff --git a/src/bin/wasmer.rs b/src/bin/wasmer.rs index 607a7c1e0..6ac905362 100644 --- a/src/bin/wasmer.rs +++ b/src/bin/wasmer.rs @@ -7,18 +7,28 @@ unused_unsafe, unreachable_patterns )] -use std::env; #[cfg(all(target_os = "linux", feature = "loader-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)] #[structopt(name = "wasmer", about = "WebAssembly standalone runtime.", author)] /// The options for the wasmer Command Line Interface enum CLIOptions { /// Run a WebAssembly file. Formats accepted: wasm, wat + #[cfg(any( + feature = "backend-cranelift", + feature = "backend-llvm", + feature = "backend-singlepass" + ))] #[structopt(name = "run")] Run(Run), @@ -45,18 +55,36 @@ fn main() { // Eg. `wasmer ` // In case that fails, we fallback trying the Run subcommand directly. // Eg. `wasmer myfile.wasm --dir=.` - let args = env::args(); - let options = CLIOptions::from_iter_safe(args).unwrap_or_else(|e| { + #[cfg(any( + 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 { // This fixes a issue that: // 1. Shows the version twice when doing `wasmer -V` // 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()), } }); + // 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 { + #[cfg(any( + feature = "backend-cranelift", + feature = "backend-llvm", + feature = "backend-singlepass" + ))] CLIOptions::Run(mut options) => options.execute(), CLIOptions::SelfUpdate => SelfUpdate::execute(), CLIOptions::Cache(cache) => cache.execute(), diff --git a/src/commands.rs b/src/commands.rs index 03de432b3..15c846501 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -1,10 +1,21 @@ mod cache; #[cfg(all(target_os = "linux", feature = "loader-kernel"))] mod kernel; +#[cfg(any( + feature = "backend-cranelift", + feature = "backend-llvm", + feature = "backend-singlepass" +))] mod run; mod selfupdate; mod validate; #[cfg(all(target_os = "linux", feature = "loader-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::*}; diff --git a/src/commands/run.rs b/src/commands/run.rs index cc851e743..b58075fd7 100644 --- a/src/commands/run.rs +++ b/src/commands/run.rs @@ -474,7 +474,12 @@ impl LLVMCallbacks for LLVMCLIOptions { /// Execute a wasm/wat file 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()); } diff --git a/tests/custom/call-indirect-spilled-stack.wast b/tests/custom/call-indirect-spilled-stack.wast new file mode 100644 index 000000000..95df771f8 --- /dev/null +++ b/tests/custom/call-indirect-spilled-stack.wast @@ -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)) diff --git a/tests/spectests/fac.wast b/tests/custom/fac.wast similarity index 100% rename from tests/spectests/fac.wast rename to tests/custom/fac.wast diff --git a/tests/custom/multiple-traps.wast b/tests/custom/multiple-traps.wast new file mode 100644 index 000000000..e59a3a3fb --- /dev/null +++ b/tests/custom/multiple-traps.wast @@ -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") diff --git a/tests/spectests/wasmer.wast b/tests/custom/nan-canonicalization.wast similarity index 92% rename from tests/spectests/wasmer.wast rename to tests/custom/nan-canonicalization.wast index 1a7647ee1..2e80ab39a 100644 --- a/tests/spectests/wasmer.wast +++ b/tests/custom/nan-canonicalization.wast @@ -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 ;; Auxiliary definitions - (type $out-i32 (func (result i32))) (type $f32-id (func (param f32) (result f32))) (type $f64-id (func (param f64) (result f64))) - (func $const-i32 (type $out-i32) (i32.const 0x132)) - (table funcref (elem - $const-i32 $nan-canonicalization-f32-func-call-target $nan-canonicalization-f64-func-call-target ) @@ -18,26 +18,6 @@ (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) (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-sub" (i32.const 0x7fc00001)) (i32.const 0x7fc00000)) (assert_return (invoke "nan-canonicalization-f32-mul" (i32.const 0x7fc00001)) (i32.const 0x7fc00000)) diff --git a/tests/emscripten_resources/emtests/clock_gettime.out b/tests/emscripten_resources/emtests/clock_gettime.out deleted file mode 100644 index 9dab40160..000000000 --- a/tests/emscripten_resources/emtests/clock_gettime.out +++ /dev/null @@ -1 +0,0 @@ -clock_gettime diff --git a/tests/emscripten_resources/emtests/env.out b/tests/emscripten_resources/emtests/env.out deleted file mode 100644 index a6cb32095..000000000 --- a/tests/emscripten_resources/emtests/env.out +++ /dev/null @@ -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 diff --git a/tests/emscripten_resources/emtests/hello.out b/tests/emscripten_resources/emtests/hello.out index 9a71f81a4..3b18e512d 100644 --- a/tests/emscripten_resources/emtests/hello.out +++ b/tests/emscripten_resources/emtests/hello.out @@ -1,2 +1 @@ hello world - diff --git a/tests/emscripten_resources/emtests/ignores.txt b/tests/emscripten_resources/emtests/ignores.txt deleted file mode 100644 index af8f21b00..000000000 --- a/tests/emscripten_resources/emtests/ignores.txt +++ /dev/null @@ -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 diff --git a/tests/emscripten_resources/emtests/localtime.out b/tests/emscripten_resources/emtests/localtime.out deleted file mode 100644 index 826f3db8a..000000000 --- a/tests/emscripten_resources/emtests/localtime.out +++ /dev/null @@ -1 +0,0 @@ -localtime diff --git a/tests/emscripten_resources/emtests/printf.out b/tests/emscripten_resources/emtests/printf.out deleted file mode 100644 index ac02f590a..000000000 --- a/tests/emscripten_resources/emtests/printf.out +++ /dev/null @@ -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 diff --git a/tests/emscripten_resources/emtests/puts.out b/tests/emscripten_resources/emtests/puts.out deleted file mode 100644 index b10a5b066..000000000 --- a/tests/emscripten_resources/emtests/puts.out +++ /dev/null @@ -1,4 +0,0 @@ -Hello, World! - -Hello, World! - diff --git a/tests/emscripten_resources/emtests/test_addr_of_stacked.out b/tests/emscripten_resources/emtests/test_addr_of_stacked.out deleted file mode 100644 index 2b8cf4a17..000000000 --- a/tests/emscripten_resources/emtests/test_addr_of_stacked.out +++ /dev/null @@ -1 +0,0 @@ -*7* \ No newline at end of file diff --git a/tests/emscripten_resources/emtests/test_alloca.out b/tests/emscripten_resources/emtests/test_alloca.out deleted file mode 100644 index 37de3d6bc..000000000 --- a/tests/emscripten_resources/emtests/test_alloca.out +++ /dev/null @@ -1 +0,0 @@ -z:1* \ No newline at end of file diff --git a/tests/emscripten_resources/emtests/test_alloca_stack.out b/tests/emscripten_resources/emtests/test_alloca_stack.out deleted file mode 100644 index d6a90d4e8..000000000 --- a/tests/emscripten_resources/emtests/test_alloca_stack.out +++ /dev/null @@ -1 +0,0 @@ -ok:-32768* \ No newline at end of file diff --git a/tests/emscripten_resources/emtests/test_array2.out b/tests/emscripten_resources/emtests/test_array2.out deleted file mode 100644 index a6ee88bbc..000000000 --- a/tests/emscripten_resources/emtests/test_array2.out +++ /dev/null @@ -1 +0,0 @@ -0:-1.00,-0.33 1:0.33,-1.00 2:-0.33,1.00 3:1.00,0.33 \ No newline at end of file diff --git a/tests/emscripten_resources/emtests/test_array2b.out b/tests/emscripten_resources/emtests/test_array2b.out deleted file mode 100644 index 422896dcc..000000000 --- a/tests/emscripten_resources/emtests/test_array2b.out +++ /dev/null @@ -1,2 +0,0 @@ -*6,6 -7,95* \ No newline at end of file diff --git a/tests/emscripten_resources/emtests/test_atoX.out b/tests/emscripten_resources/emtests/test_atoX.out deleted file mode 100644 index 4b76d26d3..000000000 --- a/tests/emscripten_resources/emtests/test_atoX.out +++ /dev/null @@ -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 diff --git a/tests/emscripten_resources/emtests/test_atomic.out b/tests/emscripten_resources/emtests/test_atomic.out deleted file mode 100644 index ed11bce08..000000000 --- a/tests/emscripten_resources/emtests/test_atomic.out +++ /dev/null @@ -1,5 +0,0 @@ -*15,15* -*15,10* -*6,10* -*10,0* -*7,1* \ No newline at end of file diff --git a/tests/emscripten_resources/emtests/test_bsearch.out b/tests/emscripten_resources/emtests/test_bsearch.out deleted file mode 100644 index cc6a32050..000000000 --- a/tests/emscripten_resources/emtests/test_bsearch.out +++ /dev/null @@ -1,10 +0,0 @@ --2 --1 -0 -6 -7 -9 -null -null -null -null \ No newline at end of file diff --git a/tests/emscripten_resources/emtests/test_complex.out b/tests/emscripten_resources/emtests/test_complex.out deleted file mode 100644 index 6f08f2010..000000000 --- a/tests/emscripten_resources/emtests/test_complex.out +++ /dev/null @@ -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 diff --git a/tests/emscripten_resources/emtests/test_double_varargs.out b/tests/emscripten_resources/emtests/test_double_varargs.out deleted file mode 100644 index c907decea..000000000 --- a/tests/emscripten_resources/emtests/test_double_varargs.out +++ /dev/null @@ -1,2 +0,0 @@ -15.000000 -15.000000 diff --git a/tests/emscripten_resources/emtests/test_erf.out b/tests/emscripten_resources/emtests/test_erf.out deleted file mode 100644 index 3b48202f9..000000000 --- a/tests/emscripten_resources/emtests/test_erf.out +++ /dev/null @@ -1 +0,0 @@ -0.842701, 0.999978, -0.842701, 0.157299, 0.000022, 1.966105 \ No newline at end of file diff --git a/tests/emscripten_resources/emtests/test_errar.out b/tests/emscripten_resources/emtests/test_errar.out deleted file mode 100644 index 7df247dd0..000000000 --- a/tests/emscripten_resources/emtests/test_errar.out +++ /dev/null @@ -1,4 +0,0 @@ - - -<34> -<123> diff --git a/tests/emscripten_resources/emtests/test_execvp.out b/tests/emscripten_resources/emtests/test_execvp.out deleted file mode 100644 index 5048f1e2c..000000000 --- a/tests/emscripten_resources/emtests/test_execvp.out +++ /dev/null @@ -1 +0,0 @@ -_execvp diff --git a/tests/emscripten_resources/emtests/test_fast_math.out b/tests/emscripten_resources/emtests/test_fast_math.out deleted file mode 100644 index d1bb57009..000000000 --- a/tests/emscripten_resources/emtests/test_fast_math.out +++ /dev/null @@ -1 +0,0 @@ -total: 19 \ No newline at end of file diff --git a/tests/emscripten_resources/emtests/test_fcvt.out b/tests/emscripten_resources/emtests/test_fcvt.out deleted file mode 100644 index 835f34e73..000000000 --- a/tests/emscripten_resources/emtests/test_fcvt.out +++ /dev/null @@ -1 +0,0 @@ -source: 3.1415926535 buffer: '31415927' decimal: 1 sign: 0 \ No newline at end of file diff --git a/tests/emtest.rs b/tests/emtest.rs index bf9de1a27..0527081e6 100644 --- a/tests/emtest.rs +++ b/tests/emtest.rs @@ -1,2 +1,73 @@ -mod emtests; -pub mod utils; +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(()) +} diff --git a/tests/emtests/_common.rs b/tests/emtests/_common.rs deleted file mode 100644 index 9eae188d9..000000000 --- a/tests/emtests/_common.rs +++ /dev/null @@ -1,110 +0,0 @@ -use std::env; -use wasmer::compiler::Backend; - -pub fn get_backend() -> Option { - #[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 -// ); -// } diff --git a/tests/emtests/clock_gettime.rs b/tests/emtests/clock_gettime.rs deleted file mode 100644 index 63f34fc4c..000000000 --- a/tests/emtests/clock_gettime.rs +++ /dev/null @@ -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" - ); -} diff --git a/tests/emtests/emscripten_get_compiler_setting.rs b/tests/emtests/emscripten_get_compiler_setting.rs deleted file mode 100644 index a9bb2c9d7..000000000 --- a/tests/emtests/emscripten_get_compiler_setting.rs +++ /dev/null @@ -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" - ); -} diff --git a/tests/emtests/env.rs b/tests/emtests/env.rs deleted file mode 100644 index c00e28e87..000000000 --- a/tests/emtests/env.rs +++ /dev/null @@ -1,9 +0,0 @@ -#[test] -fn test_env() { - assert_emscripten_output!( - "../emscripten_resources/emtests/env.wasm", - "env", - vec![], - "../emscripten_resources/emtests/env.out" - ); -} diff --git a/tests/emtests/fs_exports.rs b/tests/emtests/fs_exports.rs deleted file mode 100644 index 520da5e58..000000000 --- a/tests/emtests/fs_exports.rs +++ /dev/null @@ -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" - ); -} diff --git a/tests/emtests/getvalue_setvalue.rs b/tests/emtests/getvalue_setvalue.rs deleted file mode 100644 index bd1836237..000000000 --- a/tests/emtests/getvalue_setvalue.rs +++ /dev/null @@ -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" - ); -} diff --git a/tests/emtests/legacy_exported_runtime_numbers.rs b/tests/emtests/legacy_exported_runtime_numbers.rs deleted file mode 100644 index 53fe06fb0..000000000 --- a/tests/emtests/legacy_exported_runtime_numbers.rs +++ /dev/null @@ -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" - ); -} diff --git a/tests/emtests/localtime.rs b/tests/emtests/localtime.rs deleted file mode 100644 index 3ede05177..000000000 --- a/tests/emtests/localtime.rs +++ /dev/null @@ -1,9 +0,0 @@ -#[test] -fn test_localtime() { - assert_emscripten_output!( - "../emscripten_resources/emtests/localtime.wasm", - "localtime", - vec![], - "../emscripten_resources/emtests/localtime.out" - ); -} diff --git a/tests/emtests/mod.rs b/tests/emtests/mod.rs deleted file mode 100644 index c63afcfd0..000000000 --- a/tests/emtests/mod.rs +++ /dev/null @@ -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; diff --git a/tests/emtests/modularize_closure_pre.rs b/tests/emtests/modularize_closure_pre.rs deleted file mode 100644 index 21cebbdbf..000000000 --- a/tests/emtests/modularize_closure_pre.rs +++ /dev/null @@ -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" - ); -} diff --git a/tests/emtests/printf.rs b/tests/emtests/printf.rs deleted file mode 100644 index a093a1a32..000000000 --- a/tests/emtests/printf.rs +++ /dev/null @@ -1,9 +0,0 @@ -#[test] -fn test_printf() { - assert_emscripten_output!( - "../emscripten_resources/emtests/printf.wasm", - "printf", - vec![], - "../emscripten_resources/emtests/printf.out" - ); -} diff --git a/tests/emtests/puts.rs b/tests/emtests/puts.rs deleted file mode 100644 index 900cadc93..000000000 --- a/tests/emtests/puts.rs +++ /dev/null @@ -1,9 +0,0 @@ -#[test] -fn test_puts() { - assert_emscripten_output!( - "../emscripten_resources/emtests/puts.wasm", - "puts", - vec![], - "../emscripten_resources/emtests/puts.out" - ); -} diff --git a/tests/emtests/stackalloc.rs b/tests/emtests/stackalloc.rs deleted file mode 100644 index 2c00b5547..000000000 --- a/tests/emtests/stackalloc.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_stackalloc() { - assert_emscripten_output!( - "../emscripten_resources/emtests/stackAlloc.wasm", - "stackalloc", - vec![], - "../emscripten_resources/emtests/stackAlloc.txt" - ); -} diff --git a/tests/emtests/syscalls.rs b/tests/emtests/syscalls.rs deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/emtests/test_addr_of_stacked.rs b/tests/emtests/test_addr_of_stacked.rs deleted file mode 100644 index 1883a4fba..000000000 --- a/tests/emtests/test_addr_of_stacked.rs +++ /dev/null @@ -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" - ); -} diff --git a/tests/emtests/test_alloca.rs b/tests/emtests/test_alloca.rs deleted file mode 100644 index ee0683d9f..000000000 --- a/tests/emtests/test_alloca.rs +++ /dev/null @@ -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" - ); -} diff --git a/tests/emtests/test_alloca_stack.rs b/tests/emtests/test_alloca_stack.rs deleted file mode 100644 index 6fe6797a2..000000000 --- a/tests/emtests/test_alloca_stack.rs +++ /dev/null @@ -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" - ); -} diff --git a/tests/emtests/test_array2.rs b/tests/emtests/test_array2.rs deleted file mode 100644 index 53e916893..000000000 --- a/tests/emtests/test_array2.rs +++ /dev/null @@ -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" - ); -} diff --git a/tests/emtests/test_array2b.rs b/tests/emtests/test_array2b.rs deleted file mode 100644 index b60426f2d..000000000 --- a/tests/emtests/test_array2b.rs +++ /dev/null @@ -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" - ); -} diff --git a/tests/emtests/test_atomic.rs b/tests/emtests/test_atomic.rs deleted file mode 100644 index 5c9f44dfe..000000000 --- a/tests/emtests/test_atomic.rs +++ /dev/null @@ -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" - ); -} diff --git a/tests/emtests/test_atox.rs b/tests/emtests/test_atox.rs deleted file mode 100644 index 0e7bd0efd..000000000 --- a/tests/emtests/test_atox.rs +++ /dev/null @@ -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" - ); -} diff --git a/tests/emtests/test_bsearch.rs b/tests/emtests/test_bsearch.rs deleted file mode 100644 index f5c6ba428..000000000 --- a/tests/emtests/test_bsearch.rs +++ /dev/null @@ -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" - ); -} diff --git a/tests/emtests/test_ccall.rs b/tests/emtests/test_ccall.rs deleted file mode 100644 index 459e69c09..000000000 --- a/tests/emtests/test_ccall.rs +++ /dev/null @@ -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" - ); -} diff --git a/tests/emtests/test_complex.rs b/tests/emtests/test_complex.rs deleted file mode 100644 index d026c2c27..000000000 --- a/tests/emtests/test_complex.rs +++ /dev/null @@ -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" - ); -} diff --git a/tests/emtests/test_demangle_stacks.rs b/tests/emtests/test_demangle_stacks.rs deleted file mode 100644 index 0bd31dbcb..000000000 --- a/tests/emtests/test_demangle_stacks.rs +++ /dev/null @@ -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" - ); -} diff --git a/tests/emtests/test_demangle_stacks_noassert.rs b/tests/emtests/test_demangle_stacks_noassert.rs deleted file mode 100644 index b4a1dbf51..000000000 --- a/tests/emtests/test_demangle_stacks_noassert.rs +++ /dev/null @@ -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" - ); -} diff --git a/tests/emtests/test_dlmalloc_partial_2.rs b/tests/emtests/test_dlmalloc_partial_2.rs deleted file mode 100644 index 6b97f917b..000000000 --- a/tests/emtests/test_dlmalloc_partial_2.rs +++ /dev/null @@ -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" - ); -} diff --git a/tests/emtests/test_double_varargs.rs b/tests/emtests/test_double_varargs.rs deleted file mode 100644 index 556e65cae..000000000 --- a/tests/emtests/test_double_varargs.rs +++ /dev/null @@ -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" - ); -} diff --git a/tests/emtests/test_em_asm.rs b/tests/emtests/test_em_asm.rs deleted file mode 100644 index 182e23f0c..000000000 --- a/tests/emtests/test_em_asm.rs +++ /dev/null @@ -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" - ); -} diff --git a/tests/emtests/test_em_asm_2.rs b/tests/emtests/test_em_asm_2.rs deleted file mode 100644 index 4ee103579..000000000 --- a/tests/emtests/test_em_asm_2.rs +++ /dev/null @@ -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" - ); -} diff --git a/tests/emtests/test_em_asm_parameter_pack.rs b/tests/emtests/test_em_asm_parameter_pack.rs deleted file mode 100644 index 420efc5ea..000000000 --- a/tests/emtests/test_em_asm_parameter_pack.rs +++ /dev/null @@ -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" - ); -} diff --git a/tests/emtests/test_em_asm_signatures.rs b/tests/emtests/test_em_asm_signatures.rs deleted file mode 100644 index d0470166d..000000000 --- a/tests/emtests/test_em_asm_signatures.rs +++ /dev/null @@ -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" - ); -} diff --git a/tests/emtests/test_em_asm_unicode.rs b/tests/emtests/test_em_asm_unicode.rs deleted file mode 100644 index a00ae3b42..000000000 --- a/tests/emtests/test_em_asm_unicode.rs +++ /dev/null @@ -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" - ); -} diff --git a/tests/emtests/test_em_asm_unused_arguments.rs b/tests/emtests/test_em_asm_unused_arguments.rs deleted file mode 100644 index 3b7a07206..000000000 --- a/tests/emtests/test_em_asm_unused_arguments.rs +++ /dev/null @@ -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" - ); -} diff --git a/tests/emtests/test_em_js.rs b/tests/emtests/test_em_js.rs deleted file mode 100644 index ff4502c2e..000000000 --- a/tests/emtests/test_em_js.rs +++ /dev/null @@ -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" - ); -} diff --git a/tests/emtests/test_emscripten_api.rs b/tests/emtests/test_emscripten_api.rs deleted file mode 100644 index 95d79e708..000000000 --- a/tests/emtests/test_emscripten_api.rs +++ /dev/null @@ -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" - ); -} diff --git a/tests/emtests/test_erf.rs b/tests/emtests/test_erf.rs deleted file mode 100644 index efc16ccb3..000000000 --- a/tests/emtests/test_erf.rs +++ /dev/null @@ -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" - ); -} diff --git a/tests/emtests/test_errar.rs b/tests/emtests/test_errar.rs deleted file mode 100644 index 94238860c..000000000 --- a/tests/emtests/test_errar.rs +++ /dev/null @@ -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" - ); -} diff --git a/tests/emtests/test_exceptions_2.rs b/tests/emtests/test_exceptions_2.rs deleted file mode 100644 index 6360db35e..000000000 --- a/tests/emtests/test_exceptions_2.rs +++ /dev/null @@ -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" - ); -} diff --git a/tests/emtests/test_exceptions_multi.rs b/tests/emtests/test_exceptions_multi.rs deleted file mode 100644 index 1a6c28801..000000000 --- a/tests/emtests/test_exceptions_multi.rs +++ /dev/null @@ -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" - ); -} diff --git a/tests/emtests/test_exceptions_std.rs b/tests/emtests/test_exceptions_std.rs deleted file mode 100644 index 1003b60c3..000000000 --- a/tests/emtests/test_exceptions_std.rs +++ /dev/null @@ -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" - ); -} diff --git a/tests/emtests/test_exceptions_white_list.rs b/tests/emtests/test_exceptions_white_list.rs deleted file mode 100644 index ce5db9ff5..000000000 --- a/tests/emtests/test_exceptions_white_list.rs +++ /dev/null @@ -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" - ); -} diff --git a/tests/emtests/test_execvp.rs b/tests/emtests/test_execvp.rs deleted file mode 100644 index 2d60751a5..000000000 --- a/tests/emtests/test_execvp.rs +++ /dev/null @@ -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" - ); -} diff --git a/tests/emtests/test_fast_math.rs b/tests/emtests/test_fast_math.rs deleted file mode 100644 index 9a025d48c..000000000 --- a/tests/emtests/test_fast_math.rs +++ /dev/null @@ -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" - ); -} diff --git a/tests/emtests/test_flexarray_struct.rs b/tests/emtests/test_flexarray_struct.rs deleted file mode 100644 index 922209a2c..000000000 --- a/tests/emtests/test_flexarray_struct.rs +++ /dev/null @@ -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" - ); -} diff --git a/tests/emtests/test_float32_precise.rs b/tests/emtests/test_float32_precise.rs deleted file mode 100644 index 3fa808eb2..000000000 --- a/tests/emtests/test_float32_precise.rs +++ /dev/null @@ -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" - ); -} diff --git a/tests/emtests/test_float_builtins.rs b/tests/emtests/test_float_builtins.rs deleted file mode 100644 index 120455267..000000000 --- a/tests/emtests/test_float_builtins.rs +++ /dev/null @@ -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" - ); -} diff --git a/tests/emtests/test_frexp.rs b/tests/emtests/test_frexp.rs deleted file mode 100644 index 43552c702..000000000 --- a/tests/emtests/test_frexp.rs +++ /dev/null @@ -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" - ); -} diff --git a/tests/emtests/test_funcptr.rs b/tests/emtests/test_funcptr.rs deleted file mode 100644 index 48f08bf9d..000000000 --- a/tests/emtests/test_funcptr.rs +++ /dev/null @@ -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" - ); -} diff --git a/tests/emtests/test_funcptr_namecollide.rs b/tests/emtests/test_funcptr_namecollide.rs deleted file mode 100644 index 794ece293..000000000 --- a/tests/emtests/test_funcptr_namecollide.rs +++ /dev/null @@ -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" - ); -} diff --git a/tests/emtests/test_funcptrfunc.rs b/tests/emtests/test_funcptrfunc.rs deleted file mode 100644 index a9bbccd35..000000000 --- a/tests/emtests/test_funcptrfunc.rs +++ /dev/null @@ -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" - ); -} diff --git a/tests/emtests/test_funcs.rs b/tests/emtests/test_funcs.rs deleted file mode 100644 index bdd85b675..000000000 --- a/tests/emtests/test_funcs.rs +++ /dev/null @@ -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" - ); -} diff --git a/tests/emtests/test_functionpointer_libfunc_varargs.rs b/tests/emtests/test_functionpointer_libfunc_varargs.rs deleted file mode 100644 index 9e0e24025..000000000 --- a/tests/emtests/test_functionpointer_libfunc_varargs.rs +++ /dev/null @@ -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" - ); -} diff --git a/tests/emtests/test_fwrite_0.rs b/tests/emtests/test_fwrite_0.rs deleted file mode 100644 index 1ac0aa0e5..000000000 --- a/tests/emtests/test_fwrite_0.rs +++ /dev/null @@ -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" - ); -} diff --git a/tests/emtests/test_getcwd.rs b/tests/emtests/test_getcwd.rs deleted file mode 100644 index fd8012b24..000000000 --- a/tests/emtests/test_getcwd.rs +++ /dev/null @@ -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" - ); -} diff --git a/tests/emtests/test_getgep.rs b/tests/emtests/test_getgep.rs deleted file mode 100644 index 5a9cc8e3d..000000000 --- a/tests/emtests/test_getgep.rs +++ /dev/null @@ -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" - ); -} diff --git a/tests/emtests/test_getloadavg.rs b/tests/emtests/test_getloadavg.rs deleted file mode 100644 index a94db0dd0..000000000 --- a/tests/emtests/test_getloadavg.rs +++ /dev/null @@ -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" - ); -} diff --git a/tests/emtests/test_getopt.rs b/tests/emtests/test_getopt.rs deleted file mode 100644 index 6f2bf6bf7..000000000 --- a/tests/emtests/test_getopt.rs +++ /dev/null @@ -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" - ); -} diff --git a/tests/emtests/test_getopt_long.rs b/tests/emtests/test_getopt_long.rs deleted file mode 100644 index 06590b053..000000000 --- a/tests/emtests/test_getopt_long.rs +++ /dev/null @@ -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" - ); -} diff --git a/tests/emtests/test_globaldoubles.rs b/tests/emtests/test_globaldoubles.rs deleted file mode 100644 index e85702634..000000000 --- a/tests/emtests/test_globaldoubles.rs +++ /dev/null @@ -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" - ); -} diff --git a/tests/emtests/test_globals.rs b/tests/emtests/test_globals.rs deleted file mode 100644 index 3edd9dee8..000000000 --- a/tests/emtests/test_globals.rs +++ /dev/null @@ -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" - ); -} diff --git a/tests/emtests/test_gmtime.rs b/tests/emtests/test_gmtime.rs deleted file mode 100644 index 96f4c8c7d..000000000 --- a/tests/emtests/test_gmtime.rs +++ /dev/null @@ -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" - ); -} diff --git a/tests/emtests/test_hello_world.rs b/tests/emtests/test_hello_world.rs deleted file mode 100644 index 32b28f25c..000000000 --- a/tests/emtests/test_hello_world.rs +++ /dev/null @@ -1,9 +0,0 @@ -#[test] -fn test_test_hello_world() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_hello_world.wasm", - "test_hello_world", - vec![], - "../emscripten_resources/emtests/test_hello_world.out" - ); -} diff --git a/tests/emtests/test_i16_emcc_intrinsic.rs b/tests/emtests/test_i16_emcc_intrinsic.rs deleted file mode 100644 index cc4b5d6c0..000000000 --- a/tests/emtests/test_i16_emcc_intrinsic.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_i16_emcc_intrinsic() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_i16_emcc_intrinsic.wasm", - "test_i16_emcc_intrinsic", - vec![], - "../emscripten_resources/emtests/test_i16_emcc_intrinsic.out" - ); -} diff --git a/tests/emtests/test_i32_mul_precise.rs b/tests/emtests/test_i32_mul_precise.rs deleted file mode 100644 index 92c2b6bf6..000000000 --- a/tests/emtests/test_i32_mul_precise.rs +++ /dev/null @@ -1,9 +0,0 @@ -#[test] -fn test_test_i32_mul_precise() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_i32_mul_precise.wasm", - "test_i32_mul_precise", - vec![], - "../emscripten_resources/emtests/test_i32_mul_precise.out" - ); -} diff --git a/tests/emtests/test_i64.rs b/tests/emtests/test_i64.rs deleted file mode 100644 index 7b6c1cdc8..000000000 --- a/tests/emtests/test_i64.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_i64() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_i64.wasm", - "test_i64", - vec![], - "../emscripten_resources/emtests/test_i64.out" - ); -} diff --git a/tests/emtests/test_i64_4.rs b/tests/emtests/test_i64_4.rs deleted file mode 100644 index 394f0edd3..000000000 --- a/tests/emtests/test_i64_4.rs +++ /dev/null @@ -1,9 +0,0 @@ -#[test] -fn test_test_i64_4() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_i64_4.wasm", - "test_i64_4", - vec![], - "../emscripten_resources/emtests/test_i64_4.out" - ); -} diff --git a/tests/emtests/test_i64_7z.rs b/tests/emtests/test_i64_7z.rs deleted file mode 100644 index 4e76c919f..000000000 --- a/tests/emtests/test_i64_7z.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_i64_7z() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_i64_7z.wasm", - "test_i64_7z", - vec![], - "../emscripten_resources/emtests/test_i64_7z.out" - ); -} diff --git a/tests/emtests/test_i64_cmp2.rs b/tests/emtests/test_i64_cmp2.rs deleted file mode 100644 index 4ba994da4..000000000 --- a/tests/emtests/test_i64_cmp2.rs +++ /dev/null @@ -1,9 +0,0 @@ -#[test] -fn test_test_i64_cmp2() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_i64_cmp2.wasm", - "test_i64_cmp2", - vec![], - "../emscripten_resources/emtests/test_i64_cmp2.out" - ); -} diff --git a/tests/emtests/test_i64_i16.rs b/tests/emtests/test_i64_i16.rs deleted file mode 100644 index 32a98a633..000000000 --- a/tests/emtests/test_i64_i16.rs +++ /dev/null @@ -1,9 +0,0 @@ -#[test] -fn test_test_i64_i16() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_i64_i16.wasm", - "test_i64_i16", - vec![], - "../emscripten_resources/emtests/test_i64_i16.out" - ); -} diff --git a/tests/emtests/test_i64_llabs.rs b/tests/emtests/test_i64_llabs.rs deleted file mode 100644 index babf82e37..000000000 --- a/tests/emtests/test_i64_llabs.rs +++ /dev/null @@ -1,9 +0,0 @@ -#[test] -fn test_test_i64_llabs() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_i64_llabs.wasm", - "test_i64_llabs", - vec![], - "../emscripten_resources/emtests/test_i64_llabs.out" - ); -} diff --git a/tests/emtests/test_i64_precise.rs b/tests/emtests/test_i64_precise.rs deleted file mode 100644 index 4ed397f21..000000000 --- a/tests/emtests/test_i64_precise.rs +++ /dev/null @@ -1,9 +0,0 @@ -#[test] -fn test_test_i64_precise() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_i64_precise.wasm", - "test_i64_precise", - vec![], - "../emscripten_resources/emtests/test_i64_precise.out" - ); -} diff --git a/tests/emtests/test_i64_precise_needed.rs b/tests/emtests/test_i64_precise_needed.rs deleted file mode 100644 index 01eefaeb3..000000000 --- a/tests/emtests/test_i64_precise_needed.rs +++ /dev/null @@ -1,9 +0,0 @@ -#[test] -fn test_test_i64_precise_needed() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_i64_precise_needed.wasm", - "test_i64_precise_needed", - vec![], - "../emscripten_resources/emtests/test_i64_precise_needed.out" - ); -} diff --git a/tests/emtests/test_i64_precise_unneeded.rs b/tests/emtests/test_i64_precise_unneeded.rs deleted file mode 100644 index 4f8815bc5..000000000 --- a/tests/emtests/test_i64_precise_unneeded.rs +++ /dev/null @@ -1,9 +0,0 @@ -#[test] -fn test_test_i64_precise_unneeded() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_i64_precise_unneeded.wasm", - "test_i64_precise_unneeded", - vec![], - "../emscripten_resources/emtests/test_i64_precise_unneeded.out" - ); -} diff --git a/tests/emtests/test_i64_qdouble.rs b/tests/emtests/test_i64_qdouble.rs deleted file mode 100644 index dae1f36bf..000000000 --- a/tests/emtests/test_i64_qdouble.rs +++ /dev/null @@ -1,9 +0,0 @@ -#[test] -fn test_test_i64_qdouble() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_i64_qdouble.wasm", - "test_i64_qdouble", - vec![], - "../emscripten_resources/emtests/test_i64_qdouble.out" - ); -} diff --git a/tests/emtests/test_i64_umul.rs b/tests/emtests/test_i64_umul.rs deleted file mode 100644 index 8eb16c696..000000000 --- a/tests/emtests/test_i64_umul.rs +++ /dev/null @@ -1,9 +0,0 @@ -#[test] -fn test_test_i64_umul() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_i64_umul.wasm", - "test_i64_umul", - vec![], - "../emscripten_resources/emtests/test_i64_umul.out" - ); -} diff --git a/tests/emtests/test_i64_varargs.rs b/tests/emtests/test_i64_varargs.rs deleted file mode 100644 index 6a8c25492..000000000 --- a/tests/emtests/test_i64_varargs.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_i64_varargs() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_i64_varargs.wasm", - "test_i64_varargs", - vec![], - "../emscripten_resources/emtests/test_i64_varargs.out" - ); -} diff --git a/tests/emtests/test_i64_zextneg.rs b/tests/emtests/test_i64_zextneg.rs deleted file mode 100644 index 0f090ef9a..000000000 --- a/tests/emtests/test_i64_zextneg.rs +++ /dev/null @@ -1,9 +0,0 @@ -#[test] -fn test_test_i64_zextneg() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_i64_zextneg.wasm", - "test_i64_zextneg", - vec![], - "../emscripten_resources/emtests/test_i64_zextneg.out" - ); -} diff --git a/tests/emtests/test_if.rs b/tests/emtests/test_if.rs deleted file mode 100644 index b0204454e..000000000 --- a/tests/emtests/test_if.rs +++ /dev/null @@ -1,9 +0,0 @@ -#[test] -fn test_test_if() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_if.wasm", - "test_if", - vec![], - "../emscripten_resources/emtests/test_if.out" - ); -} diff --git a/tests/emtests/test_if_else.rs b/tests/emtests/test_if_else.rs deleted file mode 100644 index 7f7eed1d9..000000000 --- a/tests/emtests/test_if_else.rs +++ /dev/null @@ -1,9 +0,0 @@ -#[test] -fn test_test_if_else() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_if_else.wasm", - "test_if_else", - vec![], - "../emscripten_resources/emtests/test_if_else.out" - ); -} diff --git a/tests/emtests/test_indirectbr.rs b/tests/emtests/test_indirectbr.rs deleted file mode 100644 index a02864e17..000000000 --- a/tests/emtests/test_indirectbr.rs +++ /dev/null @@ -1,9 +0,0 @@ -#[test] -fn test_test_indirectbr() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_indirectbr.wasm", - "test_indirectbr", - vec![], - "../emscripten_resources/emtests/test_indirectbr.out" - ); -} diff --git a/tests/emtests/test_indirectbr_many.rs b/tests/emtests/test_indirectbr_many.rs deleted file mode 100644 index 6deddfc0f..000000000 --- a/tests/emtests/test_indirectbr_many.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_indirectbr_many() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_indirectbr_many.wasm", - "test_indirectbr_many", - vec![], - "../emscripten_resources/emtests/test_indirectbr_many.out" - ); -} diff --git a/tests/emtests/test_isnan.rs b/tests/emtests/test_isnan.rs deleted file mode 100644 index d33419f4a..000000000 --- a/tests/emtests/test_isnan.rs +++ /dev/null @@ -1,9 +0,0 @@ -#[test] -fn test_test_isnan() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_isnan.wasm", - "test_isnan", - vec![], - "../emscripten_resources/emtests/test_isnan.out" - ); -} diff --git a/tests/emtests/test_libcextra.rs b/tests/emtests/test_libcextra.rs deleted file mode 100644 index ea5381c97..000000000 --- a/tests/emtests/test_libcextra.rs +++ /dev/null @@ -1,9 +0,0 @@ -#[test] -fn test_test_libcextra() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_libcextra.wasm", - "test_libcextra", - vec![], - "../emscripten_resources/emtests/test_libcextra.out" - ); -} diff --git a/tests/emtests/test_libgen.rs b/tests/emtests/test_libgen.rs deleted file mode 100644 index 89489d4ae..000000000 --- a/tests/emtests/test_libgen.rs +++ /dev/null @@ -1,9 +0,0 @@ -#[test] -fn test_test_libgen() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_libgen.wasm", - "test_libgen", - vec![], - "../emscripten_resources/emtests/test_libgen.out" - ); -} diff --git a/tests/emtests/test_literal_negative_zero.rs b/tests/emtests/test_literal_negative_zero.rs deleted file mode 100644 index 3a02206aa..000000000 --- a/tests/emtests/test_literal_negative_zero.rs +++ /dev/null @@ -1,9 +0,0 @@ -#[test] -fn test_test_literal_negative_zero() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_literal_negative_zero.wasm", - "test_literal_negative_zero", - vec![], - "../emscripten_resources/emtests/test_literal_negative_zero.out" - ); -} diff --git a/tests/emtests/test_llrint.rs b/tests/emtests/test_llrint.rs deleted file mode 100644 index 4c6114fad..000000000 --- a/tests/emtests/test_llrint.rs +++ /dev/null @@ -1,9 +0,0 @@ -#[test] -fn test_test_llrint() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_llrint.wasm", - "test_llrint", - vec![], - "../emscripten_resources/emtests/test_llrint.out" - ); -} diff --git a/tests/emtests/test_llvm_fabs.rs b/tests/emtests/test_llvm_fabs.rs deleted file mode 100644 index 33c2cb183..000000000 --- a/tests/emtests/test_llvm_fabs.rs +++ /dev/null @@ -1,9 +0,0 @@ -#[test] -fn test_test_llvm_fabs() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_llvm_fabs.wasm", - "test_llvm_fabs", - vec![], - "../emscripten_resources/emtests/test_llvm_fabs.out" - ); -} diff --git a/tests/emtests/test_llvm_intrinsics.rs b/tests/emtests/test_llvm_intrinsics.rs deleted file mode 100644 index 3227d71cc..000000000 --- a/tests/emtests/test_llvm_intrinsics.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_llvm_intrinsics() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_llvm_intrinsics.wasm", - "test_llvm_intrinsics", - vec![], - "../emscripten_resources/emtests/test_llvm_intrinsics.out" - ); -} diff --git a/tests/emtests/test_llvmswitch.rs b/tests/emtests/test_llvmswitch.rs deleted file mode 100644 index 5a0dfa058..000000000 --- a/tests/emtests/test_llvmswitch.rs +++ /dev/null @@ -1,9 +0,0 @@ -#[test] -fn test_test_llvmswitch() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_llvmswitch.wasm", - "test_llvmswitch", - vec![], - "../emscripten_resources/emtests/test_llvmswitch.out" - ); -} diff --git a/tests/emtests/test_longjmp.rs b/tests/emtests/test_longjmp.rs deleted file mode 100644 index 67b76c704..000000000 --- a/tests/emtests/test_longjmp.rs +++ /dev/null @@ -1,9 +0,0 @@ -#[test] -fn test_test_longjmp() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_longjmp.wasm", - "test_longjmp", - vec![], - "../emscripten_resources/emtests/test_longjmp.out" - ); -} diff --git a/tests/emtests/test_longjmp2.rs b/tests/emtests/test_longjmp2.rs deleted file mode 100644 index 3eeb77899..000000000 --- a/tests/emtests/test_longjmp2.rs +++ /dev/null @@ -1,9 +0,0 @@ -#[test] -fn test_test_longjmp2() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_longjmp2.wasm", - "test_longjmp2", - vec![], - "../emscripten_resources/emtests/test_longjmp2.out" - ); -} diff --git a/tests/emtests/test_longjmp3.rs b/tests/emtests/test_longjmp3.rs deleted file mode 100644 index c878374ba..000000000 --- a/tests/emtests/test_longjmp3.rs +++ /dev/null @@ -1,9 +0,0 @@ -#[test] -fn test_test_longjmp3() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_longjmp3.wasm", - "test_longjmp3", - vec![], - "../emscripten_resources/emtests/test_longjmp3.out" - ); -} diff --git a/tests/emtests/test_longjmp4.rs b/tests/emtests/test_longjmp4.rs deleted file mode 100644 index 7a05e1637..000000000 --- a/tests/emtests/test_longjmp4.rs +++ /dev/null @@ -1,9 +0,0 @@ -#[test] -fn test_test_longjmp4() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_longjmp4.wasm", - "test_longjmp4", - vec![], - "../emscripten_resources/emtests/test_longjmp4.out" - ); -} diff --git a/tests/emtests/test_longjmp_exc.rs b/tests/emtests/test_longjmp_exc.rs deleted file mode 100644 index 1fac03a3e..000000000 --- a/tests/emtests/test_longjmp_exc.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_longjmp_exc() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_longjmp_exc.wasm", - "test_longjmp_exc", - vec![], - "../emscripten_resources/emtests/test_longjmp_exc.out" - ); -} diff --git a/tests/emtests/test_longjmp_funcptr.rs b/tests/emtests/test_longjmp_funcptr.rs deleted file mode 100644 index e2a127d26..000000000 --- a/tests/emtests/test_longjmp_funcptr.rs +++ /dev/null @@ -1,9 +0,0 @@ -#[test] -fn test_test_longjmp_funcptr() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_longjmp_funcptr.wasm", - "test_longjmp_funcptr", - vec![], - "../emscripten_resources/emtests/test_longjmp_funcptr.out" - ); -} diff --git a/tests/emtests/test_longjmp_repeat.rs b/tests/emtests/test_longjmp_repeat.rs deleted file mode 100644 index 7f2f27b8e..000000000 --- a/tests/emtests/test_longjmp_repeat.rs +++ /dev/null @@ -1,9 +0,0 @@ -#[test] -fn test_test_longjmp_repeat() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_longjmp_repeat.wasm", - "test_longjmp_repeat", - vec![], - "../emscripten_resources/emtests/test_longjmp_repeat.out" - ); -} diff --git a/tests/emtests/test_longjmp_stacked.rs b/tests/emtests/test_longjmp_stacked.rs deleted file mode 100644 index 4d2fddd4d..000000000 --- a/tests/emtests/test_longjmp_stacked.rs +++ /dev/null @@ -1,9 +0,0 @@ -#[test] -fn test_test_longjmp_stacked() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_longjmp_stacked.wasm", - "test_longjmp_stacked", - vec![], - "../emscripten_resources/emtests/test_longjmp_stacked.out" - ); -} diff --git a/tests/emtests/test_longjmp_throw.rs b/tests/emtests/test_longjmp_throw.rs deleted file mode 100644 index 15b382f05..000000000 --- a/tests/emtests/test_longjmp_throw.rs +++ /dev/null @@ -1,9 +0,0 @@ -#[test] -fn test_test_longjmp_throw() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_longjmp_throw.wasm", - "test_longjmp_throw", - vec![], - "../emscripten_resources/emtests/test_longjmp_throw.out" - ); -} diff --git a/tests/emtests/test_longjmp_unwind.rs b/tests/emtests/test_longjmp_unwind.rs deleted file mode 100644 index 0c9780c41..000000000 --- a/tests/emtests/test_longjmp_unwind.rs +++ /dev/null @@ -1,9 +0,0 @@ -#[test] -fn test_test_longjmp_unwind() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_longjmp_unwind.wasm", - "test_longjmp_unwind", - vec![], - "../emscripten_resources/emtests/test_longjmp_unwind.out" - ); -} diff --git a/tests/emtests/test_loop.rs b/tests/emtests/test_loop.rs deleted file mode 100644 index c6c61ffd9..000000000 --- a/tests/emtests/test_loop.rs +++ /dev/null @@ -1,9 +0,0 @@ -#[test] -fn test_test_loop() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_loop.wasm", - "test_loop", - vec![], - "../emscripten_resources/emtests/test_loop.out" - ); -} diff --git a/tests/emtests/test_lower_intrinsics.rs b/tests/emtests/test_lower_intrinsics.rs deleted file mode 100644 index a5aa51c79..000000000 --- a/tests/emtests/test_lower_intrinsics.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_lower_intrinsics() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_lower_intrinsics.wasm", - "test_lower_intrinsics", - vec![], - "../emscripten_resources/emtests/test_lower_intrinsics.out" - ); -} diff --git a/tests/emtests/test_main_thread_async_em_asm.rs b/tests/emtests/test_main_thread_async_em_asm.rs deleted file mode 100644 index a76fbd4b8..000000000 --- a/tests/emtests/test_main_thread_async_em_asm.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_main_thread_async_em_asm() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_main_thread_async_em_asm.wasm", - "test_main_thread_async_em_asm", - vec![], - "../emscripten_resources/emtests/test_main_thread_async_em_asm.out" - ); -} diff --git a/tests/emtests/test_mainenv.rs b/tests/emtests/test_mainenv.rs deleted file mode 100644 index 9ce017731..000000000 --- a/tests/emtests/test_mainenv.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_mainenv() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_mainenv.wasm", - "test_mainenv", - vec![], - "../emscripten_resources/emtests/test_mainenv.out" - ); -} diff --git a/tests/emtests/test_mathfuncptr.rs b/tests/emtests/test_mathfuncptr.rs deleted file mode 100644 index 32da526b5..000000000 --- a/tests/emtests/test_mathfuncptr.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_mathfuncptr() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_mathfuncptr.wasm", - "test_mathfuncptr", - vec![], - "../emscripten_resources/emtests/test_mathfuncptr.out" - ); -} diff --git a/tests/emtests/test_memcpy2.rs b/tests/emtests/test_memcpy2.rs deleted file mode 100644 index 972d7b454..000000000 --- a/tests/emtests/test_memcpy2.rs +++ /dev/null @@ -1,9 +0,0 @@ -#[test] -fn test_test_memcpy2() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_memcpy2.wasm", - "test_memcpy2", - vec![], - "../emscripten_resources/emtests/test_memcpy2.out" - ); -} diff --git a/tests/emtests/test_memcpy3.rs b/tests/emtests/test_memcpy3.rs deleted file mode 100644 index 982a46dfd..000000000 --- a/tests/emtests/test_memcpy3.rs +++ /dev/null @@ -1,9 +0,0 @@ -#[test] -fn test_test_memcpy3() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_memcpy3.wasm", - "test_memcpy3", - vec![], - "../emscripten_resources/emtests/test_memcpy3.out" - ); -} diff --git a/tests/emtests/test_memcpy_memcmp.rs b/tests/emtests/test_memcpy_memcmp.rs deleted file mode 100644 index b45858f5c..000000000 --- a/tests/emtests/test_memcpy_memcmp.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_memcpy_memcmp() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_memcpy_memcmp.wasm", - "test_memcpy_memcmp", - vec![], - "../emscripten_resources/emtests/test_memcpy_memcmp.out" - ); -} diff --git a/tests/emtests/test_memmove.rs b/tests/emtests/test_memmove.rs deleted file mode 100644 index f839203a0..000000000 --- a/tests/emtests/test_memmove.rs +++ /dev/null @@ -1,9 +0,0 @@ -#[test] -fn test_test_memmove() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_memmove.wasm", - "test_memmove", - vec![], - "../emscripten_resources/emtests/test_memmove.out" - ); -} diff --git a/tests/emtests/test_memmove2.rs b/tests/emtests/test_memmove2.rs deleted file mode 100644 index 7230e0525..000000000 --- a/tests/emtests/test_memmove2.rs +++ /dev/null @@ -1,9 +0,0 @@ -#[test] -fn test_test_memmove2() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_memmove2.wasm", - "test_memmove2", - vec![], - "../emscripten_resources/emtests/test_memmove2.out" - ); -} diff --git a/tests/emtests/test_memmove3.rs b/tests/emtests/test_memmove3.rs deleted file mode 100644 index 2b746ee7e..000000000 --- a/tests/emtests/test_memmove3.rs +++ /dev/null @@ -1,9 +0,0 @@ -#[test] -fn test_test_memmove3() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_memmove3.wasm", - "test_memmove3", - vec![], - "../emscripten_resources/emtests/test_memmove3.out" - ); -} diff --git a/tests/emtests/test_memset.rs b/tests/emtests/test_memset.rs deleted file mode 100644 index ea9df5bda..000000000 --- a/tests/emtests/test_memset.rs +++ /dev/null @@ -1,9 +0,0 @@ -#[test] -fn test_test_memset() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_memset.wasm", - "test_memset", - vec![], - "../emscripten_resources/emtests/test_memset.out" - ); -} diff --git a/tests/emtests/test_mmap.rs b/tests/emtests/test_mmap.rs deleted file mode 100644 index 637398321..000000000 --- a/tests/emtests/test_mmap.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_mmap() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_mmap.wasm", - "test_mmap", - vec![], - "../emscripten_resources/emtests/test_mmap.out" - ); -} diff --git a/tests/emtests/test_negative_zero.rs b/tests/emtests/test_negative_zero.rs deleted file mode 100644 index 1cedcf0a9..000000000 --- a/tests/emtests/test_negative_zero.rs +++ /dev/null @@ -1,9 +0,0 @@ -#[test] -fn test_test_negative_zero() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_negative_zero.wasm", - "test_negative_zero", - vec![], - "../emscripten_resources/emtests/test_negative_zero.out" - ); -} diff --git a/tests/emtests/test_nested_struct_varargs.rs b/tests/emtests/test_nested_struct_varargs.rs deleted file mode 100644 index 3ccbebdc5..000000000 --- a/tests/emtests/test_nested_struct_varargs.rs +++ /dev/null @@ -1,9 +0,0 @@ -#[test] -fn test_test_nested_struct_varargs() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_nested_struct_varargs.wasm", - "test_nested_struct_varargs", - vec![], - "../emscripten_resources/emtests/test_nested_struct_varargs.out" - ); -} diff --git a/tests/emtests/test_nl_types.rs b/tests/emtests/test_nl_types.rs deleted file mode 100644 index 0fa1df542..000000000 --- a/tests/emtests/test_nl_types.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_nl_types() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_nl_types.wasm", - "test_nl_types", - vec![], - "../emscripten_resources/emtests/test_nl_types.out" - ); -} diff --git a/tests/emtests/test_perrar.rs b/tests/emtests/test_perrar.rs deleted file mode 100644 index e63840b35..000000000 --- a/tests/emtests/test_perrar.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_perrar() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_perrar.wasm", - "test_perrar", - vec![], - "../emscripten_resources/emtests/test_perrar.out" - ); -} diff --git a/tests/emtests/test_phiundef.rs b/tests/emtests/test_phiundef.rs deleted file mode 100644 index a64ee38f8..000000000 --- a/tests/emtests/test_phiundef.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_phiundef() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_phiundef.wasm", - "test_phiundef", - vec![], - "../emscripten_resources/emtests/test_phiundef.out" - ); -} diff --git a/tests/emtests/test_pipe.rs b/tests/emtests/test_pipe.rs deleted file mode 100644 index 3f54695f1..000000000 --- a/tests/emtests/test_pipe.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_pipe() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_pipe.wasm", - "test_pipe", - vec![], - "../emscripten_resources/emtests/test_pipe.out" - ); -} diff --git a/tests/emtests/test_poll.rs b/tests/emtests/test_poll.rs deleted file mode 100644 index 261490787..000000000 --- a/tests/emtests/test_poll.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_poll() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_poll.wasm", - "test_poll", - vec![], - "../emscripten_resources/emtests/test_poll.out" - ); -} diff --git a/tests/emtests/test_posixtime.rs b/tests/emtests/test_posixtime.rs deleted file mode 100644 index d7fde99d9..000000000 --- a/tests/emtests/test_posixtime.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_posixtime() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_posixtime.wasm", - "test_posixtime", - vec![], - "../emscripten_resources/emtests/test_posixtime.out" - ); -} diff --git a/tests/emtests/test_printf_2.rs b/tests/emtests/test_printf_2.rs deleted file mode 100644 index 12e59941e..000000000 --- a/tests/emtests/test_printf_2.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_printf_2() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_printf_2.wasm", - "test_printf_2", - vec![], - "../emscripten_resources/emtests/test_printf_2.out" - ); -} diff --git a/tests/emtests/test_printf_more.rs b/tests/emtests/test_printf_more.rs deleted file mode 100644 index 7d5c75023..000000000 --- a/tests/emtests/test_printf_more.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_printf_more() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_printf_more.wasm", - "test_printf_more", - vec![], - "../emscripten_resources/emtests/test_printf_more.out" - ); -} diff --git a/tests/emtests/test_regex.rs b/tests/emtests/test_regex.rs deleted file mode 100644 index ca1004ea4..000000000 --- a/tests/emtests/test_regex.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_regex() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_regex.wasm", - "test_regex", - vec![], - "../emscripten_resources/emtests/test_regex.out" - ); -} diff --git a/tests/emtests/test_relocatable_void_function.rs b/tests/emtests/test_relocatable_void_function.rs deleted file mode 100644 index 7f8dbdf70..000000000 --- a/tests/emtests/test_relocatable_void_function.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_relocatable_void_function() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_relocatable_void_function.wasm", - "test_relocatable_void_function", - vec![], - "../emscripten_resources/emtests/test_relocatable_void_function.out" - ); -} diff --git a/tests/emtests/test_rounding.rs b/tests/emtests/test_rounding.rs deleted file mode 100644 index 4b7ea1540..000000000 --- a/tests/emtests/test_rounding.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_rounding() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_rounding.wasm", - "test_rounding", - vec![], - "../emscripten_resources/emtests/test_rounding.out" - ); -} diff --git a/tests/emtests/test_set_align.rs b/tests/emtests/test_set_align.rs deleted file mode 100644 index 602c7931f..000000000 --- a/tests/emtests/test_set_align.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_set_align() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_set_align.wasm", - "test_set_align", - vec![], - "../emscripten_resources/emtests/test_set_align.out" - ); -} diff --git a/tests/emtests/test_siglongjmp.rs b/tests/emtests/test_siglongjmp.rs deleted file mode 100644 index 02d8691b2..000000000 --- a/tests/emtests/test_siglongjmp.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_siglongjmp() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_siglongjmp.wasm", - "test_siglongjmp", - vec![], - "../emscripten_resources/emtests/test_siglongjmp.out" - ); -} diff --git a/tests/emtests/test_sintvars.rs b/tests/emtests/test_sintvars.rs deleted file mode 100644 index f244a99dc..000000000 --- a/tests/emtests/test_sintvars.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_sintvars() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_sintvars.wasm", - "test_sintvars", - vec![], - "../emscripten_resources/emtests/test_sintvars.out" - ); -} diff --git a/tests/emtests/test_sizeof.rs b/tests/emtests/test_sizeof.rs deleted file mode 100644 index 15d6c7c09..000000000 --- a/tests/emtests/test_sizeof.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_sizeof() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_sizeof.wasm", - "test_sizeof", - vec![], - "../emscripten_resources/emtests/test_sizeof.out" - ); -} diff --git a/tests/emtests/test_sscanf.rs b/tests/emtests/test_sscanf.rs deleted file mode 100644 index 94cca8504..000000000 --- a/tests/emtests/test_sscanf.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_sscanf() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_sscanf.wasm", - "test_sscanf", - vec![], - "../emscripten_resources/emtests/test_sscanf.out" - ); -} diff --git a/tests/emtests/test_sscanf_3.rs b/tests/emtests/test_sscanf_3.rs deleted file mode 100644 index 7351bd7fb..000000000 --- a/tests/emtests/test_sscanf_3.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_sscanf_3() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_sscanf_3.wasm", - "test_sscanf_3", - vec![], - "../emscripten_resources/emtests/test_sscanf_3.out" - ); -} diff --git a/tests/emtests/test_sscanf_4.rs b/tests/emtests/test_sscanf_4.rs deleted file mode 100644 index e11773e10..000000000 --- a/tests/emtests/test_sscanf_4.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_sscanf_4() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_sscanf_4.wasm", - "test_sscanf_4", - vec![], - "../emscripten_resources/emtests/test_sscanf_4.out" - ); -} diff --git a/tests/emtests/test_sscanf_5.rs b/tests/emtests/test_sscanf_5.rs deleted file mode 100644 index deda4ac80..000000000 --- a/tests/emtests/test_sscanf_5.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_sscanf_5() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_sscanf_5.wasm", - "test_sscanf_5", - vec![], - "../emscripten_resources/emtests/test_sscanf_5.out" - ); -} diff --git a/tests/emtests/test_sscanf_6.rs b/tests/emtests/test_sscanf_6.rs deleted file mode 100644 index 3ee05ed81..000000000 --- a/tests/emtests/test_sscanf_6.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_sscanf_6() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_sscanf_6.wasm", - "test_sscanf_6", - vec![], - "../emscripten_resources/emtests/test_sscanf_6.out" - ); -} diff --git a/tests/emtests/test_sscanf_caps.rs b/tests/emtests/test_sscanf_caps.rs deleted file mode 100644 index 3c52181e1..000000000 --- a/tests/emtests/test_sscanf_caps.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_sscanf_caps() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_sscanf_caps.wasm", - "test_sscanf_caps", - vec![], - "../emscripten_resources/emtests/test_sscanf_caps.out" - ); -} diff --git a/tests/emtests/test_sscanf_float.rs b/tests/emtests/test_sscanf_float.rs deleted file mode 100644 index ee0ce1706..000000000 --- a/tests/emtests/test_sscanf_float.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_sscanf_float() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_sscanf_float.wasm", - "test_sscanf_float", - vec![], - "../emscripten_resources/emtests/test_sscanf_float.out" - ); -} diff --git a/tests/emtests/test_sscanf_hex.rs b/tests/emtests/test_sscanf_hex.rs deleted file mode 100644 index 3381e8570..000000000 --- a/tests/emtests/test_sscanf_hex.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_sscanf_hex() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_sscanf_hex.wasm", - "test_sscanf_hex", - vec![], - "../emscripten_resources/emtests/test_sscanf_hex.out" - ); -} diff --git a/tests/emtests/test_sscanf_n.rs b/tests/emtests/test_sscanf_n.rs deleted file mode 100644 index b44e3fa1a..000000000 --- a/tests/emtests/test_sscanf_n.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_sscanf_n() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_sscanf_n.wasm", - "test_sscanf_n", - vec![], - "../emscripten_resources/emtests/test_sscanf_n.out" - ); -} diff --git a/tests/emtests/test_sscanf_other_whitespace.rs b/tests/emtests/test_sscanf_other_whitespace.rs deleted file mode 100644 index 0076a51f7..000000000 --- a/tests/emtests/test_sscanf_other_whitespace.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_sscanf_other_whitespace() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_sscanf_other_whitespace.wasm", - "test_sscanf_other_whitespace", - vec![], - "../emscripten_resources/emtests/test_sscanf_other_whitespace.out" - ); -} diff --git a/tests/emtests/test_sscanf_skip.rs b/tests/emtests/test_sscanf_skip.rs deleted file mode 100644 index 928aaebea..000000000 --- a/tests/emtests/test_sscanf_skip.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_sscanf_skip() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_sscanf_skip.wasm", - "test_sscanf_skip", - vec![], - "../emscripten_resources/emtests/test_sscanf_skip.out" - ); -} diff --git a/tests/emtests/test_sscanf_whitespace.rs b/tests/emtests/test_sscanf_whitespace.rs deleted file mode 100644 index 90257eee4..000000000 --- a/tests/emtests/test_sscanf_whitespace.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_sscanf_whitespace() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_sscanf_whitespace.wasm", - "test_sscanf_whitespace", - vec![], - "../emscripten_resources/emtests/test_sscanf_whitespace.out" - ); -} diff --git a/tests/emtests/test_stack_varargs.rs b/tests/emtests/test_stack_varargs.rs deleted file mode 100644 index 37344e56b..000000000 --- a/tests/emtests/test_stack_varargs.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_stack_varargs() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_stack_varargs.wasm", - "test_stack_varargs", - vec![], - "../emscripten_resources/emtests/test_stack_varargs.out" - ); -} diff --git a/tests/emtests/test_stack_void.rs b/tests/emtests/test_stack_void.rs deleted file mode 100644 index 99a9941b4..000000000 --- a/tests/emtests/test_stack_void.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_stack_void() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_stack_void.wasm", - "test_stack_void", - vec![], - "../emscripten_resources/emtests/test_stack_void.out" - ); -} diff --git a/tests/emtests/test_statvfs.rs b/tests/emtests/test_statvfs.rs deleted file mode 100644 index a60516039..000000000 --- a/tests/emtests/test_statvfs.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_statvfs() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_statvfs.wasm", - "test_statvfs", - vec![], - "../emscripten_resources/emtests/test_statvfs.out" - ); -} diff --git a/tests/emtests/test_std_cout_new.rs b/tests/emtests/test_std_cout_new.rs deleted file mode 100644 index 16f6dd997..000000000 --- a/tests/emtests/test_std_cout_new.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_std_cout_new() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_std_cout_new.wasm", - "test_std_cout_new", - vec![], - "../emscripten_resources/emtests/test_std_cout_new.out" - ); -} diff --git a/tests/emtests/test_strcasecmp.rs b/tests/emtests/test_strcasecmp.rs deleted file mode 100644 index b4bd4aa4a..000000000 --- a/tests/emtests/test_strcasecmp.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_strcasecmp() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_strcasecmp.wasm", - "test_strcasecmp", - vec![], - "../emscripten_resources/emtests/test_strcasecmp.out" - ); -} diff --git a/tests/emtests/test_strcmp_uni.rs b/tests/emtests/test_strcmp_uni.rs deleted file mode 100644 index 144344bb0..000000000 --- a/tests/emtests/test_strcmp_uni.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_strcmp_uni() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_strcmp_uni.wasm", - "test_strcmp_uni", - vec![], - "../emscripten_resources/emtests/test_strcmp_uni.out" - ); -} diff --git a/tests/emtests/test_strftime.rs b/tests/emtests/test_strftime.rs deleted file mode 100644 index 579505455..000000000 --- a/tests/emtests/test_strftime.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_strftime() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_strftime.wasm", - "test_strftime", - vec![], - "../emscripten_resources/emtests/test_strftime.out" - ); -} diff --git a/tests/emtests/test_strings.rs b/tests/emtests/test_strings.rs deleted file mode 100644 index 2b26e48d7..000000000 --- a/tests/emtests/test_strings.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_strings() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_strings.wasm", - "test_strings", - vec![], - "../emscripten_resources/emtests/test_strings.out" - ); -} diff --git a/tests/emtests/test_strndup.rs b/tests/emtests/test_strndup.rs deleted file mode 100644 index f05287fe2..000000000 --- a/tests/emtests/test_strndup.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_strndup() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_strndup.wasm", - "test_strndup", - vec![], - "../emscripten_resources/emtests/test_strndup.out" - ); -} diff --git a/tests/emtests/test_strptime_days.rs b/tests/emtests/test_strptime_days.rs deleted file mode 100644 index 20f835c50..000000000 --- a/tests/emtests/test_strptime_days.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_strptime_days() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_strptime_days.wasm", - "test_strptime_days", - vec![], - "../emscripten_resources/emtests/test_strptime_days.out" - ); -} diff --git a/tests/emtests/test_strptime_reentrant.rs b/tests/emtests/test_strptime_reentrant.rs deleted file mode 100644 index fcaf5e41b..000000000 --- a/tests/emtests/test_strptime_reentrant.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_strptime_reentrant() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_strptime_reentrant.wasm", - "test_strptime_reentrant", - vec![], - "../emscripten_resources/emtests/test_strptime_reentrant.out" - ); -} diff --git a/tests/emtests/test_strstr.rs b/tests/emtests/test_strstr.rs deleted file mode 100644 index 6f9f1198d..000000000 --- a/tests/emtests/test_strstr.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_strstr() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_strstr.wasm", - "test_strstr", - vec![], - "../emscripten_resources/emtests/test_strstr.out" - ); -} diff --git a/tests/emtests/test_strtod.rs b/tests/emtests/test_strtod.rs deleted file mode 100644 index 70901d0ca..000000000 --- a/tests/emtests/test_strtod.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_strtod() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_strtod.wasm", - "test_strtod", - vec![], - "../emscripten_resources/emtests/test_strtod.out" - ); -} diff --git a/tests/emtests/test_strtok.rs b/tests/emtests/test_strtok.rs deleted file mode 100644 index ea4b3ff68..000000000 --- a/tests/emtests/test_strtok.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_strtok() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_strtok.wasm", - "test_strtok", - vec![], - "../emscripten_resources/emtests/test_strtok.out" - ); -} diff --git a/tests/emtests/test_strtol_bin.rs b/tests/emtests/test_strtol_bin.rs deleted file mode 100644 index ec2f73f03..000000000 --- a/tests/emtests/test_strtol_bin.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_strtol_bin() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_strtol_bin.wasm", - "test_strtol_bin", - vec![], - "../emscripten_resources/emtests/test_strtol_bin.out" - ); -} diff --git a/tests/emtests/test_strtol_dec.rs b/tests/emtests/test_strtol_dec.rs deleted file mode 100644 index a1ef8941d..000000000 --- a/tests/emtests/test_strtol_dec.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_strtol_dec() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_strtol_dec.wasm", - "test_strtol_dec", - vec![], - "../emscripten_resources/emtests/test_strtol_dec.out" - ); -} diff --git a/tests/emtests/test_strtol_hex.rs b/tests/emtests/test_strtol_hex.rs deleted file mode 100644 index 5c7eb1d2f..000000000 --- a/tests/emtests/test_strtol_hex.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_strtol_hex() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_strtol_hex.wasm", - "test_strtol_hex", - vec![], - "../emscripten_resources/emtests/test_strtol_hex.out" - ); -} diff --git a/tests/emtests/test_strtol_oct.rs b/tests/emtests/test_strtol_oct.rs deleted file mode 100644 index 1893d178c..000000000 --- a/tests/emtests/test_strtol_oct.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_strtol_oct() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_strtol_oct.wasm", - "test_strtol_oct", - vec![], - "../emscripten_resources/emtests/test_strtol_oct.out" - ); -} diff --git a/tests/emtests/test_strtold.rs b/tests/emtests/test_strtold.rs deleted file mode 100644 index 1c2a8c391..000000000 --- a/tests/emtests/test_strtold.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_strtold() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_strtold.wasm", - "test_strtold", - vec![], - "../emscripten_resources/emtests/test_strtold.out" - ); -} diff --git a/tests/emtests/test_strtoll_bin.rs b/tests/emtests/test_strtoll_bin.rs deleted file mode 100644 index c7732d59d..000000000 --- a/tests/emtests/test_strtoll_bin.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_strtoll_bin() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_strtoll_bin.wasm", - "test_strtoll_bin", - vec![], - "../emscripten_resources/emtests/test_strtoll_bin.out" - ); -} diff --git a/tests/emtests/test_strtoll_dec.rs b/tests/emtests/test_strtoll_dec.rs deleted file mode 100644 index aaecfa8c7..000000000 --- a/tests/emtests/test_strtoll_dec.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_strtoll_dec() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_strtoll_dec.wasm", - "test_strtoll_dec", - vec![], - "../emscripten_resources/emtests/test_strtoll_dec.out" - ); -} diff --git a/tests/emtests/test_strtoll_hex.rs b/tests/emtests/test_strtoll_hex.rs deleted file mode 100644 index 3a1a2e173..000000000 --- a/tests/emtests/test_strtoll_hex.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_strtoll_hex() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_strtoll_hex.wasm", - "test_strtoll_hex", - vec![], - "../emscripten_resources/emtests/test_strtoll_hex.out" - ); -} diff --git a/tests/emtests/test_strtoll_oct.rs b/tests/emtests/test_strtoll_oct.rs deleted file mode 100644 index 92e3b2ed9..000000000 --- a/tests/emtests/test_strtoll_oct.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_strtoll_oct() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_strtoll_oct.wasm", - "test_strtoll_oct", - vec![], - "../emscripten_resources/emtests/test_strtoll_oct.out" - ); -} diff --git a/tests/emtests/test_struct_varargs.rs b/tests/emtests/test_struct_varargs.rs deleted file mode 100644 index d3249fd28..000000000 --- a/tests/emtests/test_struct_varargs.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_struct_varargs() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_struct_varargs.wasm", - "test_struct_varargs", - vec![], - "../emscripten_resources/emtests/test_struct_varargs.out" - ); -} diff --git a/tests/emtests/test_time_c.rs b/tests/emtests/test_time_c.rs deleted file mode 100644 index 2e30b49d2..000000000 --- a/tests/emtests/test_time_c.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_time_c() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_time_c.wasm", - "test_time_c", - vec![], - "../emscripten_resources/emtests/test_time_c.out" - ); -} diff --git a/tests/emtests/test_tracing.rs b/tests/emtests/test_tracing.rs deleted file mode 100644 index 6b59bb353..000000000 --- a/tests/emtests/test_tracing.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_tracing() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_tracing.wasm", - "test_tracing", - vec![], - "../emscripten_resources/emtests/test_tracing.out" - ); -} diff --git a/tests/emtests/test_transtrcase.rs b/tests/emtests/test_transtrcase.rs deleted file mode 100644 index 82b9737c5..000000000 --- a/tests/emtests/test_transtrcase.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_transtrcase() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_transtrcase.wasm", - "test_transtrcase", - vec![], - "../emscripten_resources/emtests/test_transtrcase.out" - ); -} diff --git a/tests/emtests/test_trickystring.rs b/tests/emtests/test_trickystring.rs deleted file mode 100644 index 5e3ffad05..000000000 --- a/tests/emtests/test_trickystring.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_trickystring() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_trickystring.wasm", - "test_trickystring", - vec![], - "../emscripten_resources/emtests/test_trickystring.out" - ); -} diff --git a/tests/emtests/test_uname.rs b/tests/emtests/test_uname.rs deleted file mode 100644 index 4a603992d..000000000 --- a/tests/emtests/test_uname.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_uname() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_uname.wasm", - "test_uname", - vec![], - "../emscripten_resources/emtests/test_uname.out" - ); -} diff --git a/tests/emtests/test_unary_literal.rs b/tests/emtests/test_unary_literal.rs deleted file mode 100644 index 9a21049d0..000000000 --- a/tests/emtests/test_unary_literal.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_unary_literal() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_unary_literal.wasm", - "test_unary_literal", - vec![], - "../emscripten_resources/emtests/test_unary_literal.out" - ); -} diff --git a/tests/emtests/test_utf.rs b/tests/emtests/test_utf.rs deleted file mode 100644 index b53e9b96e..000000000 --- a/tests/emtests/test_utf.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_utf() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_utf.wasm", - "test_utf", - vec![], - "../emscripten_resources/emtests/test_utf.out" - ); -} diff --git a/tests/emtests/test_varargs.rs b/tests/emtests/test_varargs.rs deleted file mode 100644 index 4c6145ca7..000000000 --- a/tests/emtests/test_varargs.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_varargs() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_varargs.wasm", - "test_varargs", - vec![], - "../emscripten_resources/emtests/test_varargs.out" - ); -} diff --git a/tests/emtests/test_varargs_multi.rs b/tests/emtests/test_varargs_multi.rs deleted file mode 100644 index 3ebcad109..000000000 --- a/tests/emtests/test_varargs_multi.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_varargs_multi() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_varargs_multi.wasm", - "test_varargs_multi", - vec![], - "../emscripten_resources/emtests/test_varargs_multi.out" - ); -} diff --git a/tests/emtests/test_vfs.rs b/tests/emtests/test_vfs.rs deleted file mode 100644 index d63e32084..000000000 --- a/tests/emtests/test_vfs.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_vfs() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_vfs.wasm", - "test_vfs", - vec![], - "../emscripten_resources/emtests/test_vfs.out" - ); -} diff --git a/tests/emtests/test_vprintf.rs b/tests/emtests/test_vprintf.rs deleted file mode 100644 index e7af22e8b..000000000 --- a/tests/emtests/test_vprintf.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_vprintf() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_vprintf.wasm", - "test_vprintf", - vec![], - "../emscripten_resources/emtests/test_vprintf.out" - ); -} diff --git a/tests/emtests/test_vsnprintf.rs b/tests/emtests/test_vsnprintf.rs deleted file mode 100644 index caab9d660..000000000 --- a/tests/emtests/test_vsnprintf.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_vsnprintf() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_vsnprintf.wasm", - "test_vsnprintf", - vec![], - "../emscripten_resources/emtests/test_vsnprintf.out" - ); -} diff --git a/tests/emtests/test_wprintf.rs b/tests/emtests/test_wprintf.rs deleted file mode 100644 index bcc8f45db..000000000 --- a/tests/emtests/test_wprintf.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_wprintf() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_wprintf.wasm", - "test_wprintf", - vec![], - "../emscripten_resources/emtests/test_wprintf.out" - ); -} diff --git a/tests/emtests/test_write_stdout_fileno.rs b/tests/emtests/test_write_stdout_fileno.rs deleted file mode 100644 index cc41e53cc..000000000 --- a/tests/emtests/test_write_stdout_fileno.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_write_stdout_fileno() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_write_stdout_fileno.wasm", - "test_write_stdout_fileno", - vec![], - "../emscripten_resources/emtests/test_write_stdout_fileno.out" - ); -} diff --git a/tests/emtests/test_zero_multiplication.rs b/tests/emtests/test_zero_multiplication.rs deleted file mode 100644 index 23b77dd49..000000000 --- a/tests/emtests/test_zero_multiplication.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_zero_multiplication() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_zero_multiplication.wasm", - "test_zero_multiplication", - vec![], - "../emscripten_resources/emtests/test_zero_multiplication.out" - ); -} diff --git a/tests/emtests/test_zerodiv.rs b/tests/emtests/test_zerodiv.rs deleted file mode 100644 index f267e3618..000000000 --- a/tests/emtests/test_zerodiv.rs +++ /dev/null @@ -1,10 +0,0 @@ -#[test] -#[ignore] -fn test_test_zerodiv() { - assert_emscripten_output!( - "../emscripten_resources/emtests/test_zerodiv.wasm", - "test_zerodiv", - vec![], - "../emscripten_resources/emtests/test_zerodiv.out" - ); -} diff --git a/tests/exception_handling.rs b/tests/exception_handling.rs deleted file mode 100644 index d545b5cfb..000000000 --- a/tests/exception_handling.rs +++ /dev/null @@ -1,26 +0,0 @@ -mod runtime_core_tests; - -pub mod runtime_core_exception_handling { - use super::runtime_core_tests::{get_compiler, wat2wasm}; - use wasmer::compiler::compile_with; - use wasmer::imports; - - #[test] - fn exception_handling_works() { - const MODULE: &str = r#" -(module - (func (export "throw_trap") - unreachable - )) -"#; - - let wasm_binary = wat2wasm(MODULE.as_bytes()).expect("WAST not valid or malformed"); - let module = compile_with(&wasm_binary, &get_compiler()).unwrap(); - - let imports = imports! {}; - for _ in 0..2 { - let instance = module.instantiate(&imports).unwrap(); - assert!(instance.call("throw_trap", &[]).is_err()); - } - } -} diff --git a/tests/generate-emscripten-tests/src/emtests.rs b/tests/generate-emscripten-tests/src/emtests.rs index 824040861..478df8471 100644 --- a/tests/generate-emscripten-tests/src/emtests.rs +++ b/tests/generate-emscripten-tests/src/emtests.rs @@ -2,47 +2,48 @@ //! It will compile the files indicated in TESTS, to:executable and .wasm //! - Compile using cc and get the output from it (expected output) //! - Compile using emcc and get the .wasm from it (wasm) -//! - Generate the test that will compare the output of running the .wasm file -//! with wasmer with the expected output use glob::glob; -use std::collections::HashSet; use std::fs; use std::path::Path; use std::path::PathBuf; use std::process::Command; use std::fs::File; -use std::io::prelude::*; -use std::io::BufReader; - -static BANNER: &str = - "// Rust test file autogenerated with cargo build (generate-emscripten-tests). -// Please do NOT modify it by hand, as it will be reset on next build.\n"; const EXTENSIONS: [&str; 2] = ["c", "cpp"]; const EXCLUDES: [&str; 0] = []; -pub fn compile(file: &str, ignores: &HashSet) -> Option { +pub fn compile(file: &str) { let mut output_path = PathBuf::from(file); output_path.set_extension("out"); - // let output_str = output_path.to_str().unwrap(); + let output_str = output_path.to_str().unwrap(); + + println!("Compiling Emscripten file natively: {}", file); // Compile to .out - // Command::new("cc") - // .arg(file) - // .arg("-o") - // .arg(output_str) - // .output() - // .expect("failed to execute process"); + Command::new("cc") + .arg(file) + .arg("-o") + .arg(output_str) + .output() + .expect("failed to execute cc command"); // Get the result of .out - // let output = Command::new(output_str) - // .arg(output_str) - // .output() - // .expect("failed to execute process"); + let exec_output = Command::new(output_str).arg(output_str).output(); - // Remove executable - // fs::remove_file(output_str).unwrap(); + // Is fine if _output fails, as the original file might have + // `EM_ASM` javascript definitions inside. In that case, + // the program can't be run natively without JS, and we just + // want to skip any further execution. + if exec_output.is_err() { + println!(" -> Can't execute the file natively. Skipping emcc"); + return; + } else { + exec_output.unwrap(); + } + + // Remove executable, we don't care if it's successful or not + drop(fs::remove_file(output_str)); let mut output_path = PathBuf::from(file); output_path.set_extension("js"); @@ -60,6 +61,8 @@ pub fn compile(file: &str, ignores: &HashSet) -> Option { || file_metadata.modified().unwrap() >= wasm_file_metadata.unwrap().modified().unwrap() { // Compile to wasm + println!("Compiling Emscripten file: {}", file); + let _wasm_compilation = Command::new("emcc") .arg(file) .arg("-s") @@ -67,104 +70,23 @@ pub fn compile(file: &str, ignores: &HashSet) -> Option { .arg("-o") .arg(output_str) .output() - .expect("failed to execute process"); + .expect("failed to execute emcc process. Is `emcc` available in your system?"); // panic!("{:?}", wasm_compilation); // if output.stderr { // panic!("{}", output.stderr); // } - // Remove js file + // 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); - output_path.set_extension("output"); - let module_name = output_path - .file_stem() - .unwrap() - .to_str() - .unwrap() - .to_owned(); - - // - // let output_str = output_path.to_str().unwrap(); - - // Write the output to file - // fs::write(output_str, output.stdout).expect("Unable to write file"); - - let rs_module_name = module_name.to_lowercase(); - let rust_test_filepath = format!( - concat!(env!("CARGO_MANIFEST_DIR"), "/../emtests/{}.rs"), - rs_module_name.as_str() - ); - - let output_extension = if file.ends_with("c") || module_name.starts_with("test_") { - "out" - } else { - "txt" - }; - - let ignored = if ignores.contains(&module_name.to_lowercase()) { - "\n#[ignore]" - } else { - "" - }; - - let module_path = format!("../emscripten_resources/emtests/{}.wasm", module_name); - let test_output_path = format!( - "../emscripten_resources/emtests/{}.{}", - module_name, output_extension - ); - if !Path::new(&format!("{}/{}", env!("CARGO_MANIFEST_DIR"), &module_path)).is_file() { - println!("Path not found to test module: {}", module_path); - None - } else if !Path::new(&format!( - "{}/{}", - env!("CARGO_MANIFEST_DIR"), - &test_output_path - )) - .is_file() - { - println!("Path not found to test output: {}", test_output_path); - None - } else { - let contents = format!( - "#[test]{ignore} -fn test_{rs_module_name}() {{ - assert_emscripten_output!( - \"{module_path}\", - \"{rs_module_name}\", - vec![], - \"{test_output_path}\" - ); -}} -", - ignore = ignored, - module_path = module_path, - rs_module_name = rs_module_name, - test_output_path = test_output_path - ); - - fs::write(&rust_test_filepath, contents.as_bytes()).unwrap(); - - Some(rs_module_name) - } - // panic!("OUTPUT: {:?}", output); } pub fn build() { - let rust_test_modpath = concat!(env!("CARGO_MANIFEST_DIR"), "/../emtests/mod.rs"); - - let mut modules: Vec = Vec::new(); - // modules.reserve_exact(TESTS.len()); - - let ignores = read_ignore_list(); - for ext in EXTENSIONS.iter() { for entry in glob(&format!( concat!( @@ -179,41 +101,11 @@ pub fn build() { Ok(path) => { let test = path.to_str().unwrap(); if !EXCLUDES.iter().any(|e| test.ends_with(e)) { - if let Some(module_name) = compile(test, &ignores) { - modules.push(module_name); - } + compile(test); } } Err(e) => println!("{:?}", e), } } } - modules.sort(); - let mut modules: Vec = modules.iter().map(|m| format!("mod {};", m)).collect(); - assert!(modules.len() > 0, "Expected > 0 modules found"); - - modules.insert(0, BANNER.to_string()); - modules.insert(1, "// The _common module is not autogenerated, as it provides common macros for the emtests\n#[macro_use]\nmod _common;".to_string()); - // We add an empty line - modules.push("".to_string()); - - let modfile: String = modules.join("\n"); - let source = fs::read(&rust_test_modpath).unwrap(); - // We only modify the mod file if has changed - if source != modfile.as_bytes() { - fs::write(&rust_test_modpath, modfile.as_bytes()).unwrap(); - } -} - -const IGNORE_LIST_PATH: &str = concat!( - env!("CARGO_MANIFEST_DIR"), - "/../emscripten_resources/emtests/ignores.txt" -); -fn read_ignore_list() -> HashSet { - let f = File::open(IGNORE_LIST_PATH).unwrap(); - let f = BufReader::new(f); - f.lines() - .filter_map(Result::ok) - .map(|v| v.to_lowercase()) - .collect() } diff --git a/tests/generate-emscripten-tests/src/lib.rs b/tests/generate-emscripten-tests/src/lib.rs index 6bb96b9df..9c2be33ab 100644 --- a/tests/generate-emscripten-tests/src/lib.rs +++ b/tests/generate-emscripten-tests/src/lib.rs @@ -1,12 +1,3 @@ -use std::env; - mod emtests; -static EMTESTS_ENV_VAR: &str = "WASM_EMSCRIPTEN_GENERATE_EMTESTS"; - -pub fn build() { - println!("cargo:rerun-if-env-changed={}", EMTESTS_ENV_VAR); - if env::var(EMTESTS_ENV_VAR).unwrap_or("0".to_string()) == "1" { - emtests::build(); - } -} +pub use emtests::build; diff --git a/tests/generate-wasi-tests/Cargo.toml b/tests/generate-wasi-tests/Cargo.toml index 33ce01254..283e4c095 100644 --- a/tests/generate-wasi-tests/Cargo.toml +++ b/tests/generate-wasi-tests/Cargo.toml @@ -9,4 +9,6 @@ publish = false [dependencies] glob = "0.3" -tempfile = "3" \ No newline at end of file +tempfile = "3" +serde = "1.0.106" +serde_json = "1.0" diff --git a/tests/generate-wasi-tests/src/lib.rs b/tests/generate-wasi-tests/src/lib.rs index 3ee64ada5..4e5720fc2 100644 --- a/tests/generate-wasi-tests/src/lib.rs +++ b/tests/generate-wasi-tests/src/lib.rs @@ -1,25 +1,8 @@ -use std::env; +mod set_up_toolchain; +mod util; +mod wasi_version; +mod wasitests; -pub mod set_up_toolchain; -pub mod util; -pub mod wasi_version; -pub mod wasitests; - -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"; - -pub fn build() { - //println!("cargo:rerun-if-changed=tests/wasi_test_resources/*.rs"); - 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); - let do_all_wasi_tests = util::should_operate_on_all_wasi_tests(); - if env::var(WASITESTS_SET_UP_TOOLCHAIN).unwrap_or("0".to_string()) == "1" { - set_up_toolchain::set_it_up(do_all_wasi_tests); - } - - if env::var(WASITESTS_ENV_VAR).unwrap_or("0".to_string()) == "1" { - wasitests::build(do_all_wasi_tests); - } -} +pub use crate::set_up_toolchain::install_toolchains; +pub use crate::wasi_version::{WasiVersion, ALL_WASI_VERSIONS, LATEST_WASI_VERSION}; +pub use crate::wasitests::{build, WasiOptions, WasiTest}; diff --git a/tests/generate-wasi-tests/src/set_up_toolchain.rs b/tests/generate-wasi-tests/src/set_up_toolchain.rs index 80cf88447..53d6aedfd 100644 --- a/tests/generate-wasi-tests/src/set_up_toolchain.rs +++ b/tests/generate-wasi-tests/src/set_up_toolchain.rs @@ -12,19 +12,22 @@ fn install_toolchain(toolchain_name: &str) { .output() .expect("Failed to install toolchain with rustup"); util::print_info_on_error(&rustup_out, "TOOLCHAIN INSTALL FAILED"); + + println!("Installing rustup WASI target"); + let rustup_out = Command::new("rustup") + .arg(format!("+{}", toolchain_name)) + .arg("target") + .arg("add") + .arg("wasm32-wasi") + .output() + .expect("Failed to wasi target in Rust toolchain"); + util::print_info_on_error(&rustup_out, "WASI TARGET IN TOOLCHAIN INSTAL FAILED"); } -pub fn set_it_up(only_latest: bool) { +pub fn install_toolchains(wasi_versions: &[WasiVersion]) { println!("Setting up system to generate the WASI tests."); println!("WARNING: this may use a lot of disk space."); - let wasi_versions = if only_latest { - println!("Only installing the toolchain for the latest WASI version"); - LATEST_WASI_VERSION - } else { - println!("Installing the toolchain for all WASI versions"); - ALL_WASI_VERSIONS - }; for wasi_version in wasi_versions { install_toolchain(wasi_version.get_compiler_toolchain()); } diff --git a/tests/generate-wasi-tests/src/util.rs b/tests/generate-wasi-tests/src/util.rs index b2d9ad14b..7ce1e1c53 100644 --- a/tests/generate-wasi-tests/src/util.rs +++ b/tests/generate-wasi-tests/src/util.rs @@ -11,12 +11,3 @@ pub fn print_info_on_error(output: &std::process::Output, context: &str) { ); } } - -/// Whether or not we should operate on all WASI tests or not -pub fn should_operate_on_all_wasi_tests() -> bool { - std::env::var("WASI_TEST_GENERATE_ALL") - .ok() - .and_then(|s| s.parse::().ok()) - .unwrap_or(0) - == 1 -} diff --git a/tests/generate-wasi-tests/src/wasitests.rs b/tests/generate-wasi-tests/src/wasitests.rs index 10caae9e0..9ffd9b450 100644 --- a/tests/generate-wasi-tests/src/wasitests.rs +++ b/tests/generate-wasi-tests/src/wasitests.rs @@ -6,27 +6,27 @@ //! with wasmer with the expected output use glob::glob; -use std::collections::HashSet; use std::fs; use std::path::{Path, PathBuf}; use std::process::Command; -use std::fs::File; +use std::io; use std::io::prelude::*; -use std::io::{self, BufReader}; use super::util; use super::wasi_version::*; - -static BANNER: &str = "// !!! THIS IS A GENERATED FILE !!! -// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME -// Files autogenerated with cargo build.\n"; +use serde::{Deserialize, Serialize}; /// Compile and execute the test file as native code, saving the results to be /// compared against later. /// /// This function attempts to clean up its output after it executes it. -fn generate_native_output(temp_dir: &Path, file: &str, normalized_name: &str) -> io::Result<()> { +fn generate_native_output( + temp_dir: &Path, + file: &str, + normalized_name: &str, + args: &[String], +) -> io::Result { let executable_path = temp_dir.join(normalized_name); println!( "Compiling program {} to native at {}", @@ -36,6 +36,7 @@ fn generate_native_output(temp_dir: &Path, file: &str, normalized_name: &str) -> let native_out = Command::new("rustc") .arg(file) .arg("-o") + .args(args) .arg(&executable_path) .output() .expect("Failed to compile program to native code"); @@ -68,12 +69,12 @@ fn generate_native_output(temp_dir: &Path, file: &str, normalized_name: &str) -> .expect("Failed to execute native program"); util::print_info_on_error(&result, "NATIVE PROGRAM FAILED"); - let mut output_path = PathBuf::from(file); - output_path.set_extension("out"); + // let mut output_path = PathBuf::from(file); + // output_path.set_extension("out"); - println!("Writing output to {}", output_path.to_string_lossy()); - fs::write(&output_path, result.stdout)?; - Ok(()) + // println!("Writing output to {}", output_path.to_string_lossy()); + // fs::write(&output_path, result.stdout)?; + Ok(String::from_utf8(result.stdout).unwrap()) } /// compile the Wasm file for the given version of WASI @@ -120,16 +121,19 @@ fn compile_wasm_for_version( &wasm_out_name.to_string_lossy(), version.get_compiler_toolchain() ); - let wasm_compilation_out = Command::new("rustc") + let mut command = Command::new("rustc"); + + command .arg(format!("+{}", version.get_compiler_toolchain())) .arg("--target=wasm32-wasi") .arg("-C") .arg("opt-level=z") .arg(&temp_wasi_rs_file_name) .arg("-o") - .arg(&wasm_out_name) - .output() - .expect("Failed to compile program to wasm"); + .arg(&wasm_out_name); + println!("Command {:?}", command); + + let wasm_compilation_out = command.output().expect("Failed to compile program to wasm"); util::print_info_on_error(&wasm_compilation_out, "WASM COMPILATION"); println!( "Removing file `{}`", @@ -154,101 +158,11 @@ fn compile_wasm_for_version( Ok(wasm_out_name) } -fn generate_test_file( - file: &str, - rs_module_name: &str, - wasm_out_name: &str, - version: WasiVersion, - ignores: &HashSet, -) -> io::Result { - let test_name = format!("{}_{}", version.get_directory_name(), rs_module_name); - let ignored = if ignores.contains(&test_name) || ignores.contains(rs_module_name) { - "\n#[ignore]" - } else { - "" - }; - - let src_code = fs::read_to_string(file)?; - let args: Args = extract_args_from_source_file(&src_code).unwrap_or_default(); - - let mapdir_args = { - let mut out_str = String::new(); - out_str.push_str("vec!["); - for (alias, real_dir) in args.mapdir { - out_str.push_str(&format!( - "(\"{}\".to_string(), ::std::path::PathBuf::from(\"{}\")),", - alias, real_dir - )); - } - out_str.push_str("]"); - out_str - }; - - let envvar_args = { - let mut out_str = String::new(); - out_str.push_str("vec!["); - - for entry in args.envvars { - out_str.push_str(&format!("\"{}={}\".to_string(),", entry.0, entry.1)); - } - - out_str.push_str("]"); - out_str - }; - - let dir_args = { - let mut out_str = String::new(); - out_str.push_str("vec!["); - - for entry in args.po_dirs { - out_str.push_str(&format!("std::path::PathBuf::from(\"{}\"),", entry)); - } - - out_str.push_str("]"); - out_str - }; - - let contents = format!( - "{banner} - -#[test]{ignore} -fn test_{test_name}() {{ - assert_wasi_output!( - \"{module_path}\", - \"{test_name}\", - {dir_args}, - {mapdir_args}, - {envvar_args}, - \"{test_output_path}\" - ); -}} -", - banner = BANNER, - ignore = ignored, - module_path = format!("../wasi_test_resources/{}.wasm", wasm_out_name), - test_name = &test_name, - test_output_path = format!("../wasi_test_resources/{}.out", rs_module_name), - dir_args = dir_args, - mapdir_args = mapdir_args, - envvar_args = envvar_args - ); - let rust_test_filepath = format!( - concat!(env!("CARGO_MANIFEST_DIR"), "/../wasitests/{}.rs"), - &test_name, - ); - fs::write(&rust_test_filepath, contents.as_bytes())?; - - Ok(test_name) -} - /// Returns the a Vec of the test modules created -fn compile( - temp_dir: &Path, - file: &str, - ignores: &HashSet, - wasi_versions: &[WasiVersion], -) -> Vec { - // TODO: hook up compile_wasm_for_version, etc with new args +fn compile(temp_dir: &Path, file: &str, wasi_versions: &[WasiVersion]) { + let src_code: String = fs::read_to_string(file).unwrap(); + let options: WasiOptions = extract_args_from_source_file(&src_code).unwrap_or_default(); + assert!(file.ends_with(".rs")); let rs_mod_name = { Path::new(&file.to_lowercase()) @@ -258,117 +172,81 @@ fn compile( .to_string() }; let base_dir = Path::new(file).parent().unwrap(); - generate_native_output(temp_dir, &file, &rs_mod_name).expect("Generate native output"); + let output = generate_native_output(temp_dir, &file, &rs_mod_name, &options.args) + .expect("Generate native output"); + + let test = WasiTest { output, options }; + let test_serialized = serde_json::to_string_pretty(&test).unwrap(); wasi_versions .into_iter() .map(|&version| { + let out_dir = base_dir.join(version.get_directory_name()); + if !out_dir.exists() { + fs::create_dir(&out_dir).unwrap(); + } + let wasm_out_name = { + let mut wasm_out_name = out_dir.join(rs_mod_name.clone()); + wasm_out_name.set_extension("out"); + wasm_out_name + }; + println!("Writing test output to {}", wasm_out_name.to_string_lossy()); + fs::write(&wasm_out_name, test_serialized.clone()).unwrap(); + + println!("Compiling wasm version {:?}", version); compile_wasm_for_version(temp_dir, file, base_dir, &rs_mod_name, version) .expect(&format!("Could not compile Wasm to WASI version {:?}, perhaps you need to install the `{}` rust toolchain", version, version.get_compiler_toolchain())); - let wasm_out_relative_path = { - let base_path = PathBuf::from(version.get_directory_name()); - base_path.join(&rs_mod_name) - }; - let wasm_out_name = wasm_out_relative_path.to_string_lossy(); - - generate_test_file(file, &rs_mod_name, &wasm_out_name, version, ignores) - .expect(&format!("generate test file {}", &rs_mod_name)) - }).collect::>() -} - -fn run_prelude(should_gen_all: bool) -> &'static [WasiVersion] { - if should_gen_all { - println!( - "Generating WASI tests for all versions of WASI. Run with WASI_TEST_GENERATE_ALL=0 to only generate the latest tests." - ); - } else { - println!( - "Generating WASI tests for the latest version of WASI. Run with WASI_TEST_GENERATE_ALL=1 to generate all versions of the tests." - ); - } - - if should_gen_all { - ALL_WASI_VERSIONS - } else { - LATEST_WASI_VERSION - } + }).for_each(drop); // Do nothing with it, but let the iterator be consumed/iterated. } const WASI_TEST_SRC_DIR: &str = concat!(env!("CARGO_MANIFEST_DIR"), "/../wasi_test_resources/*.rs"); -pub fn build(should_gen_all: bool) { - let rust_test_modpath = concat!(env!("CARGO_MANIFEST_DIR"), "/../wasitests/mod.rs"); - - let mut modules: Vec = Vec::new(); - let wasi_versions = run_prelude(should_gen_all); - +pub fn build(wasi_versions: &[WasiVersion]) { let temp_dir = tempfile::TempDir::new().unwrap(); - let ignores = read_ignore_list(); for entry in glob(WASI_TEST_SRC_DIR).unwrap() { match entry { Ok(path) => { let test = path.to_str().unwrap(); - modules.extend(compile(temp_dir.path(), test, &ignores, wasi_versions)); + compile(temp_dir.path(), test, wasi_versions); } Err(e) => println!("{:?}", e), } } - println!("All modules generated. Generating test harness."); - modules.sort(); - let mut modules: Vec = modules.iter().map(|m| format!("mod {};", m)).collect(); - assert!(modules.len() > 0, "Expected > 0 modules found"); + println!("All modules generated."); +} - modules.insert(0, BANNER.to_string()); - modules.insert(1, "// The _common module is not autogenerated. It provides common macros for the wasitests\n#[macro_use]\nmod _common;".to_string()); - // We add an empty line - modules.push("".to_string()); +/// This is the structure of the `.out` file +#[derive(Debug, Default, Serialize, Deserialize)] +pub struct WasiTest { + /// The program expected output + pub output: String, + /// The program options + pub options: WasiOptions, +} - let modfile: String = modules.join("\n"); - let should_regen: bool = { - if let Ok(mut f) = fs::File::open(&rust_test_modpath) { - let mut s = String::new(); - f.read_to_string(&mut s).unwrap(); - s != modfile - } else { - false - } - }; - if should_regen { - println!("Writing to `{}`", &rust_test_modpath); - let mut test_harness_file = fs::OpenOptions::new() - .write(true) - .create(true) - .truncate(true) - .open(&rust_test_modpath) - .unwrap(); - test_harness_file.write_all(modfile.as_bytes()).unwrap(); +/// The options provied when executed a WASI Wasm program +#[derive(Debug, Default, Serialize, Deserialize)] +pub struct WasiOptions { + /// Mapped pre-opened dirs + pub mapdir: Vec<(String, String)>, + /// Environment vars + pub env: Vec<(String, String)>, + /// Program arguments + pub args: Vec, + /// Pre-opened directories + pub dir: Vec, +} + +impl WasiOptions { + /// Constructs WasiOptions given a json string + pub fn from_str(buffer: &str) -> Result { + serde_json::from_str(buffer).map_err(|e| format!("Can't get options from bufer")) } } -const IGNORE_LIST_PATH: &str = concat!( - env!("CARGO_MANIFEST_DIR"), - "/../wasi_test_resources/ignores.txt" -); -fn read_ignore_list() -> HashSet { - let f = File::open(IGNORE_LIST_PATH).unwrap(); - let f = BufReader::new(f); - f.lines() - .filter_map(Result::ok) - .map(|v| v.to_lowercase()) - .collect() -} - -#[derive(Debug, Default)] -struct Args { - pub mapdir: Vec<(String, String)>, - pub envvars: Vec<(String, String)>, - /// pre-opened directories - pub po_dirs: Vec, -} - -/// Pulls args to the program out of a comment at the top of the file starting with "// Args:" -fn extract_args_from_source_file(source_code: &str) -> Option { - if source_code.starts_with("// Args:") { - let mut args = Args::default(); +/// Pulls args to the program out of a comment at the top of the file starting with "// WasiOptions:" +fn extract_args_from_source_file(source_code: &str) -> Option { + if source_code.starts_with("// WASI:") { + let mut args = WasiOptions::default(); for arg_line in source_code .lines() .skip(1) @@ -403,16 +281,19 @@ fn extract_args_from_source_file(source_code: &str) -> Option { } "env" => { if let [name, val] = &tokenized[1].split('=').collect::>()[..] { - args.envvars.push((name.to_string(), val.to_string())); + args.env.push((name.to_string(), val.to_string())); } else { eprintln!("Parse error in env {} not parsed correctly", &tokenized[1]); } } "dir" => { - args.po_dirs.push(tokenized[1].to_string()); + args.dir.push(tokenized[1].to_string()); + } + "arg" => { + args.args.push(tokenized[1].to_string()); } e => { - eprintln!("WARN: comment arg: {} is not supported", e); + eprintln!("WARN: comment arg: `{}` is not supported", e); } } } diff --git a/tests/ignores.txt b/tests/ignores.txt index 7a4bd7ba5..88e3f5741 100644 --- a/tests/ignores.txt +++ b/tests/ignores.txt @@ -81,6 +81,7 @@ llvm::spec::simd_binaryen on unix # Temporary llvm::spec::simd llvm::spec::simd_binaryen +llvm::spec::imports # Singlepass singlepass::spec::simd # SIMD not implemented @@ -100,3 +101,129 @@ singlepass::spec::traps on aarch64 # NaN canonicalization is not yet implemented for aarch64. singlepass::spec::wasmer on aarch64 + + +# Emscripten + +emscripten::test_ccall +emscripten::test_demangle_stacks +emscripten::emscripten_get_compiler_setting +emscripten::fs_exports +emscripten::getvalue_setvalue +emscripten::legacy_exported_runtime_numbers +emscripten::modularize_closure_pre +emscripten::stackalloc +emscripten::test_demangle_stacks_noassert +emscripten::test_dlmalloc_partial_2 +emscripten::test_em_asm +emscripten::test_em_asm_2 +emscripten::test_em_asm_parameter_pack +emscripten::test_em_asm_signatures +emscripten::test_em_asm_unicode +emscripten::test_em_asm_unused_arguments +emscripten::test_em_js +emscripten::test_emscripten_api +emscripten::test_exceptions_2 +emscripten::test_exceptions_convert +emscripten::test_exceptions_destroy_virtual +emscripten::test_exceptions_multi +emscripten::test_exceptions_std +emscripten::test_exceptions_white_list +emscripten::test_fast_math +emscripten::test_float_builtins +emscripten::test_getopt +emscripten::test_getopt_long +emscripten::test_getloadavg +emscripten::test_i16_emcc_intrinsic +emscripten::test_i64 +emscripten::test_i64_7z +emscripten::test_i64_varargs +emscripten::test_indirectbr_many +emscripten::test_llvm_intrinsics +emscripten::test_longjmp_exc +emscripten::test_lower_intrinsics +emscripten::test_main_thread_async_em_asm +emscripten::test_mainenv +emscripten::test_mathfuncptr +emscripten::test_memcpy_memcmp +emscripten::test_mmap +emscripten::test_perrar +emscripten::test_poll +emscripten::test_posixtime +emscripten::test_siglongjmp +emscripten::test_sscanf_hex +emscripten::test_sscanf_whitespace +emscripten::test_sscanf_other_whitespace +emscripten::test_sscanf_skip +emscripten::test_stack_varargs +emscripten::test_stack_void +emscripten::test_statvfs +emscripten::test_strings +emscripten::test_strptime_days +emscripten::test_strtold +emscripten::test_tracing +emscripten::test_uname +emscripten::test_utf +emscripten::test_varargs_multi +emscripten::test_varargs +emscripten::test_zero_multiplication +emscripten::test_strftime +emscripten::test_wprintf +emscripten::test_std_cout_new +emscripten::test_strptime_reentrant +emscripten::test_gmtime +emscripten::test_time_c +emscripten::test_execvp +emscripten::test_nl_types +emscripten::test_phiundef +emscripten::test_pipe +emscripten::test_printf_2 +emscripten::test_printf_more +emscripten::test_regex +emscripten::test_relocatable_void_function +emscripten::test_rounding +emscripten::test_set_align +emscripten::test_sintvars +emscripten::test_sizeof +emscripten::test_sscanf +emscripten::test_sscanf_3 +emscripten::test_sscanf_4 +emscripten::test_sscanf_5 +emscripten::test_sscanf_6 +emscripten::test_sscanf_caps +emscripten::test_sscanf_float +emscripten::test_sscanf_n +emscripten::test_strcasecmp +emscripten::test_strcmp_uni +emscripten::test_strndup +emscripten::test_strstr +emscripten::test_strtod +emscripten::test_strtok +emscripten::test_strtol_bin +emscripten::test_strtol_dec +emscripten::test_strtol_hex +emscripten::test_strtol_oct +emscripten::test_strtoll_bin +emscripten::test_strtoll_dec +emscripten::test_strtoll_hex +emscripten::test_strtoll_oct +emscripten::test_struct_varargs +emscripten::test_transtrcase +emscripten::test_trickystring +emscripten::test_unary_literal +emscripten::test_vfs +emscripten::test_vprintf +emscripten::test_vsnprintf +emscripten::test_write_stdout_fileno +emscripten::test_zerodiv + + +# WASI + +wasi::snapshot1::fd_read +wasi::snapshot1::poll_oneoff +wasi::snapshot1::fd_pread +wasi::snapshot1::fd_close +wasi::snapshot1::fd_allocate +wasi::snapshot1::close_preopen_fd +wasi::snapshot1::envvar diff --git a/tests/imports.rs b/tests/imports.rs index dbf99f6ac..fdde910fe 100644 --- a/tests/imports.rs +++ b/tests/imports.rs @@ -1,47 +1,42 @@ -mod runtime_core_tests; +use std::{convert::TryInto, sync::Arc}; +use wabt::wat2wasm; +use wasmer::compiler::{compile_with, compiler_for_backend, Backend}; +use wasmer::error::RuntimeError; +use wasmer::units::Pages; +use wasmer::wasm::{ + DynFunc, Func, FuncSig, Global, Instance, Memory, MemoryDescriptor, Type, Value, +}; +use wasmer::{imports, vm, DynamicFunc}; -#[cfg(test)] -pub mod runtime_core_imports { +fn runtime_core_new_api_works(backend: Backend) { + let wasm = r#" + (module + (type $type (func (param i32) (result i32))) + (global (export "my_global") i32 (i32.const 45)) + (func (export "add_one") (type $type) + (i32.add (get_local 0) + (i32.const 1))) + (func (export "double") (type $type) + (i32.mul (get_local 0) + (i32.const 2))) + )"#; + let wasm_binary = wat2wasm(wasm.as_bytes()).expect("WAST not valid or malformed"); + let compiler = compiler_for_backend(backend).expect("Backend not recognized"); + let module = compile_with(&wasm_binary, &*compiler).unwrap(); + let import_object = imports! {}; + let instance = module.instantiate(&import_object).unwrap(); - use super::runtime_core_tests::{get_compiler, wat2wasm}; - use std::{convert::TryInto, sync::Arc}; - use wasmer::compiler::compile_with; - use wasmer::error::RuntimeError; - use wasmer::units::Pages; - use wasmer::wasm::{ - DynFunc, Func, FuncSig, Global, Instance, Memory, MemoryDescriptor, Type, Value, - }; - use wasmer::{imports, vm, DynamicFunc}; + let my_global: Global = instance.exports.get("my_global").unwrap(); + assert_eq!(my_global.get(), Value::I32(45)); + let double: Func = instance.exports.get("double").unwrap(); + assert_eq!(double.call(5).unwrap(), 10); + let add_one: DynFunc = instance.exports.get("add_one").unwrap(); + assert_eq!(add_one.call(&[Value::I32(5)]).unwrap(), &[Value::I32(6)]); + let add_one_memory: Result = instance.exports.get("my_global"); + assert!(add_one_memory.is_err()); +} - #[test] - fn runtime_core_new_api_works() { - let wasm = r#" -(module - (type $type (func (param i32) (result i32))) - (global (export "my_global") i32 (i32.const 45)) - (func (export "add_one") (type $type) - (i32.add (get_local 0) - (i32.const 1))) - (func (export "double") (type $type) - (i32.mul (get_local 0) - (i32.const 2))) -)"#; - let wasm_binary = wat2wasm(wasm.as_bytes()).expect("WAST not valid or malformed"); - let module = compile_with(&wasm_binary, &get_compiler()).unwrap(); - let import_object = imports! {}; - let instance = module.instantiate(&import_object).unwrap(); - - let my_global: Global = instance.exports.get("my_global").unwrap(); - assert_eq!(my_global.get(), Value::I32(45)); - let double: Func = instance.exports.get("double").unwrap(); - assert_eq!(double.call(5).unwrap(), 10); - let add_one: DynFunc = instance.exports.get("add_one").unwrap(); - assert_eq!(add_one.call(&[Value::I32(5)]).unwrap(), &[Value::I32(6)]); - let add_one_memory: Result = instance.exports.get("my_global"); - assert!(add_one_memory.is_err()); - } - - macro_rules! call_and_assert { +macro_rules! call_and_assert { ($instance:ident, $function:ident( $( $inputs:ty ),* ) -> $output:ty, ( $( $arguments:expr ),* ) == $expected_value:expr) => { #[allow(unused_parens)] let $function: Func<( $( $inputs ),* ), $output> = $instance.exports.get(stringify!($function)).expect(concat!("Failed to get the `", stringify!($function), "` export function.")); @@ -86,389 +81,427 @@ pub mod runtime_core_imports { ), } }; + } + +/// The shift that is set in the instance memory. The value is part of +/// the result returned by the imported functions if the memory is +/// read properly. +const SHIFT: i32 = 10; + +/// The shift that is captured in the environment of a closure. The +/// value is part of the result returned by the imported function if +/// the closure captures its environment properly. +#[allow(non_upper_case_globals)] +const shift: i32 = 100; + +#[cfg(all(unix, target_arch = "x86_64"))] +fn imported_functions_forms(backend: Backend, test: &dyn Fn(&Instance)) { + const MODULE: &str = r#" + (module + (type $type (func (param i32) (result i32))) + (import "env" "memory" (memory 1 1)) + (import "env" "callback_fn" (func $callback_fn (type $type))) + (import "env" "callback_closure" (func $callback_closure (type $type))) + (import "env" "callback_fn_dynamic" (func $callback_fn_dynamic (type $type))) + (import "env" "callback_fn_dynamic_panic" (func $callback_fn_dynamic_panic (type $type))) + (import "env" "callback_closure_dynamic_0" (func $callback_closure_dynamic_0)) + (import "env" "callback_closure_dynamic_1" (func $callback_closure_dynamic_1 (param i32) (result i32))) + (import "env" "callback_closure_dynamic_2" (func $callback_closure_dynamic_2 (param i32 i64) (result i64))) + (import "env" "callback_closure_dynamic_3" (func $callback_closure_dynamic_3 (param i32 i64 f32) (result f32))) + (import "env" "callback_closure_dynamic_4" (func $callback_closure_dynamic_4 (param i32 i64 f32 f64) (result f64))) + (import "env" "callback_closure_with_env" (func $callback_closure_with_env (type $type))) + (import "env" "callback_fn_with_vmctx" (func $callback_fn_with_vmctx (type $type))) + (import "env" "callback_closure_with_vmctx" (func $callback_closure_with_vmctx (type $type))) + (import "env" "callback_closure_with_vmctx_and_env" (func $callback_closure_with_vmctx_and_env (type $type))) + (import "env" "callback_fn_trap" (func $callback_fn_trap (type $type))) + (import "env" "callback_closure_trap" (func $callback_closure_trap (type $type))) + (import "env" "callback_fn_trap_with_vmctx" (func $callback_fn_trap_with_vmctx (type $type))) + (import "env" "callback_closure_trap_with_vmctx" (func $callback_closure_trap_with_vmctx (type $type))) + (import "env" "callback_closure_trap_with_vmctx_and_env" (func $callback_closure_trap_with_vmctx_and_env (type $type))) + + (func (export "function_fn") (type $type) + get_local 0 + call $callback_fn) + + (func (export "function_closure") (type $type) + get_local 0 + call $callback_closure) + + (func (export "function_fn_dynamic") (type $type) + get_local 0 + call $callback_fn_dynamic) + + (func (export "function_fn_dynamic_panic") (type $type) + get_local 0 + call $callback_fn_dynamic_panic) + + (func (export "function_closure_dynamic_0") + call $callback_closure_dynamic_0) + + (func (export "function_closure_dynamic_1") (param i32) (result i32) + get_local 0 + call $callback_closure_dynamic_1) + + (func (export "function_closure_dynamic_2") (param i32 i64) (result i64) + get_local 0 + get_local 1 + call $callback_closure_dynamic_2) + + (func (export "function_closure_dynamic_3") (param i32 i64 f32) (result f32) + get_local 0 + get_local 1 + get_local 2 + call $callback_closure_dynamic_3) + + (func (export "function_closure_dynamic_4") (param i32 i64 f32 f64) (result f64) + get_local 0 + get_local 1 + get_local 2 + get_local 3 + call $callback_closure_dynamic_4) + + (func (export "function_closure_with_env") (type $type) + get_local 0 + call $callback_closure_with_env) + + (func (export "function_fn_with_vmctx") (type $type) + get_local 0 + call $callback_fn_with_vmctx) + + (func (export "function_closure_with_vmctx") (type $type) + get_local 0 + call $callback_closure_with_vmctx) + + (func (export "function_closure_with_vmctx_and_env") (type $type) + get_local 0 + call $callback_closure_with_vmctx_and_env) + + (func (export "function_fn_trap") (type $type) + get_local 0 + call $callback_fn_trap) + + (func (export "function_closure_trap") (type $type) + get_local 0 + call $callback_closure_trap) + + (func (export "function_fn_trap_with_vmctx") (type $type) + get_local 0 + call $callback_fn_trap_with_vmctx) + + (func (export "function_closure_trap_with_vmctx") (type $type) + get_local 0 + call $callback_closure_trap_with_vmctx) + + (func (export "function_closure_trap_with_vmctx_and_env") (type $type) + get_local 0 + call $callback_closure_trap_with_vmctx_and_env)) + "#; + + let wasm_binary = wat2wasm(MODULE.as_bytes()).expect("WAST not valid or malformed"); + let compiler = compiler_for_backend(backend).expect("Backend not recognized"); + let module = compile_with(&wasm_binary, &*compiler).unwrap(); + let memory_descriptor = MemoryDescriptor::new(Pages(1), Some(Pages(1)), false).unwrap(); + let memory = Memory::new(memory_descriptor).unwrap(); + + memory.view()[0].set(SHIFT); + + let import_object = imports! { + "env" => { + "memory" => memory.clone(), + + // Regular function. + "callback_fn" => Func::new(callback_fn), + + // Closure without a captured environment. + "callback_closure" => Func::new(|n: i32| -> Result { + Ok(n + 1) + }), + + // Regular polymorphic function. + "callback_fn_dynamic" => DynamicFunc::new( + Arc::new(FuncSig::new(vec![Type::I32], vec![Type::I32])), + callback_fn_dynamic, + ), + + // Polymorphic function that panics. + "callback_fn_dynamic_panic" => DynamicFunc::new( + Arc::new(FuncSig::new(vec![Type::I32], vec![Type::I32])), + callback_fn_dynamic_panic, + ), + + // Polymorphic closure “closures”. + "callback_closure_dynamic_0" => DynamicFunc::new( + Arc::new(FuncSig::new(vec![], vec![])), + |_, inputs: &[Value]| -> Vec { + assert!(inputs.is_empty()); + + vec![] + } + ), + "callback_closure_dynamic_1" => DynamicFunc::new( + Arc::new(FuncSig::new(vec![Type::I32], vec![Type::I32])), + move |vmctx: &mut vm::Ctx, inputs: &[Value]| -> Vec { + assert_eq!(inputs.len(), 1); + + let memory = vmctx.memory(0); + let shift_ = shift + memory.view::()[0].get(); + let n: i32 = (&inputs[0]).try_into().unwrap(); + + vec![Value::I32(shift_ + n)] + } + ), + "callback_closure_dynamic_2" => DynamicFunc::new( + Arc::new(FuncSig::new(vec![Type::I32, Type::I64], vec![Type::I64])), + move |vmctx: &mut vm::Ctx, inputs: &[Value]| -> Vec { + assert_eq!(inputs.len(), 2); + + let memory = vmctx.memory(0); + let shift_ = shift + memory.view::()[0].get(); + let i: i32 = (&inputs[0]).try_into().unwrap(); + let j: i64 = (&inputs[1]).try_into().unwrap(); + + vec![Value::I64(shift_ as i64 + i as i64 + j)] + } + ), + "callback_closure_dynamic_3" => DynamicFunc::new( + Arc::new(FuncSig::new(vec![Type::I32, Type::I64, Type::F32], vec![Type::F32])), + move |vmctx: &mut vm::Ctx, inputs: &[Value]| -> Vec { + assert_eq!(inputs.len(), 3); + + let memory = vmctx.memory(0); + let shift_ = shift + memory.view::()[0].get(); + let i: i32 = (&inputs[0]).try_into().unwrap(); + let j: i64 = (&inputs[1]).try_into().unwrap(); + let k: f32 = (&inputs[2]).try_into().unwrap(); + + vec![Value::F32(shift_ as f32 + i as f32 + j as f32 + k)] + } + ), + "callback_closure_dynamic_4" => DynamicFunc::new( + Arc::new(FuncSig::new(vec![Type::I32, Type::I64, Type::F32, Type::F64], vec![Type::F64])), + move |vmctx: &mut vm::Ctx, inputs: &[Value]| -> Vec { + assert_eq!(inputs.len(), 4); + + let memory = vmctx.memory(0); + let shift_ = shift + memory.view::()[0].get(); + let i: i32 = (&inputs[0]).try_into().unwrap(); + let j: i64 = (&inputs[1]).try_into().unwrap(); + let k: f32 = (&inputs[2]).try_into().unwrap(); + let l: f64 = (&inputs[3]).try_into().unwrap(); + + vec![Value::F64(shift_ as f64 + i as f64 + j as f64 + k as f64 + l)] + } + ), + + // Closure with a captured environment (a single variable + an instance of `Memory`). + "callback_closure_with_env" => Func::new(move |n: i32| -> Result { + let shift_ = shift + memory.view::()[0].get(); + + Ok(shift_ + n + 1) + }), + + // Regular function with an explicit `vmctx`. + "callback_fn_with_vmctx" => Func::new(callback_fn_with_vmctx), + + // Closure without a captured environment but with an explicit `vmctx`. + "callback_closure_with_vmctx" => Func::new(|vmctx: &mut vm::Ctx, n: i32| -> Result { + let memory = vmctx.memory(0); + let shift_: i32 = memory.view()[0].get(); + + Ok(shift_ + n + 1) + }), + + // Closure with a captured environment (a single variable) and with an explicit `vmctx`. + "callback_closure_with_vmctx_and_env" => Func::new(move |vmctx: &mut vm::Ctx, n: i32| -> Result { + let memory = vmctx.memory(0); + let shift_ = shift + memory.view::()[0].get(); + + Ok(shift_ + n + 1) + }), + + // Trap a regular function. + "callback_fn_trap" => Func::new(callback_fn_trap), + + // Trap a closure without a captured environment. + "callback_closure_trap" => Func::new(|n: i32| -> Result { + Err(format!("bar {}", n + 1)) + }), + + // Trap a regular function with an explicit `vmctx`. + "callback_fn_trap_with_vmctx" => Func::new(callback_fn_trap_with_vmctx), + + // Trap a closure without a captured environment but with an explicit `vmctx`. + "callback_closure_trap_with_vmctx" => Func::new(|vmctx: &mut vm::Ctx, n: i32| -> Result { + let memory = vmctx.memory(0); + let shift_: i32 = memory.view()[0].get(); + + Err(format!("qux {}", shift_ + n + 1)) + }), + + // Trap a closure with a captured environment (a single variable) and with an explicit `vmctx`. + "callback_closure_trap_with_vmctx_and_env" => Func::new(move |vmctx: &mut vm::Ctx, n: i32| -> Result { + let memory = vmctx.memory(0); + let shift_ = shift + memory.view::()[0].get(); + + Err(format!("! {}", shift_ + n + 1)) + }), + }, + }; + let instance = module.instantiate(&import_object).unwrap(); + + test(&instance); } - /// The shift that is set in the instance memory. The value is part of - /// the result returned by the imported functions if the memory is - /// read properly. - const SHIFT: i32 = 10; +fn callback_fn(n: i32) -> Result { + Ok(n + 1) +} - /// The shift that is captured in the environment of a closure. The - /// value is part of the result returned by the imported function if - /// the closure captures its environment properly. - #[allow(non_upper_case_globals)] - const shift: i32 = 100; - - #[cfg(all(unix, target_arch = "x86_64"))] - fn imported_functions_forms(test: &dyn Fn(&Instance)) { - const MODULE: &str = r#" -(module - (type $type (func (param i32) (result i32))) - (import "env" "memory" (memory 1 1)) - (import "env" "callback_fn" (func $callback_fn (type $type))) - (import "env" "callback_closure" (func $callback_closure (type $type))) - (import "env" "callback_fn_dynamic" (func $callback_fn_dynamic (type $type))) - (import "env" "callback_fn_dynamic_panic" (func $callback_fn_dynamic_panic (type $type))) - (import "env" "callback_closure_dynamic_0" (func $callback_closure_dynamic_0)) - (import "env" "callback_closure_dynamic_1" (func $callback_closure_dynamic_1 (param i32) (result i32))) - (import "env" "callback_closure_dynamic_2" (func $callback_closure_dynamic_2 (param i32 i64) (result i64))) - (import "env" "callback_closure_dynamic_3" (func $callback_closure_dynamic_3 (param i32 i64 f32) (result f32))) - (import "env" "callback_closure_dynamic_4" (func $callback_closure_dynamic_4 (param i32 i64 f32 f64) (result f64))) - (import "env" "callback_closure_with_env" (func $callback_closure_with_env (type $type))) - (import "env" "callback_fn_with_vmctx" (func $callback_fn_with_vmctx (type $type))) - (import "env" "callback_closure_with_vmctx" (func $callback_closure_with_vmctx (type $type))) - (import "env" "callback_closure_with_vmctx_and_env" (func $callback_closure_with_vmctx_and_env (type $type))) - (import "env" "callback_fn_trap" (func $callback_fn_trap (type $type))) - (import "env" "callback_closure_trap" (func $callback_closure_trap (type $type))) - (import "env" "callback_fn_trap_with_vmctx" (func $callback_fn_trap_with_vmctx (type $type))) - (import "env" "callback_closure_trap_with_vmctx" (func $callback_closure_trap_with_vmctx (type $type))) - (import "env" "callback_closure_trap_with_vmctx_and_env" (func $callback_closure_trap_with_vmctx_and_env (type $type))) - - (func (export "function_fn") (type $type) - get_local 0 - call $callback_fn) - - (func (export "function_closure") (type $type) - get_local 0 - call $callback_closure) - - (func (export "function_fn_dynamic") (type $type) - get_local 0 - call $callback_fn_dynamic) - - (func (export "function_fn_dynamic_panic") (type $type) - get_local 0 - call $callback_fn_dynamic_panic) - - (func (export "function_closure_dynamic_0") - call $callback_closure_dynamic_0) - - (func (export "function_closure_dynamic_1") (param i32) (result i32) - get_local 0 - call $callback_closure_dynamic_1) - - (func (export "function_closure_dynamic_2") (param i32 i64) (result i64) - get_local 0 - get_local 1 - call $callback_closure_dynamic_2) - - (func (export "function_closure_dynamic_3") (param i32 i64 f32) (result f32) - get_local 0 - get_local 1 - get_local 2 - call $callback_closure_dynamic_3) - - (func (export "function_closure_dynamic_4") (param i32 i64 f32 f64) (result f64) - get_local 0 - get_local 1 - get_local 2 - get_local 3 - call $callback_closure_dynamic_4) - - (func (export "function_closure_with_env") (type $type) - get_local 0 - call $callback_closure_with_env) - - (func (export "function_fn_with_vmctx") (type $type) - get_local 0 - call $callback_fn_with_vmctx) - - (func (export "function_closure_with_vmctx") (type $type) - get_local 0 - call $callback_closure_with_vmctx) - - (func (export "function_closure_with_vmctx_and_env") (type $type) - get_local 0 - call $callback_closure_with_vmctx_and_env) - - (func (export "function_fn_trap") (type $type) - get_local 0 - call $callback_fn_trap) - - (func (export "function_closure_trap") (type $type) - get_local 0 - call $callback_closure_trap) - - (func (export "function_fn_trap_with_vmctx") (type $type) - get_local 0 - call $callback_fn_trap_with_vmctx) - - (func (export "function_closure_trap_with_vmctx") (type $type) - get_local 0 - call $callback_closure_trap_with_vmctx) - - (func (export "function_closure_trap_with_vmctx_and_env") (type $type) - get_local 0 - call $callback_closure_trap_with_vmctx_and_env)) -"#; - - let wasm_binary = wat2wasm(MODULE.as_bytes()).expect("WAST not valid or malformed"); - let module = compile_with(&wasm_binary, &get_compiler()).unwrap(); - let memory_descriptor = MemoryDescriptor::new(Pages(1), Some(Pages(1)), false).unwrap(); - let memory = Memory::new(memory_descriptor).unwrap(); - - memory.view()[0].set(SHIFT); - - let import_object = imports! { - "env" => { - "memory" => memory.clone(), - - // Regular function. - "callback_fn" => Func::new(callback_fn), - - // Closure without a captured environment. - "callback_closure" => Func::new(|n: i32| -> Result { - Ok(n + 1) - }), - - // Regular polymorphic function. - "callback_fn_dynamic" => DynamicFunc::new( - Arc::new(FuncSig::new(vec![Type::I32], vec![Type::I32])), - callback_fn_dynamic, - ), - - // Polymorphic function that panics. - "callback_fn_dynamic_panic" => DynamicFunc::new( - Arc::new(FuncSig::new(vec![Type::I32], vec![Type::I32])), - callback_fn_dynamic_panic, - ), - - // Polymorphic closure “closures”. - "callback_closure_dynamic_0" => DynamicFunc::new( - Arc::new(FuncSig::new(vec![], vec![])), - |_, inputs: &[Value]| -> Vec { - assert!(inputs.is_empty()); - - vec![] - } - ), - "callback_closure_dynamic_1" => DynamicFunc::new( - Arc::new(FuncSig::new(vec![Type::I32], vec![Type::I32])), - move |vmctx: &mut vm::Ctx, inputs: &[Value]| -> Vec { - assert_eq!(inputs.len(), 1); - - let memory = vmctx.memory(0); - let shift_ = shift + memory.view::()[0].get(); - let n: i32 = (&inputs[0]).try_into().unwrap(); - - vec![Value::I32(shift_ + n)] - } - ), - "callback_closure_dynamic_2" => DynamicFunc::new( - Arc::new(FuncSig::new(vec![Type::I32, Type::I64], vec![Type::I64])), - move |vmctx: &mut vm::Ctx, inputs: &[Value]| -> Vec { - assert_eq!(inputs.len(), 2); - - let memory = vmctx.memory(0); - let shift_ = shift + memory.view::()[0].get(); - let i: i32 = (&inputs[0]).try_into().unwrap(); - let j: i64 = (&inputs[1]).try_into().unwrap(); - - vec![Value::I64(shift_ as i64 + i as i64 + j)] - } - ), - "callback_closure_dynamic_3" => DynamicFunc::new( - Arc::new(FuncSig::new(vec![Type::I32, Type::I64, Type::F32], vec![Type::F32])), - move |vmctx: &mut vm::Ctx, inputs: &[Value]| -> Vec { - assert_eq!(inputs.len(), 3); - - let memory = vmctx.memory(0); - let shift_ = shift + memory.view::()[0].get(); - let i: i32 = (&inputs[0]).try_into().unwrap(); - let j: i64 = (&inputs[1]).try_into().unwrap(); - let k: f32 = (&inputs[2]).try_into().unwrap(); - - vec![Value::F32(shift_ as f32 + i as f32 + j as f32 + k)] - } - ), - "callback_closure_dynamic_4" => DynamicFunc::new( - Arc::new(FuncSig::new(vec![Type::I32, Type::I64, Type::F32, Type::F64], vec![Type::F64])), - move |vmctx: &mut vm::Ctx, inputs: &[Value]| -> Vec { - assert_eq!(inputs.len(), 4); - - let memory = vmctx.memory(0); - let shift_ = shift + memory.view::()[0].get(); - let i: i32 = (&inputs[0]).try_into().unwrap(); - let j: i64 = (&inputs[1]).try_into().unwrap(); - let k: f32 = (&inputs[2]).try_into().unwrap(); - let l: f64 = (&inputs[3]).try_into().unwrap(); - - vec![Value::F64(shift_ as f64 + i as f64 + j as f64 + k as f64 + l)] - } - ), - - // Closure with a captured environment (a single variable + an instance of `Memory`). - "callback_closure_with_env" => Func::new(move |n: i32| -> Result { - let shift_ = shift + memory.view::()[0].get(); - - Ok(shift_ + n + 1) - }), - - // Regular function with an explicit `vmctx`. - "callback_fn_with_vmctx" => Func::new(callback_fn_with_vmctx), - - // Closure without a captured environment but with an explicit `vmctx`. - "callback_closure_with_vmctx" => Func::new(|vmctx: &mut vm::Ctx, n: i32| -> Result { - let memory = vmctx.memory(0); - let shift_: i32 = memory.view()[0].get(); - - Ok(shift_ + n + 1) - }), - - // Closure with a captured environment (a single variable) and with an explicit `vmctx`. - "callback_closure_with_vmctx_and_env" => Func::new(move |vmctx: &mut vm::Ctx, n: i32| -> Result { - let memory = vmctx.memory(0); - let shift_ = shift + memory.view::()[0].get(); - - Ok(shift_ + n + 1) - }), - - // Trap a regular function. - "callback_fn_trap" => Func::new(callback_fn_trap), - - // Trap a closure without a captured environment. - "callback_closure_trap" => Func::new(|n: i32| -> Result { - Err(format!("bar {}", n + 1)) - }), - - // Trap a regular function with an explicit `vmctx`. - "callback_fn_trap_with_vmctx" => Func::new(callback_fn_trap_with_vmctx), - - // Trap a closure without a captured environment but with an explicit `vmctx`. - "callback_closure_trap_with_vmctx" => Func::new(|vmctx: &mut vm::Ctx, n: i32| -> Result { - let memory = vmctx.memory(0); - let shift_: i32 = memory.view()[0].get(); - - Err(format!("qux {}", shift_ + n + 1)) - }), - - // Trap a closure with a captured environment (a single variable) and with an explicit `vmctx`. - "callback_closure_trap_with_vmctx_and_env" => Func::new(move |vmctx: &mut vm::Ctx, n: i32| -> Result { - let memory = vmctx.memory(0); - let shift_ = shift + memory.view::()[0].get(); - - Err(format!("! {}", shift_ + n + 1)) - }), - }, - }; - let instance = module.instantiate(&import_object).unwrap(); - - test(&instance); +fn callback_fn_dynamic(_: &mut vm::Ctx, inputs: &[Value]) -> Vec { + match inputs[0] { + Value::I32(x) => vec![Value::I32(x + 1)], + _ => unreachable!(), } +} - fn callback_fn(n: i32) -> Result { - Ok(n + 1) - } +fn callback_fn_dynamic_panic(_: &mut vm::Ctx, _: &[Value]) -> Vec { + panic!("test"); +} - fn callback_fn_dynamic(_: &mut vm::Ctx, inputs: &[Value]) -> Vec { - match inputs[0] { - Value::I32(x) => vec![Value::I32(x + 1)], - _ => unreachable!(), - } - } +fn callback_fn_with_vmctx(vmctx: &mut vm::Ctx, n: i32) -> Result { + let memory = vmctx.memory(0); + let shift_: i32 = memory.view()[0].get(); - fn callback_fn_dynamic_panic(_: &mut vm::Ctx, _: &[Value]) -> Vec { - panic!("test"); - } + Ok(shift_ + n + 1) +} - fn callback_fn_with_vmctx(vmctx: &mut vm::Ctx, n: i32) -> Result { - let memory = vmctx.memory(0); - let shift_: i32 = memory.view()[0].get(); +fn callback_fn_trap(n: i32) -> Result { + Err(format!("foo {}", n + 1)) +} - Ok(shift_ + n + 1) - } +fn callback_fn_trap_with_vmctx(vmctx: &mut vm::Ctx, n: i32) -> Result { + let memory = vmctx.memory(0); + let shift_: i32 = memory.view()[0].get(); - fn callback_fn_trap(n: i32) -> Result { - Err(format!("foo {}", n + 1)) - } + Err(format!("baz {}", shift_ + n + 1)) +} - fn callback_fn_trap_with_vmctx(vmctx: &mut vm::Ctx, n: i32) -> Result { - let memory = vmctx.memory(0); - let shift_: i32 = memory.view()[0].get(); - - Err(format!("baz {}", shift_ + n + 1)) - } - - macro_rules! test { - ($test_name:ident, $function:ident( $( $inputs:ty ),* ) -> $output:ty, ( $( $arguments:expr ),* ) == $expected_value:expr) => { +macro_rules! test { + ($backend:expr, $test_name:ident, $function:ident( $( $inputs:ty ),* ) -> $output:ty, ( $( $arguments:expr ),* ) == $expected_value:expr) => { #[cfg(all(unix, target_arch = "x86_64"))] #[test] fn $test_name() { - imported_functions_forms(&|instance| { + imported_functions_forms($backend, &|instance| { call_and_assert!(instance, $function( $( $inputs ),* ) -> $output, ( $( $arguments ),* ) == $expected_value); }); } }; + } + +macro_rules! tests_for_backend { + ($backend:expr) => { + test!($backend, test_fn, function_fn(i32) -> i32, (1) == Ok(2)); + test!($backend, test_closure, function_closure(i32) -> i32, (1) == Ok(2)); + test!($backend, test_fn_dynamic, function_fn_dynamic(i32) -> i32, (1) == Ok(2)); + test!($backend, test_fn_dynamic_panic, function_fn_dynamic_panic(i32) -> i32, (1) == Err(RuntimeError(Box::new("test")))); + test!( + $backend, + test_closure_dynamic_0, + function_closure_dynamic_0(()) -> (), + () == Ok(()) + ); + test!( + $backend, + test_closure_dynamic_1, + function_closure_dynamic_1(i32) -> i32, + (1) == Ok(1 + shift + SHIFT) + ); + test!( + $backend, + test_closure_dynamic_2, + function_closure_dynamic_2(i32, i64) -> i64, + (1, 2) == Ok(1 + 2 + shift as i64 + SHIFT as i64) + ); + test!( + $backend, + test_closure_dynamic_3, + function_closure_dynamic_3(i32, i64, f32) -> f32, + (1, 2, 3.) == Ok(1. + 2. + 3. + shift as f32 + SHIFT as f32) + ); + test!( + $backend, + test_closure_dynamic_4, + function_closure_dynamic_4(i32, i64, f32, f64) -> f64, + (1, 2, 3., 4.) == Ok(1. + 2. + 3. + 4. + shift as f64 + SHIFT as f64) + ); + test!( + $backend, + test_closure_with_env, + function_closure_with_env(i32) -> i32, + (1) == Ok(2 + shift + SHIFT) + ); + test!($backend, test_fn_with_vmctx, function_fn_with_vmctx(i32) -> i32, (1) == Ok(2 + SHIFT)); + test!( + $backend, + test_closure_with_vmctx, + function_closure_with_vmctx(i32) -> i32, + (1) == Ok(2 + SHIFT) + ); + test!( + $backend, + test_closure_with_vmctx_and_env, + function_closure_with_vmctx_and_env(i32) -> i32, + (1) == Ok(2 + shift + SHIFT) + ); + test!( + $backend, + test_fn_trap, + function_fn_trap(i32) -> i32, + (1) == Err(RuntimeError(Box::new(format!("foo {}", 2)))) + ); + test!( + $backend, + test_closure_trap, + function_closure_trap(i32) -> i32, + (1) == Err(RuntimeError(Box::new(format!("bar {}", 2)))) + ); + test!( + $backend, + test_fn_trap_with_vmctx, + function_fn_trap_with_vmctx(i32) -> i32, + (1) == Err(RuntimeError(Box::new(format!("baz {}", 2 + SHIFT)))) + ); + test!( + $backend, + test_closure_trap_with_vmctx, + function_closure_trap_with_vmctx(i32) -> i32, + (1) == Err(RuntimeError(Box::new(format!("qux {}", 2 + SHIFT)))) + ); + test!( + $backend, + test_closure_trap_with_vmctx_and_env, + function_closure_trap_with_vmctx_and_env(i32) -> i32, + (1) == Err(RuntimeError(Box::new(format!("! {}", 2 + shift + SHIFT)))) + ); + } + } + +#[cfg(feature = "backend-singlepass")] +#[cfg(test)] +mod singlepass { + use super::*; + tests_for_backend!(Backend::Singlepass); } - test!(test_fn, function_fn(i32) -> i32, (1) == Ok(2)); - test!(test_closure, function_closure(i32) -> i32, (1) == Ok(2)); - test!(test_fn_dynamic, function_fn_dynamic(i32) -> i32, (1) == Ok(2)); - test!(test_fn_dynamic_panic, function_fn_dynamic_panic(i32) -> i32, (1) == Err(RuntimeError(Box::new("test")))); - test!( - test_closure_dynamic_0, - function_closure_dynamic_0(()) -> (), - () == Ok(()) -); - test!( - test_closure_dynamic_1, - function_closure_dynamic_1(i32) -> i32, - (1) == Ok(1 + shift + SHIFT) -); - test!( - test_closure_dynamic_2, - function_closure_dynamic_2(i32, i64) -> i64, - (1, 2) == Ok(1 + 2 + shift as i64 + SHIFT as i64) -); - test!( - test_closure_dynamic_3, - function_closure_dynamic_3(i32, i64, f32) -> f32, - (1, 2, 3.) == Ok(1. + 2. + 3. + shift as f32 + SHIFT as f32) -); - test!( - test_closure_dynamic_4, - function_closure_dynamic_4(i32, i64, f32, f64) -> f64, - (1, 2, 3., 4.) == Ok(1. + 2. + 3. + 4. + shift as f64 + SHIFT as f64) -); - test!( - test_closure_with_env, - function_closure_with_env(i32) -> i32, - (1) == Ok(2 + shift + SHIFT) -); - test!(test_fn_with_vmctx, function_fn_with_vmctx(i32) -> i32, (1) == Ok(2 + SHIFT)); - test!( - test_closure_with_vmctx, - function_closure_with_vmctx(i32) -> i32, - (1) == Ok(2 + SHIFT) -); - test!( - test_closure_with_vmctx_and_env, - function_closure_with_vmctx_and_env(i32) -> i32, - (1) == Ok(2 + shift + SHIFT) -); - test!( - test_fn_trap, - function_fn_trap(i32) -> i32, - (1) == Err(RuntimeError(Box::new(format!("foo {}", 2)))) -); - test!( - test_closure_trap, - function_closure_trap(i32) -> i32, - (1) == Err(RuntimeError(Box::new(format!("bar {}", 2)))) -); - test!( - test_fn_trap_with_vmctx, - function_fn_trap_with_vmctx(i32) -> i32, - (1) == Err(RuntimeError(Box::new(format!("baz {}", 2 + SHIFT)))) -); - test!( - test_closure_trap_with_vmctx, - function_closure_trap_with_vmctx(i32) -> i32, - (1) == Err(RuntimeError(Box::new(format!("qux {}", 2 + SHIFT)))) -); - test!( - test_closure_trap_with_vmctx_and_env, - function_closure_trap_with_vmctx_and_env(i32) -> i32, - (1) == Err(RuntimeError(Box::new(format!("! {}", 2 + shift + SHIFT)))) -); +#[cfg(feature = "backend-cranelift")] +#[cfg(test)] +mod cranelift { + use super::*; + tests_for_backend!(Backend::Cranelift); +} + +#[cfg(feature = "backend-llvm")] +#[cfg(test)] +mod llvm { + use super::*; + tests_for_backend!(Backend::LLVM); } diff --git a/tests/middleware_common.rs b/tests/middleware_common.rs index db0ee18f8..25b8d08dc 100644 --- a/tests/middleware_common.rs +++ b/tests/middleware_common.rs @@ -1,178 +1,199 @@ -#[cfg(all(test, any(feature = "backend-singlepass", feature = "backend-llvm")))] -mod tests { - use wabt::wat2wasm; +// use test_case::test_case; +// use wabt::wat2wasm; +// use wasmer::compiler::{compile_with, Compiler}; +// use wasmer::imports; +// use wasmer::wasm::Func; +// use wasmer_middleware_common::metering::*; +// use wasmer_runtime_core::codegen::ModuleCodeGenerator; +// use wasmer_runtime_core::codegen::{MiddlewareChain, StreamingCompiler}; +// use wasmer_runtime_core::fault::{pop_code_version, push_code_version}; +// use wasmer_runtime_core::state::CodeVersion; - use wasmer::compiler::{compile_with, Compiler}; - use wasmer::imports; - use wasmer::wasm::Func; - use wasmer_middleware_common::metering::*; - use wasmer_runtime_core::codegen::ModuleCodeGenerator; - use wasmer_runtime_core::codegen::{MiddlewareChain, StreamingCompiler}; - use wasmer_runtime_core::fault::{pop_code_version, push_code_version}; - use wasmer_runtime_core::state::CodeVersion; +// fn get_compiler(name: &str, limit: u64) -> impl Compiler { +// match name { +// #[cfg(feature = "backend-singlepass")] +// "singlepass" => { +// use wasmer_singlepass_backend::ModuleCodeGenerator as SinglepassMCG; +// StreamingCompiler = StreamingCompiler::new(move || { +// let mut chain = MiddlewareChain::new(); +// chain.push(Metering::new(limit)); +// chain +// }) +// }, +// #[cfg(feature = "backend-llvm")] +// "llvm" => { +// use wasmer_llvm_backend::ModuleCodeGenerator as LLVMMCG; +// StreamingCompiler = StreamingCompiler::new(move || { +// let mut chain = MiddlewareChain::new(); +// chain.push(Metering::new(limit)); +// chain +// }) +// } +// _ => panic!("Unimplemented backend"); +// } +// } - #[cfg(feature = "backend-llvm")] - use wasmer_llvm_backend::ModuleCodeGenerator as MCG; +// // Assemblyscript +// // export function add_to(x: i32, y: i32): i32 { +// // for(var i = 0; i < x; i++){ +// // if(i % 1 == 0){ +// // y += i; +// // } else { +// // y *= i +// // } +// // } +// // return y; +// // } +// static WAT: &'static str = r#" +// (module +// (type $t0 (func (param i32 i32) (result i32))) +// (type $t1 (func)) +// (func $add_to (export "add_to") (type $t0) (param $p0 i32) (param $p1 i32) (result i32) +// (local $l0 i32) +// block $B0 +// i32.const 0 +// set_local $l0 +// loop $L1 +// get_local $l0 +// get_local $p0 +// i32.lt_s +// i32.eqz +// br_if $B0 +// get_local $l0 +// i32.const 1 +// i32.rem_s +// i32.const 0 +// i32.eq +// if $I2 +// get_local $p1 +// get_local $l0 +// i32.add +// set_local $p1 +// else +// get_local $p1 +// get_local $l0 +// i32.mul +// set_local $p1 +// end +// get_local $l0 +// i32.const 1 +// i32.add +// set_local $l0 +// br $L1 +// unreachable +// end +// unreachable +// end +// get_local $p1) +// (func $f1 (type $t1)) +// (table $table (export "table") 1 anyfunc) +// (memory $memory (export "memory") 0) +// (global $g0 i32 (i32.const 8)) +// (elem (i32.const 0) $f1)) +// "#; - #[cfg(feature = "backend-singlepass")] - use wasmer_singlepass_backend::ModuleCodeGenerator as MCG; +// #[cfg(feature = "backend-singlepass")] +// mod singlepass { +// #[test] +// fn middleware_test_points_reduced_after_call() { +// super::middleware_test_points_reduced_after_call("singlepass") +// } +// #[test] +// fn middleware_test_traps_after_costly_call() { +// super::middleware_test_traps_after_costly_call("singlepass") +// } +// } - fn get_compiler(limit: u64) -> impl Compiler { - let c: StreamingCompiler = StreamingCompiler::new(move || { - let mut chain = MiddlewareChain::new(); - chain.push(Metering::new(limit)); - chain - }); - c - } +// #[cfg(feature = "backend-llvm")] +// mod llvm { +// #[test] +// fn middleware_test_points_reduced_after_call() { +// super::middleware_test_points_reduced_after_call("llvm") +// } +// #[test] +// fn middleware_test_traps_after_costly_call() { +// super::middleware_test_traps_after_costly_call("llvm") +// } +// } - #[cfg(not(any( - feature = "backend-llvm", - feature = "backend-cranelift", - feature = "backend-singlepass" - )))] - compile_error!("compiler not specified, activate a compiler via features"); +// fn middleware_test_points_reduced_after_call(backend: &'static str) { +// let wasm_binary = wat2wasm(WAT).unwrap(); - // Assemblyscript - // export function add_to(x: i32, y: i32): i32 { - // for(var i = 0; i < x; i++){ - // if(i % 1 == 0){ - // y += i; - // } else { - // y *= i - // } - // } - // return y; - // } - static WAT: &'static str = r#" - (module - (type $t0 (func (param i32 i32) (result i32))) - (type $t1 (func)) - (func $add_to (export "add_to") (type $t0) (param $p0 i32) (param $p1 i32) (result i32) - (local $l0 i32) - block $B0 - i32.const 0 - set_local $l0 - loop $L1 - get_local $l0 - get_local $p0 - i32.lt_s - i32.eqz - br_if $B0 - get_local $l0 - i32.const 1 - i32.rem_s - i32.const 0 - i32.eq - if $I2 - get_local $p1 - get_local $l0 - i32.add - set_local $p1 - else - get_local $p1 - get_local $l0 - i32.mul - set_local $p1 - end - get_local $l0 - i32.const 1 - i32.add - set_local $l0 - br $L1 - unreachable - end - unreachable - end - get_local $p1) - (func $f1 (type $t1)) - (table $table (export "table") 1 anyfunc) - (memory $memory (export "memory") 0) - (global $g0 i32 (i32.const 8)) - (elem (i32.const 0) $f1)) - "#; +// let limit = 100u64; - #[test] - fn middleware_test_points_reduced_after_call() { - let wasm_binary = wat2wasm(WAT).unwrap(); +// let compiler = get_compiler(backend, limit); +// let module = compile_with(&wasm_binary, &compiler).unwrap(); - let limit = 100u64; +// let import_object = imports! {}; +// let mut instance = module.instantiate(&import_object).unwrap(); - let compiler = get_compiler(limit); - let module = compile_with(&wasm_binary, &compiler).unwrap(); +// set_points_used(&mut instance, 0u64); - let import_object = imports! {}; - let mut instance = module.instantiate(&import_object).unwrap(); +// let add_to: Func<(i32, i32), i32> = instance.exports.get("add_to").unwrap(); - set_points_used(&mut instance, 0u64); +// let cv_pushed = if let Some(msm) = instance.module.runnable_module.get_module_state_map() { +// push_code_version(CodeVersion { +// baseline: true, +// msm: msm, +// base: instance.module.runnable_module.get_code().unwrap().as_ptr() as usize, +// backend: &backend, +// runnable_module: instance.module.runnable_module.clone(), +// }); +// true +// } else { +// false +// }; - let add_to: Func<(i32, i32), i32> = instance.exports.get("add_to").unwrap(); +// let value = add_to.call(3, 4).unwrap(); +// if cv_pushed { +// pop_code_version().unwrap(); +// } - let cv_pushed = if let Some(msm) = instance.module.runnable_module.get_module_state_map() { - push_code_version(CodeVersion { - baseline: true, - msm: msm, - base: instance.module.runnable_module.get_code().unwrap().as_ptr() as usize, - backend: MCG::backend_id(), - runnable_module: instance.module.runnable_module.clone(), - }); - true - } else { - false - }; +// // verify it returns the correct value +// assert_eq!(value, 7); - let value = add_to.call(3, 4).unwrap(); - if cv_pushed { - pop_code_version().unwrap(); - } +// // verify it used the correct number of points +// assert_eq!(get_points_used(&instance), 74); +// } - // verify it returns the correct value - assert_eq!(value, 7); +// fn middleware_test_traps_after_costly_call(backend: &'static str) { +// let wasm_binary = wat2wasm(WAT).unwrap(); - // verify it used the correct number of points - assert_eq!(get_points_used(&instance), 74); - } +// let limit = 100u64; - #[test] - fn middleware_test_traps_after_costly_call() { - let wasm_binary = wat2wasm(WAT).unwrap(); +// let compiler = get_compiler(backend, limit); +// let module = compile_with(&wasm_binary, &compiler).unwrap(); - let limit = 100u64; +// let import_object = imports! {}; +// let mut instance = module.instantiate(&import_object).unwrap(); - let compiler = get_compiler(limit); - let module = compile_with(&wasm_binary, &compiler).unwrap(); +// set_points_used(&mut instance, 0u64); - let import_object = imports! {}; - let mut instance = module.instantiate(&import_object).unwrap(); +// let add_to: Func<(i32, i32), i32> = instance.exports.get("add_to").unwrap(); - set_points_used(&mut instance, 0u64); +// let cv_pushed = if let Some(msm) = instance.module.runnable_module.get_module_state_map() { +// push_code_version(CodeVersion { +// baseline: true, +// msm: msm, +// base: instance.module.runnable_module.get_code().unwrap().as_ptr() as usize, +// backend: &backend, +// runnable_module: instance.module.runnable_module.clone(), +// }); +// true +// } else { +// false +// }; +// let result = add_to.call(10_000_000, 4); +// if cv_pushed { +// pop_code_version().unwrap(); +// } - let add_to: Func<(i32, i32), i32> = instance.exports.get("add_to").unwrap(); +// let err = result.unwrap_err(); +// assert!(err +// .0 +// .downcast_ref::() +// .is_some()); - let cv_pushed = if let Some(msm) = instance.module.runnable_module.get_module_state_map() { - push_code_version(CodeVersion { - baseline: true, - msm: msm, - base: instance.module.runnable_module.get_code().unwrap().as_ptr() as usize, - backend: MCG::backend_id(), - runnable_module: instance.module.runnable_module.clone(), - }); - true - } else { - false - }; - let result = add_to.call(10_000_000, 4); - if cv_pushed { - pop_code_version().unwrap(); - } - - let err = result.unwrap_err(); - assert!(err - .0 - .downcast_ref::() - .is_some()); - - // verify it used the correct number of points - assert_eq!(get_points_used(&instance), 109); // Used points will be slightly more than `limit` because of the way we do gas checking. - } -} +// // verify it used the correct number of points +// assert_eq!(get_points_used(&instance), 109); // Used points will be slightly more than `limit` because of the way we do gas checking. +// } diff --git a/tests/spectest.rs b/tests/spectest.rs index 737f0178f..d83ea2b48 100644 --- a/tests/spectest.rs +++ b/tests/spectest.rs @@ -1,3 +1,5 @@ +mod utils; + use std::path::Path; #[cfg(not(any( @@ -10,27 +12,21 @@ use anyhow::bail; use wasmer::compiler::Backend; use wasmer_wast::Wast; +// The generated tests (from build.rs) look like: // #[cfg(test)] -// mod spectests { -// mod cranelift { +// mod singlepass { +// mod spec { // #[test] -// fn address() -> Result<(), String> { -// crate::run_wast("tests/spectests/address.wast", "llvm") +// fn address() -> anyhow::Result<()> { +// crate::run_wast("tests/spectests/address.wast", "singlepass") // } // } // } -include!(concat!(env!("OUT_DIR"), "/generated_tests.rs")); +include!(concat!(env!("OUT_DIR"), "/generated_spectests.rs")); fn run_wast(wast_path: &str, backend: &str) -> anyhow::Result<()> { - let backend = match backend { - #[cfg(feature = "backend-singlepass")] - "singlepass" => Backend::Singlepass, - #[cfg(feature = "backend-cranelift")] - "cranelift" => Backend::Cranelift, - #[cfg(feature = "backend-llvm")] - "llvm" => Backend::LLVM, - _ => bail!("Backend {} not found", backend), - }; + println!("Running wast {} with {}", wast_path, backend); + let backend = utils::get_backend_from_str(backend)?; let mut wast = Wast::new_with_spectest(backend); let path = Path::new(wast_path); wast.run_file(path) diff --git a/tests/test-generator/src/lib.rs b/tests/test-generator/src/lib.rs index 1b927d5a1..94c593ffe 100644 --- a/tests/test-generator/src/lib.rs +++ b/tests/test-generator/src/lib.rs @@ -9,7 +9,7 @@ use anyhow::Context; use std::collections::HashSet; use std::fmt::Write; -use std::fs::{DirEntry, File}; +use std::fs::File; use std::io::{BufRead, BufReader}; use std::path::{Path, PathBuf}; use target_lexicon::Triple; @@ -24,7 +24,15 @@ pub struct Testsuite { impl Testsuite { fn ignore_current(&self) -> bool { let full = self.path.join("::"); - self.ignores.contains(&full) + if self.ignores.contains(&full) { + return true; + } + for ignore in self.ignores.iter() { + if full.contains(ignore) { + return true; + } + } + false } } @@ -161,3 +169,17 @@ pub fn with_test_module( out.path.pop().unwrap(); Ok(result) } + +pub fn with_backends( + mut out: &mut Testsuite, + backends: &[&str], + f: impl Fn(&mut Testsuite) -> anyhow::Result<()> + Copy, +) -> anyhow::Result<()> { + for compiler in backends.iter() { + writeln!(out.buffer, "#[cfg(feature=\"backend-{}\")]", compiler)?; + writeln!(out.buffer, "#[cfg(test)]")?; + writeln!(out.buffer, "#[allow(non_snake_case)]")?; + with_test_module(&mut out, &compiler, f)?; + } + Ok(()) +} diff --git a/tests/utils/backend.rs b/tests/utils/backend.rs new file mode 100644 index 000000000..1522f6f9a --- /dev/null +++ b/tests/utils/backend.rs @@ -0,0 +1,20 @@ +use anyhow::{bail, Result}; +use wasmer::compiler::Backend; + +/// Gets a `Backend` given a string. +/// +/// # Errors +/// +/// This function errors if the backend doesn't exist or +/// is not enabled. +pub fn get_backend_from_str(backend: &str) -> Result { + match backend { + #[cfg(feature = "backend-singlepass")] + "singlepass" => Ok(Backend::Singlepass), + #[cfg(feature = "backend-cranelift")] + "cranelift" => Ok(Backend::Cranelift), + #[cfg(feature = "backend-llvm")] + "llvm" => Ok(Backend::LLVM), + _ => bail!("Backend {} not found", backend), + } +} diff --git a/tests/utils/mod.rs b/tests/utils/mod.rs index 76ae6804f..090911e36 100644 --- a/tests/utils/mod.rs +++ b/tests/utils/mod.rs @@ -1,2 +1,5 @@ -pub mod file_descriptor; +mod backend; +mod file_descriptor; pub mod stdio; + +pub use backend::get_backend_from_str; diff --git a/tests/wasi_test_resources/close_preopen_fd.out b/tests/wasi_test_resources/close_preopen_fd.out deleted file mode 100644 index e6e9b9f67..000000000 --- a/tests/wasi_test_resources/close_preopen_fd.out +++ /dev/null @@ -1,3 +0,0 @@ -accessing preopen fd was a success -Closing preopen fd was a success -accessing closed preopen fd was an EBADF error: true diff --git a/tests/wasi_test_resources/close_preopen_fd.rs b/tests/wasi_test_resources/close_preopen_fd.rs index 025c355fa..d5ffac3cc 100644 --- a/tests/wasi_test_resources/close_preopen_fd.rs +++ b/tests/wasi_test_resources/close_preopen_fd.rs @@ -1,4 +1,4 @@ -// Args: +// WASI: // mapdir: hamlet:tests/wasi_test_resources/test_fs/hamlet use std::fs; diff --git a/tests/wasi_test_resources/create_dir.out b/tests/wasi_test_resources/create_dir.out deleted file mode 100644 index cc1a8aa2c..000000000 --- a/tests/wasi_test_resources/create_dir.out +++ /dev/null @@ -1,5 +0,0 @@ -Test file exists: false -Dir exists: false -Dir exists: false -Dir exists: false -Success diff --git a/tests/wasi_test_resources/create_dir.rs b/tests/wasi_test_resources/create_dir.rs index 21e07d619..a33305cbf 100644 --- a/tests/wasi_test_resources/create_dir.rs +++ b/tests/wasi_test_resources/create_dir.rs @@ -1,4 +1,4 @@ -// Args: +// WASI: // dir: . use std::fs; diff --git a/tests/wasi_test_resources/envvar.out b/tests/wasi_test_resources/envvar.out deleted file mode 100644 index 67848f4f4..000000000 --- a/tests/wasi_test_resources/envvar.out +++ /dev/null @@ -1,6 +0,0 @@ -Env vars: -CAT=2 -DOG=1 -DOG Ok("1") -DOG_TYPE Err(NotPresent) -SET VAR Ok("HELLO") diff --git a/tests/wasi_test_resources/envvar.rs b/tests/wasi_test_resources/envvar.rs index a5d8982c6..184611477 100644 --- a/tests/wasi_test_resources/envvar.rs +++ b/tests/wasi_test_resources/envvar.rs @@ -1,4 +1,4 @@ -// Args: +// WASI: // env: DOG=1 // env: CAT=2 diff --git a/tests/wasi_test_resources/fd_allocate.out b/tests/wasi_test_resources/fd_allocate.out deleted file mode 100644 index d8a0f88c3..000000000 --- a/tests/wasi_test_resources/fd_allocate.out +++ /dev/null @@ -1,2 +0,0 @@ -171 -1405 diff --git a/tests/wasi_test_resources/fd_allocate.rs b/tests/wasi_test_resources/fd_allocate.rs index 75118502a..4cedd79fc 100644 --- a/tests/wasi_test_resources/fd_allocate.rs +++ b/tests/wasi_test_resources/fd_allocate.rs @@ -1,4 +1,4 @@ -// Args: +// WASI: // mapdir: .:tests/wasi_test_resources/test_fs/temp use std::fs; diff --git a/tests/wasi_test_resources/fd_append.out b/tests/wasi_test_resources/fd_append.out deleted file mode 100644 index e9d92ef26..000000000 --- a/tests/wasi_test_resources/fd_append.out +++ /dev/null @@ -1 +0,0 @@ -"Hello, world!\nGoodbye, world!\n" diff --git a/tests/wasi_test_resources/fd_append.rs b/tests/wasi_test_resources/fd_append.rs index 5cf2634c1..48cb5b5f9 100644 --- a/tests/wasi_test_resources/fd_append.rs +++ b/tests/wasi_test_resources/fd_append.rs @@ -1,4 +1,4 @@ -// Args: +// WASI: // mapdir: .:tests/wasi_test_resources/test_fs/temp use std::fs::OpenOptions; diff --git a/tests/wasi_test_resources/fd_close.out b/tests/wasi_test_resources/fd_close.out deleted file mode 100644 index 53c9c2727..000000000 --- a/tests/wasi_test_resources/fd_close.out +++ /dev/null @@ -1,3 +0,0 @@ -Successfully closed file! -Successfully closed stderr! -Successfully closed stdin! diff --git a/tests/wasi_test_resources/fd_close.rs b/tests/wasi_test_resources/fd_close.rs index 2004ebaa2..67ca874eb 100644 --- a/tests/wasi_test_resources/fd_close.rs +++ b/tests/wasi_test_resources/fd_close.rs @@ -1,4 +1,4 @@ -// Args: +// WASI: // mapdir: .:tests/wasi_test_resources/test_fs/hamlet use std::fs; diff --git a/tests/wasi_test_resources/fd_pread.out b/tests/wasi_test_resources/fd_pread.out deleted file mode 100644 index a83632aea..000000000 --- a/tests/wasi_test_resources/fd_pread.out +++ /dev/null @@ -1,9 +0,0 @@ - POLONIUS - - He will come straight. Look you lay home to him: - - POLONIUS - - He will come straight. Look you lay home to him: - -Read the same data? true \ No newline at end of file diff --git a/tests/wasi_test_resources/fd_pread.rs b/tests/wasi_test_resources/fd_pread.rs index e0dc0c6d4..57008b596 100644 --- a/tests/wasi_test_resources/fd_pread.rs +++ b/tests/wasi_test_resources/fd_pread.rs @@ -1,4 +1,4 @@ -// Args: +// WASI: // mapdir: .:tests/wasi_test_resources/test_fs/hamlet use std::fs; diff --git a/tests/wasi_test_resources/fd_read.out b/tests/wasi_test_resources/fd_read.out deleted file mode 100644 index f2b9f2169..000000000 --- a/tests/wasi_test_resources/fd_read.out +++ /dev/null @@ -1,3 +0,0 @@ -SCENE IV. The Queen's closet. - - Enter QUEEN GERTRUDE and POLO \ No newline at end of file diff --git a/tests/wasi_test_resources/fd_read.rs b/tests/wasi_test_resources/fd_read.rs index ac8e263db..ec28b104a 100644 --- a/tests/wasi_test_resources/fd_read.rs +++ b/tests/wasi_test_resources/fd_read.rs @@ -1,4 +1,4 @@ -// Args: +// WASI: // mapdir: .:tests/wasi_test_resources/test_fs/hamlet // this program is used in the pause/resume test diff --git a/tests/wasi_test_resources/fd_sync.out b/tests/wasi_test_resources/fd_sync.out deleted file mode 100644 index ccda92fc0..000000000 --- a/tests/wasi_test_resources/fd_sync.out +++ /dev/null @@ -1,2 +0,0 @@ -170 -1404 diff --git a/tests/wasi_test_resources/fd_sync.rs b/tests/wasi_test_resources/fd_sync.rs index 31489d9cf..502ee9db5 100644 --- a/tests/wasi_test_resources/fd_sync.rs +++ b/tests/wasi_test_resources/fd_sync.rs @@ -1,4 +1,4 @@ -// Args: +// WASI: // mapdir: .:tests/wasi_test_resources/test_fs/temp use std::fs; diff --git a/tests/wasi_test_resources/file_metadata.out b/tests/wasi_test_resources/file_metadata.out deleted file mode 100644 index 974bc1ff5..000000000 --- a/tests/wasi_test_resources/file_metadata.out +++ /dev/null @@ -1,3 +0,0 @@ -is dir: false -filetype: false true false -file info: 493 diff --git a/tests/wasi_test_resources/file_metadata.rs b/tests/wasi_test_resources/file_metadata.rs index 9ae25534e..d20c7d5ba 100644 --- a/tests/wasi_test_resources/file_metadata.rs +++ b/tests/wasi_test_resources/file_metadata.rs @@ -1,4 +1,4 @@ -// Args: +// WASI: // dir: . use std::fs; diff --git a/tests/wasi_test_resources/fs_sandbox_test.out b/tests/wasi_test_resources/fs_sandbox_test.out deleted file mode 100644 index e98c9da00..000000000 --- a/tests/wasi_test_resources/fs_sandbox_test.out +++ /dev/null @@ -1 +0,0 @@ -Reading the parent directory was okay? false diff --git a/tests/wasi_test_resources/fseek.out b/tests/wasi_test_resources/fseek.out deleted file mode 100644 index c9f09be6e..000000000 --- a/tests/wasi_test_resources/fseek.out +++ /dev/null @@ -1,11 +0,0 @@ -SCENE III. A room in Polonius' h -ouse. - - Enter LAERTES and OPH - And, sister, as the winds gi -r talk with the Lord Hamlet. - -uits, - Breathing like sanctif -is is for all: - I would not, diff --git a/tests/wasi_test_resources/fseek.rs b/tests/wasi_test_resources/fseek.rs index 571edd3c8..2eb1168e4 100644 --- a/tests/wasi_test_resources/fseek.rs +++ b/tests/wasi_test_resources/fseek.rs @@ -1,4 +1,4 @@ -// Args: +// WASI: // mapdir: .:tests/wasi_test_resources/test_fs/hamlet use std::fs; diff --git a/tests/wasi_test_resources/hello.out b/tests/wasi_test_resources/hello.out deleted file mode 100644 index af5626b4a..000000000 --- a/tests/wasi_test_resources/hello.out +++ /dev/null @@ -1 +0,0 @@ -Hello, world! diff --git a/tests/wasi_test_resources/ignores.txt b/tests/wasi_test_resources/ignores.txt deleted file mode 100644 index df00fac5b..000000000 --- a/tests/wasi_test_resources/ignores.txt +++ /dev/null @@ -1,6 +0,0 @@ -snapshot1_fd_read -snapshot1_poll_oneoff -snapshot1_fd_pread -snapshot1_fd_close -snapshot1_fd_allocate -snapshot1_close_preopen_fd diff --git a/tests/wasi_test_resources/isatty.out b/tests/wasi_test_resources/isatty.out deleted file mode 100644 index 497b57818..000000000 --- a/tests/wasi_test_resources/isatty.out +++ /dev/null @@ -1,3 +0,0 @@ -stdin: 1 -stdout: 1 -stderr: 1 diff --git a/tests/wasi_test_resources/mapdir.out b/tests/wasi_test_resources/mapdir.out deleted file mode 100644 index 8f5d6ad44..000000000 --- a/tests/wasi_test_resources/mapdir.out +++ /dev/null @@ -1,7 +0,0 @@ -"./README.md" -"./act1" -"./act2" -"./act3" -"./act4" -"./act5" -"./bookmarks" diff --git a/tests/wasi_test_resources/mapdir.rs b/tests/wasi_test_resources/mapdir.rs index d58a2b332..1dbfecbb8 100644 --- a/tests/wasi_test_resources/mapdir.rs +++ b/tests/wasi_test_resources/mapdir.rs @@ -1,4 +1,4 @@ -// Args: +// WASI: // mapdir: .:tests/wasi_test_resources/test_fs/hamlet use std::fs; diff --git a/tests/wasi_test_resources/path_link.out b/tests/wasi_test_resources/path_link.out deleted file mode 100644 index 53df012ad..000000000 --- a/tests/wasi_test_resources/path_link.out +++ /dev/null @@ -1,9 +0,0 @@ -ACT V -SCENE I. A churchyard. - - Enter two Clowns, with spades, -ACT V -SCENE I. A churchyard. - - Enter two Clowns, with spades, -Path still exists diff --git a/tests/wasi_test_resources/path_link.rs b/tests/wasi_test_resources/path_link.rs index 7672a0511..ed5b08312 100644 --- a/tests/wasi_test_resources/path_link.rs +++ b/tests/wasi_test_resources/path_link.rs @@ -1,4 +1,4 @@ -// Args: +// WASI: // mapdir: act5:tests/wasi_test_resources/test_fs/hamlet/act5 // mapdir: temp:tests/wasi_test_resources/test_fs/temp diff --git a/tests/wasi_test_resources/path_rename.out b/tests/wasi_test_resources/path_rename.out deleted file mode 100644 index 7b44f5763..000000000 --- a/tests/wasi_test_resources/path_rename.out +++ /dev/null @@ -1,2 +0,0 @@ -The original file does not still exist! -柴犬 diff --git a/tests/wasi_test_resources/path_rename.rs b/tests/wasi_test_resources/path_rename.rs index 29fb88b93..b89158a30 100644 --- a/tests/wasi_test_resources/path_rename.rs +++ b/tests/wasi_test_resources/path_rename.rs @@ -1,4 +1,4 @@ -// Args: +// WASI: // mapdir: temp:tests/wasi_test_resources/test_fs/temp use std::fs; diff --git a/tests/wasi_test_resources/path_symlink.out b/tests/wasi_test_resources/path_symlink.out deleted file mode 100644 index 085a92816..000000000 --- a/tests/wasi_test_resources/path_symlink.out +++ /dev/null @@ -1,4 +0,0 @@ -ACT III -SCENE I. A room in the castle. - - Enter KING CLAUDIUS, diff --git a/tests/wasi_test_resources/path_symlink.rs b/tests/wasi_test_resources/path_symlink.rs index e06b4d16c..506f5cac5 100644 --- a/tests/wasi_test_resources/path_symlink.rs +++ b/tests/wasi_test_resources/path_symlink.rs @@ -1,4 +1,4 @@ -// Args: +// WASI: // mapdir: temp:tests/wasi_test_resources/test_fs/temp // mapdir: hamlet:tests/wasi_test_resources/test_fs/hamlet diff --git a/tests/wasi_test_resources/poll_oneoff.out b/tests/wasi_test_resources/poll_oneoff.out deleted file mode 100644 index 055f45f47..000000000 --- a/tests/wasi_test_resources/poll_oneoff.out +++ /dev/null @@ -1,5 +0,0 @@ -__wasi_event_t { userdata: 1193046, error: 0, type_: 1, u: __wasi_event_u { __wasi_event_fd_readwrite_t { nbytes: 2259, flags: 0 } } } -[__wasi_event_t { userdata: 1193046, error: 0, type_: 1, u: __wasi_event_u { __wasi_event_fd_readwrite_t { nbytes: 2259, flags: 0 } } }, __wasi_event_t { userdata: 1193046, error: 0, type_: 2, u: __wasi_event_u { __wasi_event_fd_readwrite_t { nbytes: 1234, flags: 0 } } }] -Stdin: OK -Stdout: OK -Stderr: OK diff --git a/tests/wasi_test_resources/poll_oneoff.rs b/tests/wasi_test_resources/poll_oneoff.rs index 177ff19ae..484190cae 100644 --- a/tests/wasi_test_resources/poll_oneoff.rs +++ b/tests/wasi_test_resources/poll_oneoff.rs @@ -1,4 +1,4 @@ -// Args: +// WASI: // mapdir: hamlet:tests/wasi_test_resources/test_fs/hamlet // mapdir: temp:tests/wasi_test_resources/test_fs/temp diff --git a/tests/wasi_test_resources/quine.out b/tests/wasi_test_resources/quine.out deleted file mode 100644 index 3d554e2e5..000000000 --- a/tests/wasi_test_resources/quine.out +++ /dev/null @@ -1,15 +0,0 @@ -// Args: -// dir: . - -use std::fs; -use std::io::Read; - -fn main() { - let mut this_file = - fs::File::open("tests/wasi_test_resources/quine.rs").expect("could not find src file"); - let md = this_file.metadata().unwrap(); - let mut in_str = String::new(); - this_file.read_to_string(&mut in_str).unwrap(); - println!("{}", in_str); -} - diff --git a/tests/wasi_test_resources/quine.rs b/tests/wasi_test_resources/quine.rs index 6ed0f24d1..632865f4a 100644 --- a/tests/wasi_test_resources/quine.rs +++ b/tests/wasi_test_resources/quine.rs @@ -1,4 +1,4 @@ -// Args: +// WASI: // dir: . use std::fs; diff --git a/tests/wasi_test_resources/readlink.out b/tests/wasi_test_resources/readlink.out deleted file mode 100644 index 547b33b18..000000000 --- a/tests/wasi_test_resources/readlink.out +++ /dev/null @@ -1,4 +0,0 @@ -../act1/scene2.txt -SCENE II. A room of state in the castle. - - Enter KING CLAUDIUS, QUEEN GERTRUDE, HAMLET, POLONIUS, LAERTES, VOLTIMAND, CORNELI diff --git a/tests/wasi_test_resources/readlink.rs b/tests/wasi_test_resources/readlink.rs index 66472b718..620de76cf 100644 --- a/tests/wasi_test_resources/readlink.rs +++ b/tests/wasi_test_resources/readlink.rs @@ -1,4 +1,4 @@ -// Args: +// WASI: // mapdir: .:tests/wasi_test_resources/test_fs/hamlet use std::io::Read; diff --git a/tests/wasi_test_resources/snapshot1/close_preopen_fd.out b/tests/wasi_test_resources/snapshot1/close_preopen_fd.out new file mode 100644 index 000000000..6d18d7b1a --- /dev/null +++ b/tests/wasi_test_resources/snapshot1/close_preopen_fd.out @@ -0,0 +1,14 @@ +{ + "output": "accessing preopen fd was a success\nClosing preopen fd was a success\naccessing closed preopen fd was an EBADF error: true\n", + "options": { + "mapdir": [ + [ + "hamlet", + "tests/wasi_test_resources/test_fs/hamlet" + ] + ], + "env": [], + "args": [], + "dir": [] + } +} \ No newline at end of file diff --git a/tests/wasi_test_resources/snapshot1/close_preopen_fd.wasm b/tests/wasi_test_resources/snapshot1/close_preopen_fd.wasm index 8a2613e066f8d490cefc2f955660c33e51375517..40941670d3b1d4ca0449d71e63e211173707479d 100755 GIT binary patch delta 1542 zcmYjRYitx%6uxKf+?i>&uibXH+hyC1T`DUQ+p-jFKw!{PTdJfOp`zI3u_hoEY*G9} zx0pzRfMk1PD?VCON-=5Ll%X+p3$&r8QL8_Ei$-l|0+pIbj7j4kJZBaXZ#!qcd(L;i z^Uaybel)|c&hRa4d+Q6p7=r}(ql`r%P8YOAm3SQDQ8kW>(S}921F;x);N2?T8D4^z z#A>61iH$x%Sx6Ln3sO>!#$6U;$~nbI+{({L+uyQpXH)Ez-3QP^M<~EE4{mSW-Skp( z>w)b%_Qs6ob~WwXyRS9IbY#0|d$48qff!3m+*$-2bFv(~KvHrW~Dt^IuY-zs}P1zWU(TT`@9EL2b^!rri z%3~%oA*?t-4J&zWfh8aJyH)veM=}RJr%)J*4x*h$Y8FZGef_1{oEL{vP`godvLDQ z-LSLY{TKVm^zK58;cnAouuL$yiDfiQ94@zZhp^bz{YikcOlFF(Qf}QILM?^xGDk=@ z^d#^-U+d}9k$bGK05`pTM>X7(4fxR5`T-KzGjJNQYp?)u>0l+2o*tY5OsyRXV%#>= zfW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6zBHDG-OpYN9Lj%jGE&T4O@Ua|9c!RtH&k@o!vDR1cJ(eR9Ce$8!TFGf~EZl@Aeb z5BN|_4qS5+JXEIUrxl@<5zIvue$+}NPF_j?kp+W82Kr76731X2P>+t2@Nf|pc63-J zd2e_SaZR!q@xEjgI`t;!@vMp$M?7fzMw$TRk0Y(BraE~YKT9XLO-PqxHH?V-QI%=) z==?LcJ1WHAMh(d!?mP1vWODOBH` zdbO^QS3Nv_nwv-DvFQN%iQ$0bjzw*)NqEoGV4!GIs{;!kiba z<3yuxVckfCbgSFP8sgOAgK$VB7b}ca=I6!wqP=)EXc&9A7rKP8RGOQi!mE<3TH2`p2Re9i AkN^Mx diff --git a/tests/wasi_test_resources/snapshot1/create_dir.out b/tests/wasi_test_resources/snapshot1/create_dir.out new file mode 100644 index 000000000..18902fcf9 --- /dev/null +++ b/tests/wasi_test_resources/snapshot1/create_dir.out @@ -0,0 +1,11 @@ +{ + "output": "Test file exists: false\nDir exists: false\nDir exists: false\nDir exists: false\nSuccess\n", + "options": { + "mapdir": [], + "env": [], + "args": [], + "dir": [ + "." + ] + } +} \ No newline at end of file diff --git a/tests/wasi_test_resources/snapshot1/create_dir.wasm b/tests/wasi_test_resources/snapshot1/create_dir.wasm index c971cd6c36de000e3c92538c6780f4cadb458ba5..68903c17de6d3b939a2567053eca9296027abf0a 100755 GIT binary patch delta 2256 zcmX|D3v3+K6@B;3yqVd|+WWD+-hak+95zPSaS}|y{3arHpem8UB-k=!Lu{wG331~z ziJLQ>Lr|jVMQ%~pi2S76h2wP?i^yu zt(C06`3>rzDxjQ9@z?^ln#UK=RvslD_)YS<1@1Lov%sC@RVA)H#iuwilTkHKFkUY- z!(avzg7c&ygfLQR)8rvdv$#4H$#wj3xG_rzJf7en!h{DdZdn#*g1AVN5T;=D46M*h zQI7(;o)CsEA`#utOC~DlI!~FP1&B;F$}`=tEX36thQaF@iZTXh2p&>KbR{y}h#2*$ zXebhQ)b4p%w)nsCxQf`gry7BxSGl25y8V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?R2CzyzMZEllDCOO$8lm5U-G6C{^YGRX8NFhSLyEWq?O!!$Qg`Dk= z2JB=kzvNa^QvAlYPVjX*z6!GNjdM3M8AH$J0%lmVGJZ0+ZsRkLJ>9Z#&H8nliR36> zWJi#a%8?4A5KPL+COeA-xMy1yWd#BOG8=)|_>eFtDTOZ2)l7+WwN?KsJ zyWlnK!W$_(BRHVDLi0G_oei}hrk9mGicC*Qjsf(Cqk!v+kpbw&x^jK0Y$2?4P1ti? zje-a+(dpQ#jOD#Ne!Sv(RyDBldaAxQe700?GP_9E*yybO>&^%&G}e{spTf3x zOKpsST)ni`thV>QaxZn)BZhstW`N>Fp~_`GYGCz;3LM!v|r z=Ll0UOfJVoQDRqjA0;NcoCt3KSF<>K!yk=fIentD6#CarcM2{PyV7h3d<}+lxC<@T zRb8JI6KV&)4zXF2x5U=Q{=|p z4`83{4Z$AmT?kO=mlrrflp9RYbm6M$6!giuKId>;6MUry7#Q zE@xQ!Z6v+#h*{wHk-a5`WwAM&|7gOVpqcD{9;mznz&>5AbGaTqxqbYtk0Uc@v?gYbo#2m2&%E$kcHx diff --git a/tests/wasi_test_resources/snapshot1/fd_allocate.out b/tests/wasi_test_resources/snapshot1/fd_allocate.out new file mode 100644 index 000000000..289e661d0 --- /dev/null +++ b/tests/wasi_test_resources/snapshot1/fd_allocate.out @@ -0,0 +1,14 @@ +{ + "output": "171\n1405\n", + "options": { + "mapdir": [ + [ + ".", + "tests/wasi_test_resources/test_fs/temp" + ] + ], + "env": [], + "args": [], + "dir": [] + } +} \ No newline at end of file diff --git a/tests/wasi_test_resources/snapshot1/fd_allocate.wasm b/tests/wasi_test_resources/snapshot1/fd_allocate.wasm index f11f70f3eddb2d6bcc690d832e1aed4001b1dc03..bfebe58901a06b93b5bb94228d28b1128c5e1a8e 100755 GIT binary patch delta 1884 zcmYjSYiv|S6rMA8=H5$px9qar?RMMJ%PzEA5c+^p1O;vbt+6}=6@j)`1PUn@h$vuU zx&}o-A)!ui(F7D94Fid z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#i7W#uqdKhs~+IouWRZXa&1f407B zu&=+pt8uVybA0R8T9U5*n%0`?p}v7f5BAhPJ?y-8?Q|J_pV|_{kBiMKAz3A%*J$Jg z^XgqmT@T`2*qy4#!CLDU*Or4V1+Bt7$u*%rM^+}Laxfq9j#N4qH~hchk6e5Mhf>dn Ruq3n=m{?n3;&ceB)PLX7K&1cx diff --git a/tests/wasi_test_resources/snapshot1/fd_close.out b/tests/wasi_test_resources/snapshot1/fd_close.out new file mode 100644 index 000000000..a2b472bb0 --- /dev/null +++ b/tests/wasi_test_resources/snapshot1/fd_close.out @@ -0,0 +1,14 @@ +{ + "output": "Successfully closed file!\nSuccessfully closed stderr!\nSuccessfully closed stdin!\n", + "options": { + "mapdir": [ + [ + ".", + "tests/wasi_test_resources/test_fs/hamlet" + ] + ], + "env": [], + "args": [], + "dir": [] + } +} \ No newline at end of file diff --git a/tests/wasi_test_resources/snapshot1/fd_close.wasm b/tests/wasi_test_resources/snapshot1/fd_close.wasm index 5b70a4e94f5a1a9f0be59f4c875e3655b5a2633f..d6be370505873e342be311561301fbc1c021bcda 100755 GIT binary patch delta 1809 zcmZuyYitx%6h7z9y)#p0OS{`$*p@z~Esz$awICviLZ=b1DwHBcK}xqm(N>h!B1BEP zm58A7TCcb&phh$hP-vLQBapTPL;V3%p!82mDaxb7#G=8(kbs`MTkwxJ*>k`1`p#o! zcW>_JpSAF3p}O%^1OVKPsUZwQ2q475VGNUkO(7np6SF`_i$OAnW00e&Z zBYR0wI;uA8Q=Q+-Csl#oEwT+j(H-J|;xM;H)e2Zjb3ej{L-#>kN-6%;5a zQJ7p%Dic)8U>?DS3&y!$m;r<7dXSlhX;6a{k;IY{OlD9UlwdM1V|six_b5w7?3bss zI|y=4S%!O^KgtkY+bH7*ZoTyQgtxf%a7Uw39>SUF$&q`RcNe)&J zY_Ktpfz5190iMT_z2xxUcf^f;ulWDypqI{pe>(%tCpLO%r5TfnU1~TRJii-aj=TfxWx}Zai zcDa0v-21}GArxKoE9&y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FcveVg(YoDqx1(*dpdlsK9h%%wD;Gl&?kE#1ivo_nK@G0kh6?IB(4JNu z*B7Du7Y{WF;`;PwTRAb+l)Rg`dMP;@IGKzZLvpSK%HLZ8s=T)r_}Sh#3}5sHj7RFr zrJyDqodc@o=t9I&FZV}qv#ajW z3d<3J_nF@^GL@MBPs`rPhkm|?bt9X&s*QX-bFPwS=&6NMp zY?|3|x({ubVY2vJrcQD=Dr`KnG1qig;E>lIBAWKjpD{`QKC?HS6sJ6q6gZt!pG`nD z=NzW3n$DTgzIU!iBK53`?_xi3F=~6GQw<{(AR;68LHY2AIiv28>A?F&N`Z$)N+O&E z0{QMk6h+qk1x&QZ%@}B{>3dHzF=nQ)I6u>S=L3ZtU{ diff --git a/tests/wasi_test_resources/snapshot1/fd_pread.out b/tests/wasi_test_resources/snapshot1/fd_pread.out new file mode 100644 index 000000000..c3a1318a9 --- /dev/null +++ b/tests/wasi_test_resources/snapshot1/fd_pread.out @@ -0,0 +1,14 @@ +{ + "output": " POLONIUS\n\n He will come straight. Look you lay home to him:\n\n POLONIUS\n\n He will come straight. Look you lay home to him:\n\nRead the same data? true", + "options": { + "mapdir": [ + [ + ".", + "tests/wasi_test_resources/test_fs/hamlet" + ] + ], + "env": [], + "args": [], + "dir": [] + } +} \ No newline at end of file diff --git a/tests/wasi_test_resources/snapshot1/fd_pread.wasm b/tests/wasi_test_resources/snapshot1/fd_pread.wasm index 486acf21b9eff0421115cf6f3330c315bc0fba8d..c0d9c9466148b8a892b8f5f4cdc5c2fa1257a0d9 100755 GIT binary patch delta 1781 zcmY*aeNa?Y6u;-bd*6HPN3t%vEU@6Rih_=Oh##SaK2jM?Q%o^86p#5~k|9s`79QL18)AhLViq@>12Q#y;iKh$TxXXrRSvUR~GX;&hzE zf#XiDGcG-GoT5=Dr$gc?W3gQKYE)I-RM&L0FB#F)Wz(sK4v>l-hsx8)#W@V|X#nPnPLl&QHFp*VV&?dMqxeWm*p4)_)!#)y5u1l)fnt6+tXggz znOupTU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@C#@1aU1<(QIPUc#UECaX0_S6zDNc=^ zh-fh2k!FTqQRDvNWN~|J;K@q1jPs&XwrB2gp!ST3=Twwq+DI|z)#ZdqT`Kl(lTRu= zSvY{Rf2vn>`nOwX3(kXqG=o*4D$<6zn-Hlgse%*~FNmz<{^B_RO#U@bB2#{|;K#_`Tj<6JV$0&| zz{Tn%DY)LcXy#bO{C%+n0@VW7gc{V_94Q^O@Z5 zt2U{RI$TViTlPLjrA1|p3{Hxk^1Z|6PUnS4aaWIJ!~uqBpDRABXu+Tfm9HT4jmlr9 z0Fy;~7BT?&`B$5$daF7z@GYC!k%xF=hgUf|#^cQu7Z0SP>F$B)h$kKNqa%3GP&>AD z&PG#zXFi&oU6V1En045Li&cjoKrs*}m;~GC)qT`$0(MjPd#cf(vVP*ls=NK|vYYs+ z3I8E5D}ad?z~LgI^C)&hgpVFcA_NQQ*6&t4xR zX51Xe+E9~SxxT7oW%>H@{I~O~)~&56uPRuVn^!VnLJp3qn(X=6Sq*FJ7Oh^D)3{#F z`#IO3w^L-x@7K7EM24*WvnL+pL7Scrz^d$=bWYcY^!(w&+bC6ds62mVVpgx+&PN?g=f MI^;am>4Z%EAFp-48~^|S diff --git a/tests/wasi_test_resources/snapshot1/fd_read.out b/tests/wasi_test_resources/snapshot1/fd_read.out new file mode 100644 index 000000000..832ad65f2 --- /dev/null +++ b/tests/wasi_test_resources/snapshot1/fd_read.out @@ -0,0 +1,14 @@ +{ + "output": "SCENE IV. The Queen's closet.\n\n Enter QUEEN GERTRUDE and POLO", + "options": { + "mapdir": [ + [ + ".", + "tests/wasi_test_resources/test_fs/hamlet" + ] + ], + "env": [], + "args": [], + "dir": [] + } +} \ No newline at end of file diff --git a/tests/wasi_test_resources/snapshot1/fd_read.wasm b/tests/wasi_test_resources/snapshot1/fd_read.wasm index aadd8390604b84e701766013c0fa5a87c4494299..d77985a72b22fdef49b085ef95424ae37c8eacf7 100755 GIT binary patch delta 1894 zcmYjRYfMx}6rMA8=H9zrXjx!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u?72ppAH9sBjLrs=fcV#2@e;^m4#%;DV3EF6x$b$^`lzd*2nOa zi9BfQpzllSAHLs%xctb}(1v1{tyD2 z_FHPjwgb0c>QGSp}%l*#OlsW*e#uQDzRk388UU4IK?C%6URGq z5d5*T3qm`){J@=Ef|z{f$a}6~;On-5Jz$6a(ESHofedy0Ox{2Krs)SkOLz1Pn_Hp1 zuN_m`kp1Aal09*H*D%JCS-M(R5ZZI(7!FzC@hUlqm(NTPmz85H}y&ULPNqf3?B$DD)dXyA6k#zI< zC|Cn7ptYj#g6d=Qg_w@i*2Q;WKfD;gB~^VAxjp0H`14{On4@~sfmHTn1F!2D3B0o> z2L)SJ8mTgM1|C{?LeK$rD%GRL?^FS+LdpZ^Qo9 zAIL_D0eXVDEt^6QXmyB{S+*8RsULyT`xga8(e=K(bq)E;TI;Ho*R<9Yzf@e;w5p+| zZemkmQPreL1sHV=`4#zjEvp(AtXxsBrd3Y9L6&wqONMUu>#oEnPv+kHdLZ@2?zm`A zM#A?1gW~uVd`sgacF;|^v^;jrO$84Z$NU~D8&aXG?`>k>ryxEKzv!VsM5ALHy)^96 ag3rCQiCSWhTa=ZOAXX=4cDT->apu2~S-w30 diff --git a/tests/wasi_test_resources/snapshot1/fd_sync.out b/tests/wasi_test_resources/snapshot1/fd_sync.out new file mode 100644 index 000000000..30f7e2352 --- /dev/null +++ b/tests/wasi_test_resources/snapshot1/fd_sync.out @@ -0,0 +1,14 @@ +{ + "output": "170\n1404\n", + "options": { + "mapdir": [ + [ + ".", + "tests/wasi_test_resources/test_fs/temp" + ] + ], + "env": [], + "args": [], + "dir": [] + } +} \ No newline at end of file diff --git a/tests/wasi_test_resources/snapshot1/fd_sync.wasm b/tests/wasi_test_resources/snapshot1/fd_sync.wasm index 17a22ae638c1d713ff9120ec99051e210e7f250c..2a7408eccd3deef6387178898ce992af87ae60f0 100755 GIT binary patch delta 1985 zcmZ8ieNa?Y6u;-bd*6Goi|hisEX$&=-O*MZTs{P~8uj4-HE4#J1x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Z8m+=SKHa^DLZRXK{BxNMh2D;D1`TM_emxazleP>aqqTh|UwqF2|5BlG;O+r35G^_zDbej(!F$FvUn&cw# z^GmyRHxg)urKcIpVZPZuptMnT$z>(G?ea&H2$?`K)VW;qt#bp!qzcbg!Krv^a1Msr zFnA9p<7eS8NhURTCUL0WkURQQibfOFS6;+|PG1SCg3_+_VkxSj#N4Me!Jw#i>)O^7 zRbhq!(GoF`DslaFl}r2eBe7iAW4R!XJnM1>BPWBNW;=o8Y;);1L5Z%PD^oEti4MX4*a(vElps&6xc5n{ z9c;WE;G#0|7ok*+{@RKuSlyylU(NS#W6QV!k0)i09YCe4V}2jz?uWU=jzcgX!8VgD zav0Q1s+)o}^;hP|l;6IBnLF!eZEC3vZmw>rE_kh=wsA{+b!}l|UVgBsC>K|4{jBA) zW;SnWSoLZscYBLuzklY3A0wv{;A2np;v99HSK_cYZ#%)81 zuqbUg-lf_&4gU+Gt2aLhCPLQKwrdN}(Do0WiD|tIq>T*td@&-4gk110G)Mk+!Q`Zv Ov1;7eJ0%%r=>G%tHnD&J diff --git a/tests/wasi_test_resources/snapshot1/file_metadata.out b/tests/wasi_test_resources/snapshot1/file_metadata.out new file mode 100644 index 000000000..5c1cef48e --- /dev/null +++ b/tests/wasi_test_resources/snapshot1/file_metadata.out @@ -0,0 +1,11 @@ +{ + "output": "is dir: false\nfiletype: false true false\nfile info: 493\n", + "options": { + "mapdir": [], + "env": [], + "args": [], + "dir": [ + "." + ] + } +} \ No newline at end of file diff --git a/tests/wasi_test_resources/snapshot1/file_metadata.wasm b/tests/wasi_test_resources/snapshot1/file_metadata.wasm index 9efe732ab7cd4c79665b5a0cb54ac03333466aea..62e21d30dc550a9880a5d6c481233b4fba1be5b6 100755 GIT binary patch delta 1843 zcmZuxYiv|S6rMA8=H6Sk)o$Bux7%%d=>u9xc|WuY^foD#Xbq1R1PN?Ih_R+ZCF&1i zw-Ag`@v%&FBS@kVQqdHUD>OzDY7k1X6{KwxQh@{%L_%ZY50#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QVzFsOk4 zwpRbyJBe1r`Z!&pFGhA%-&#@TfhWItZ)jiv>GXnYhlksiBW)uc=>2P3Xj8n+H(Ggb?)+3j)*gI^?EXRS zcUxGJJ1k5N&(Qg~h11P{0gF?c+5i9m diff --git a/tests/wasi_test_resources/snapshot1/fs_sandbox_test.out b/tests/wasi_test_resources/snapshot1/fs_sandbox_test.out new file mode 100644 index 000000000..0f024e9ed --- /dev/null +++ b/tests/wasi_test_resources/snapshot1/fs_sandbox_test.out @@ -0,0 +1,9 @@ +{ + "output": "Reading the parent directory was okay? false\n", + "options": { + "mapdir": [], + "env": [], + "args": [], + "dir": [] + } +} \ No newline at end of file diff --git a/tests/wasi_test_resources/snapshot1/fs_sandbox_test.wasm b/tests/wasi_test_resources/snapshot1/fs_sandbox_test.wasm index 33237a18aa6aec51096f33ace49c8426cca097e7..2d871f6a387a49c36dc734075d813d65c7626c9e 100755 GIT binary patch delta 1508 zcmYjRYfKzf6uxKf+?j!8yYFRzT{>Mtvs9r_9zJNSV=L7HZfb%xSktw(O^Q|$sqvR= ztx1!{)@HdH2=;-&iZu;1J4j+!QmPQ}5jE9l)rd)LL}=>|OEfV-JZGVecX!Tw_dLGy z&AF3#b(W`R`409>#{poBK?*_%#uAXE3px`@G6~6qn#9Fu!xB6TF__H4+flqTyaZ)Z zRwosv;z6CLFp>&~+{$w4Mn;PP^xe}@iPDquR(eY)2$^gzH6Ow)ug zRI#i;=MKSx`CL_fnlQXN*EA0|d^*ZNg?ZeWV{l#f2*cp3NH8wDLb*o)X75uMIdFTA zA+WdI=J-PakZq27`^{Bxd=&ed>njBmIqad*n!|b6GhSXvyF-;&33AJZ8MGzUgIODu z3)R%5wWb4yA-}8*1y$zoGn1JRQ?f>lDSnT@P>_c_stnXU0h;}M-2{oMy0?Qmx7I}D zlBLT}>#u^4=QkFkFCK~5zi%u9O!hvol{#;Kq|{Ds+D%WfTyQv>RxigMYFR;#Z9WRZ zzOp%uN%rdvlgnju%f&MB=v7l=CNF0pOKD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_Fyj(+bnKF1JaHBYWQ_He>PHRR*w_{?HYO5TUR4^ za0IE{tgD5R$Su3}5jWt}?`tMP8CR0K9sN(QAGtmUey078k2CF1_u4^Wa;N>d70q%F z|JBJoD;O=s{LttD%mbrbQ$1!|=PF9>)gqDUWDcYOsJNjR)K*px0<;YJY@EGY_a}9*;O4 Hp&9nS64tFl diff --git a/tests/wasi_test_resources/snapshot1/path_link.out b/tests/wasi_test_resources/snapshot1/path_link.out new file mode 100644 index 000000000..c8fc9ef82 --- /dev/null +++ b/tests/wasi_test_resources/snapshot1/path_link.out @@ -0,0 +1,18 @@ +{ + "output": "ACT V\nSCENE I. A churchyard.\n\n Enter two Clowns, with spades,\nACT V\nSCENE I. A churchyard.\n\n Enter two Clowns, with spades,\nPath still exists\n", + "options": { + "mapdir": [ + [ + "act5", + "tests/wasi_test_resources/test_fs/hamlet/act5" + ], + [ + "temp", + "tests/wasi_test_resources/test_fs/temp" + ] + ], + "env": [], + "args": [], + "dir": [] + } +} \ No newline at end of file diff --git a/tests/wasi_test_resources/snapshot1/path_link.wasm b/tests/wasi_test_resources/snapshot1/path_link.wasm index 8c95ec1e483db4e047d854a7b016ea508740ccb4..a8e2489ca57a9ba8dfe10a00c8a3307a44402d07 100755 GIT binary patch delta 1530 zcmYjRZERCj7(Va0=d0@q{kZMAu49)?Nry7ofXp98xdhn~mB6Ai8gZQ;7$zVD;?La$ z6GQ{Xa>M$=7>vZA5<=poTimi_%Y>mBY8Y7@)3|ObnL7MyG=T59t-6!+^m(86<9Xlr zG(9%JE)KA*r2Ei5AcVj%?AD0J!ot+lM^|61t79qIh1J?l|_U_sL zDhZa&U@n(*KZGbKpO}O&P(=5a?bS5q+g0x4G~`gDkKO?il@eGiWuZ0cKgdXkQdtV zq_$q@T#z8#ZO>oD+w3}u_j_FjL3*L=Gk_&t>0X=U#9|g}G{UV$#$tA+$D$cp8R6b1 z-9ZHtZeh=-@hzl-ZANFZr_msl5VX`5veP@*Gq@E+8ZUGjpuE1%j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Gg31GF`-(vQxlY%0s{y zgK93HXGvy>sf>krK@t!q5M+8D5SRt?X~!Zm?Tr<+g7Vg!Oj-J@TmTP$#U$KK@>uSrs-xyLr^H3@{BY-0-9zre zY}L5y6`&Eje}Ft+o23$JcLD9Koe#J3wQcj!_}Z>z|7DO8UoeWY{xs z4DUdddGE#1C=!n$S_}vEPrOCD@m?PM)P?&ehME(@%@NM1?m;zLw+9~9=?PRm3P2us z)Cd_E)YXOu$BEM=A-i~R-3UGqXgO=rZRyf4KCG4#9{MVkuEnY{>3DjaV}D~&9M|g? zyt866Et*1QvGo?^4)2Z~vZ&yx6_V-yhWOHd3eIZz-J(&HJ+c1V1<>mUv1cgODq{8Q gTxMq6kFnUKAiYgBvCo4PNFE|1!^W1LAWb#@0ca7{_5c6? diff --git a/tests/wasi_test_resources/snapshot1/path_symlink.out b/tests/wasi_test_resources/snapshot1/path_symlink.out new file mode 100644 index 000000000..5df1fc3ef --- /dev/null +++ b/tests/wasi_test_resources/snapshot1/path_symlink.out @@ -0,0 +1,18 @@ +{ + "output": "ACT III\nSCENE I. A room in the castle.\n\n Enter KING CLAUDIUS,\n", + "options": { + "mapdir": [ + [ + "temp", + "tests/wasi_test_resources/test_fs/temp" + ], + [ + "hamlet", + "tests/wasi_test_resources/test_fs/hamlet" + ] + ], + "env": [], + "args": [], + "dir": [] + } +} \ No newline at end of file diff --git a/tests/wasi_test_resources/snapshot1/path_symlink.wasm b/tests/wasi_test_resources/snapshot1/path_symlink.wasm index 91f11643cf726aca2fcb57d40d1f4c5d6c855f60..5c12de5292c15b50ce3cf59e3bc53757ae5be320 100755 GIT binary patch delta 1875 zcmXw4du$X%7@u!;W_Pc9$MxDfxIV6K3$0fTeNqrm=r;6$1`z^C0pYNvB@Hc?LTUrC zhZtipRBR@4L_;JR0%8irjT9^f2s8~`d9=hpX(-|CKNNx{24kY%?BOK$?Qg!{?|aSc z=6*lK#9$kK5Aq0Ma%m~Ctgpdf0#UO?o=!&oyF2_S6iUZLdb09t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ests/wasi_test_resources/snapshot1/poll_oneoff.out b/tests/wasi_test_resources/snapshot1/poll_oneoff.out new file mode 100644 index 000000000..1ef6a8f58 --- /dev/null +++ b/tests/wasi_test_resources/snapshot1/poll_oneoff.out @@ -0,0 +1,18 @@ +{ + "output": "__wasi_event_t { userdata: 1193046, error: 0, type_: 1, u: __wasi_event_u { __wasi_event_fd_readwrite_t { nbytes: 2259, flags: 0 } } }\n[__wasi_event_t { userdata: 1193046, error: 0, type_: 1, u: __wasi_event_u { __wasi_event_fd_readwrite_t { nbytes: 2259, flags: 0 } } }, __wasi_event_t { userdata: 1193046, error: 0, type_: 2, u: __wasi_event_u { __wasi_event_fd_readwrite_t { nbytes: 1234, flags: 0 } } }]\nStdin: OK\nStdout: OK\nStderr: OK\n", + "options": { + "mapdir": [ + [ + "hamlet", + "tests/wasi_test_resources/test_fs/hamlet" + ], + [ + "temp", + "tests/wasi_test_resources/test_fs/temp" + ] + ], + "env": [], + "args": [], + "dir": [] + } +} \ No newline at end of file diff --git a/tests/wasi_test_resources/snapshot1/poll_oneoff.wasm b/tests/wasi_test_resources/snapshot1/poll_oneoff.wasm index 5937b2b7f0ad06dc88f7d74e8cdecc1981fd150b..5f29017f4596e54ef9bf1dd39132a3ab1c6c3757 100755 GIT binary patch delta 2020 zcmb7FYitx%6u#%qy))Bnx9!q)yWKuAEw62nK50P+&>`WeM2bL#5W6jHp|$T8im2U2 z14@L1dLwI4B8F$sfN{Vo0+v{8Y%C%r(Zpvh;ZX^+4N4$FJ$JS~;y-V)XU_9G=R0>M zyStyA>t_K{(o_S45cmWV{SY92Li{ukfB+iM>SqBwwukr?TSa%kR`Fp+@ks-%D8poK zptaSm)@(!85)5(MB4a5shlG5pjn>-!j5h+ihLY_m+EZeHw(m(#BF>hQrpn@twN1?> zrPbw*`nu}s;=0=Mx{3-C*5022T6=$-@Pb<`2aiLqC@XGhtZXiqu{co$j`nvvVke9P zUD_QGg{Y|f1hFAcIE@Z@rc-BtDo5xc3KWm3Q``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lQEg z!{6a9jD$(fh{!a^Fk)P8CR|dGM?|>|g9J$_89tn)#V#RCE`?yxQBhnIEV7%-#B_-y z{<#=*Fklv1!jVES;fA-NZ6XXq6d-6*km)f@lSxCErZA;6-OMfBl1#~wiU=tX7%36l z6j%l$>5+06YIYJ3a~Uo}8V2V`$&pjIghZ9x6uLf?%b3ADf(;kUG^OBKhQV}e+~DwY znuurjL~~}K68LZy3zs{~epTcV-LOx~UpSEp6j=5-*Cr3S>?h(sc7tgPjkWWVT1{g1 zDPO7qrYob+&hj6G-0sTQik|KINoP1kshNQsin5ym_2AUi>~dJ<=JaU61GzpOy>#kP z?16$bH79Q>P+KU;emzfN5FocZd*Ok?6rAnU8ErAd>|+n-M66@&gh%&k!)No`b@=BO zT*O|vaG$gL)bx-}*A^<^vrXplGK*Q{=gi`k&_McmY#a;;cMK6SAx`|a+8bvo-{M6i z?RAUua69(#mSg`|EYe zGxhs`!wr7mwos}%(J&onvr*gHLgUp#jX7l4Ya1WO*HL}ll;IW3l9o&tvH8Mp$)La5 z;(i_zC+vjPn{{uy)@>5huEuY8Z^XP}SpuS9>f(lH5xBg0j-EpEwFgoC zYo9C<#O>ZA8#yu6*nS^zwX=OP@X2WzOH3|EMtMgIj>8mAp8K}UuLnuU#i3Lx6dYA=KD(bs= ztu|iQHwLBaHii#FBy1lUm9>@UrG{Z9#0~^-a{i}caQ8q-wO~I^-sp$*q`si!Z|xauT@1BOaokS3or%k| z7yQ+XQ8<&~`tkDyzxx^Ekrv%uRNvp*5NYFp4>#`dQ2}#%AQ+(fAe)6-3C32ZqNjnS z>FVe}ch3=AlFAipR^+bFt!P+Pv!WuuA!l;Qv}xH`6*Yl{fvl!gb&svA%6@9i z!5`@|{ZF4mH#p^{(z({;3G{9fi>v`Gioh2AvUOJLr7|qAndW L9(pB%GR=Pgbgks8 diff --git a/tests/wasi_test_resources/snapshot1/quine.out b/tests/wasi_test_resources/snapshot1/quine.out new file mode 100644 index 000000000..13bb98897 --- /dev/null +++ b/tests/wasi_test_resources/snapshot1/quine.out @@ -0,0 +1,11 @@ +{ + "output": "// WASI:\n// dir: .\n\nuse std::fs;\nuse std::io::Read;\n\nfn main() {\n let mut this_file =\n fs::File::open(\"tests/wasi_test_resources/quine.rs\").expect(\"could not find src file\");\n let md = this_file.metadata().unwrap();\n let mut in_str = String::new();\n this_file.read_to_string(&mut in_str).unwrap();\n println!(\"{}\", in_str);\n}\n\n", + "options": { + "mapdir": [], + "env": [], + "args": [], + "dir": [ + "." + ] + } +} \ No newline at end of file diff --git a/tests/wasi_test_resources/snapshot1/quine.wasm b/tests/wasi_test_resources/snapshot1/quine.wasm index aa997256217b1747d2efac37650950a5ef9163ae..b42142f10dab4dc71b216485e5155513510f3bd1 100755 GIT binary patch delta 1852 zcmZWqZEO@p7@l`_W_ONl>0R4vugCSey+S!KrIgP|0^9=904Z7{g#yMS0x^xX7!r*? z=v7b@Bf@2n!ylmGLsV+@x;528ViUv<8l(latwBPeCTgN2rWzn%eP^$r#!33_v(G&5 z=geOFj<7pNSPj{*wGjv*Z~}sHLgJ7hahga#0ueOFSpt{KkhtbTq!TX0hr5eUk5VO? zo0G9}sx>D!1SgM$A#pOMR*~;|+|58p^0jgRSqc-9y*d~O3X{M2fGQvhVP!HIklVmJ zMjQh_2zToO|KVbw&ZXVDG z9RGw66gc7egmZ&KE+EM@gXdDl88aB8eggq#Ix8?$3Z@I8^IS+!bVRjBaU53x)w6W& z_h%Ox;Ks&k3}X0=0wIh*p1^dNN7p$QjH5H%f z5<7RY{MWH+=XT*MI0fgWqVp6qxjIw@nzJj^gq*xtycu`m;VdO+EGb2~+*5k`UhMfu zw?#hqCz+6ywFUBx^0oIQF5^^AE<}-2J@un3%ztOjfQpn}Uhdq!|FGJ4bN**4-^PWP z(Jqd)xi%v6?M;ZB&t`@bJ9c{2^lxF$3lV0~S z!&2tOpVisljfqjeTXsx4iH)P?i|hy(35ZmexLmB;3e8l*ZpW+L@d z#{w-Zh#7JZDqxSk-%afC7TBQ%>`Ij?oFyOM!jDld>?%h4XqS~MNH$oSY8|^%8Y=g6 zmEoq-^$EsrJQ+Z|^Q6S96g;)xz?bytB7EsNy-N?EGYz`F+|o?@!1itx2SYr0R)yGm z_ALxi)l-CcMbB*XdcJ2E!j$BgHYueRDAF#EoyrkCKA)USYOrt&&k&rb&T1a{DwY>~z!*Xd390AY-Rg_y;mmiwbLRZa z+&d4Cs_REp4LsMUq>%aqW& zNXu76*93ZXD*Om~O=mbsoGvSQkvw}!@;Kl?X&HsFJaGgV!X`E-4afi*Tr<#5BE!;lF4wF6-+wbayx_RXx zl*aq4;e$N4igR5C)f}=B-qC)#o~U0=&m(H=nI~llLLltkP$)Y5YhY;Pq#A$A&7L7DB=*d~jgCYtN#%;ejdyQ+1}!me8Moi?i@PP}_}yE|!%q*1dGFr$V=urKPz*NEZfh@9Z6+oIS#)XjhJE8z~6!90Ogw0j#qB0Ux@X@c;k- diff --git a/tests/wasi_test_resources/snapshot1/readlink.out b/tests/wasi_test_resources/snapshot1/readlink.out new file mode 100644 index 000000000..b972f8e02 --- /dev/null +++ b/tests/wasi_test_resources/snapshot1/readlink.out @@ -0,0 +1,14 @@ +{ + "output": "../act1/scene2.txt\nSCENE II. A room of state in the castle.\n\n Enter KING CLAUDIUS, QUEEN GERTRUDE, HAMLET, POLONIUS, LAERTES, VOLTIMAND, CORNELI\n", + "options": { + "mapdir": [ + [ + ".", + "tests/wasi_test_resources/test_fs/hamlet" + ] + ], + "env": [], + "args": [], + "dir": [] + } +} \ No newline at end of file diff --git a/tests/wasi_test_resources/snapshot1/readlink.wasm b/tests/wasi_test_resources/snapshot1/readlink.wasm index f1a1e9952dd484c31bd1b7d67943e9ee2f383668..1d6c523eff42bfa3b4ec9435a1289f831b087b34 100755 GIT binary patch delta 2034 zcmZuydrTBZ7@u!;W_Qm6z2i7I;J^jMoVEypSSyXV_&{wfpe;ru;S>%lk%!`gqzPC0 zu-4c{vsSE$RccI)t=2FaM4Kw2F|{UEqeYVj5H)J8X{;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snapshot1/writing.out b/tests/wasi_test_resources/snapshot1/writing.out new file mode 100644 index 000000000..aa3a006f9 --- /dev/null +++ b/tests/wasi_test_resources/snapshot1/writing.out @@ -0,0 +1,22 @@ +{ + "output": "abcdefghijklmnopqrstuvwxyz\nfile is gone\n", + "options": { + "mapdir": [ + [ + "act1", + "tests/wasi_test_resources/test_fs/hamlet/act1" + ], + [ + "act2", + "tests/wasi_test_resources/test_fs/hamlet/act2" + ], + [ + "act1-again", + "tests/wasi_test_resources/test_fs/hamlet/act1" + ] + ], + "env": [], + "args": [], + "dir": [] + } +} \ No newline at end of file diff --git a/tests/wasi_test_resources/snapshot1/writing.wasm b/tests/wasi_test_resources/snapshot1/writing.wasm index d1c9e04e034f557eb12470eab53c9fc6625873e3..a4065019c87ec15debbbcac87ddfab9f292fe97a 100755 GIT binary patch delta 2021 zcmZuwe@sHRskUdK7rI~2$O0;s%bb3VLU)fH4Edi8B(p-5b3ZD@nu`_&83&* z<808_R>%Wgnq6Zsrg3#` zQ*)@f>ZRIdVrLS!!5g!S3Dh0S9(L5$zr1{PLw(FmxdXQWlHBejoFD}!^=KL)ZcgJA zMbW9fMqZ3EN{LE{&N({c($LKD(RG~?4%`ErYn-?Vl3dZan=(~p%&WN>qsba)jI*%H zd`?v*Ox1PO!`*~pEKyMqGc%6MN7V$?&6AV8W4s!%6|gc5v}Dbv>zY4FM^RK$RnB$B zF`jZ1)Mx^y@hOzCWUl)(s;Ws;*K`ewM31pFF;1tN#>UDBow{PJQEF8wV*qwr_3SbL z5utL!TA_L=fVEa%r~*iy9vV=3mb_t8j4N`TWq#e1)j2?NYoY{wa(X4&;o++HAwTQaQg4UMO zH2NeX4nHx70lAbI)KDZ~xiry*2G6J=MtWTQ|GoV#CjOXR4yrYK&Jo$_*r%Ihh23T2 z#hz!Pz{MN$((x>dKRPcD(DC>ArLwxODzmM{&(+Azy32OjE?e!rNaQb&gK&6)V%LHl zz^&qimTYyX;#e&3hV2&=#}}{R0x`NE%ZEK6HnA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rAkZU8S~cejP!ZR~Mpu>o z^2;qXg1CO@^CnJAeRaH)xccMxbl^a1&?s7GTA;R`EC#jzWCd{l$uJc8r@Y1^)cyph z7usilI@&%LvD9#9J`VQjn|KcubrnF4?{fT{WsoBrW}Y4%UAm8{C0)f(KHv2v0!`@- z06*HTi0NOu54iGRFC7bgpvyq`_J}YbKg2VAOz-{a4ZHy?gXbpVS&s0Azi8?-u@QFi zSrfMU?7=+7GFYzhn;PzG>%~2!vRMNu!7_2_*$7t2* zeltgLF)oq%gWukRoHh`&lXFt12FgI}9+(Wv69eXf3=fP4_6(K)PZ=!E=gjLJhZh3l zK`k6*=GS2W$?moc?uGHK!Re4whRPFooZ2~*1Lp%n2(7z^#&P7obor1OK+~0Ha*&xN zryaa!*8g6a0XsEu_(*CT;?6k8$MxXwRt!s5|Ji6})^oKG^6#tfK<>I09FG!%^dNJ4 z9SV=owlJ&oIy{_NHvy%;yE3G|zSf?`|0>kGZVX8mzIJBmO}D?zqQ3ZaA05t5QfveZ z-&wPEn$LM+#jpG5e%cr>^3&8i&hZs~svPsAG#}g4!e2siwYB;wn`mPE$1KXb>u@!T Y-l84xm$RubGi4Y_?X2x^HkH}`167mGvH$=8 diff --git a/tests/wasi_test_resources/unstable/close_preopen_fd.out b/tests/wasi_test_resources/unstable/close_preopen_fd.out new file mode 100644 index 000000000..6d18d7b1a --- /dev/null +++ b/tests/wasi_test_resources/unstable/close_preopen_fd.out @@ -0,0 +1,14 @@ +{ + "output": "accessing preopen fd was a success\nClosing preopen fd was a success\naccessing closed preopen fd was an EBADF error: true\n", + "options": { + "mapdir": [ + [ + "hamlet", + "tests/wasi_test_resources/test_fs/hamlet" + ] + ], + "env": [], + "args": [], + "dir": [] + } +} \ No newline at end of file diff --git a/tests/wasi_test_resources/unstable/create_dir.out b/tests/wasi_test_resources/unstable/create_dir.out new file mode 100644 index 000000000..18902fcf9 --- /dev/null +++ b/tests/wasi_test_resources/unstable/create_dir.out @@ -0,0 +1,11 @@ +{ + "output": "Test file exists: false\nDir exists: false\nDir exists: false\nDir exists: false\nSuccess\n", + "options": { + "mapdir": [], + "env": [], + "args": [], + "dir": [ + "." + ] + } +} \ No newline at end of file diff --git a/tests/wasi_test_resources/unstable/envvar.out b/tests/wasi_test_resources/unstable/envvar.out new file mode 100644 index 000000000..d1fb3bf3f --- /dev/null +++ b/tests/wasi_test_resources/unstable/envvar.out @@ -0,0 +1,18 @@ +{ + "output": "Env vars:\nCAT=2\nDOG=1\nDOG Ok(\"1\")\nDOG_TYPE Err(NotPresent)\nSET VAR Ok(\"HELLO\")\n", + "options": { + "mapdir": [], + "env": [ + [ + "DOG", + "1" + ], + [ + "CAT", + "2" + ] + ], + "args": [], + "dir": [] + } +} \ No newline at end of file diff --git a/tests/wasi_test_resources/unstable/fd_allocate.out b/tests/wasi_test_resources/unstable/fd_allocate.out new file mode 100644 index 000000000..289e661d0 --- /dev/null +++ b/tests/wasi_test_resources/unstable/fd_allocate.out @@ -0,0 +1,14 @@ +{ + "output": "171\n1405\n", + "options": { + "mapdir": [ + [ + ".", + "tests/wasi_test_resources/test_fs/temp" + ] + ], + "env": [], + "args": [], + "dir": [] + } +} \ No newline at end of file diff --git a/tests/wasi_test_resources/unstable/fd_append.out b/tests/wasi_test_resources/unstable/fd_append.out new file mode 100644 index 000000000..8096400be --- /dev/null +++ b/tests/wasi_test_resources/unstable/fd_append.out @@ -0,0 +1,14 @@ +{ + "output": "\"Hello, world!\\nGoodbye, world!\\n\"\n", + "options": { + "mapdir": [ + [ + ".", + "tests/wasi_test_resources/test_fs/temp" + ] + ], + "env": [], + "args": [], + "dir": [] + } +} \ No newline at end of file diff --git a/tests/wasi_test_resources/unstable/fd_close.out b/tests/wasi_test_resources/unstable/fd_close.out new file mode 100644 index 000000000..a2b472bb0 --- /dev/null +++ b/tests/wasi_test_resources/unstable/fd_close.out @@ -0,0 +1,14 @@ +{ + "output": "Successfully closed file!\nSuccessfully closed stderr!\nSuccessfully closed stdin!\n", + "options": { + "mapdir": [ + [ + ".", + "tests/wasi_test_resources/test_fs/hamlet" + ] + ], + "env": [], + "args": [], + "dir": [] + } +} \ No newline at end of file diff --git a/tests/wasi_test_resources/unstable/fd_pread.out b/tests/wasi_test_resources/unstable/fd_pread.out new file mode 100644 index 000000000..c3a1318a9 --- /dev/null +++ b/tests/wasi_test_resources/unstable/fd_pread.out @@ -0,0 +1,14 @@ +{ + "output": " POLONIUS\n\n He will come straight. Look you lay home to him:\n\n POLONIUS\n\n He will come straight. Look you lay home to him:\n\nRead the same data? true", + "options": { + "mapdir": [ + [ + ".", + "tests/wasi_test_resources/test_fs/hamlet" + ] + ], + "env": [], + "args": [], + "dir": [] + } +} \ No newline at end of file diff --git a/tests/wasi_test_resources/unstable/fd_read.out b/tests/wasi_test_resources/unstable/fd_read.out new file mode 100644 index 000000000..832ad65f2 --- /dev/null +++ b/tests/wasi_test_resources/unstable/fd_read.out @@ -0,0 +1,14 @@ +{ + "output": "SCENE IV. The Queen's closet.\n\n Enter QUEEN GERTRUDE and POLO", + "options": { + "mapdir": [ + [ + ".", + "tests/wasi_test_resources/test_fs/hamlet" + ] + ], + "env": [], + "args": [], + "dir": [] + } +} \ No newline at end of file diff --git a/tests/wasi_test_resources/unstable/fd_sync.out b/tests/wasi_test_resources/unstable/fd_sync.out new file mode 100644 index 000000000..30f7e2352 --- /dev/null +++ b/tests/wasi_test_resources/unstable/fd_sync.out @@ -0,0 +1,14 @@ +{ + "output": "170\n1404\n", + "options": { + "mapdir": [ + [ + ".", + "tests/wasi_test_resources/test_fs/temp" + ] + ], + "env": [], + "args": [], + "dir": [] + } +} \ No newline at end of file diff --git a/tests/wasi_test_resources/unstable/file_metadata.out b/tests/wasi_test_resources/unstable/file_metadata.out new file mode 100644 index 000000000..5c1cef48e --- /dev/null +++ b/tests/wasi_test_resources/unstable/file_metadata.out @@ -0,0 +1,11 @@ +{ + "output": "is dir: false\nfiletype: false true false\nfile info: 493\n", + "options": { + "mapdir": [], + "env": [], + "args": [], + "dir": [ + "." + ] + } +} \ No newline at end of file diff --git a/tests/wasi_test_resources/unstable/fs_sandbox_test.out b/tests/wasi_test_resources/unstable/fs_sandbox_test.out new file mode 100644 index 000000000..0f024e9ed --- /dev/null +++ b/tests/wasi_test_resources/unstable/fs_sandbox_test.out @@ -0,0 +1,9 @@ +{ + "output": "Reading the parent directory was okay? false\n", + "options": { + "mapdir": [], + "env": [], + "args": [], + "dir": [] + } +} \ No newline at end of file diff --git a/tests/wasi_test_resources/unstable/fseek.out b/tests/wasi_test_resources/unstable/fseek.out new file mode 100644 index 000000000..cb64df644 --- /dev/null +++ b/tests/wasi_test_resources/unstable/fseek.out @@ -0,0 +1,14 @@ +{ + "output": "SCENE III. A room in Polonius' h\nouse.\n\n Enter LAERTES and OPH\n And, sister, as the winds gi\nr talk with the Lord Hamlet.\n \nuits,\n Breathing like sanctif\nis is for all:\n I would not, \n", + "options": { + "mapdir": [ + [ + ".", + "tests/wasi_test_resources/test_fs/hamlet" + ] + ], + "env": [], + "args": [], + "dir": [] + } +} \ No newline at end of file diff --git a/tests/wasi_test_resources/unstable/hello.out b/tests/wasi_test_resources/unstable/hello.out new file mode 100644 index 000000000..42d761059 --- /dev/null +++ b/tests/wasi_test_resources/unstable/hello.out @@ -0,0 +1,9 @@ +{ + "output": "Hello, world!\n", + "options": { + "mapdir": [], + "env": [], + "args": [], + "dir": [] + } +} \ No newline at end of file diff --git a/tests/wasi_test_resources/unstable/isatty.out b/tests/wasi_test_resources/unstable/isatty.out new file mode 100644 index 000000000..fde7e8671 --- /dev/null +++ b/tests/wasi_test_resources/unstable/isatty.out @@ -0,0 +1,9 @@ +{ + "output": "stdin: 1\nstdout: 1\nstderr: 1\n", + "options": { + "mapdir": [], + "env": [], + "args": [], + "dir": [] + } +} \ No newline at end of file diff --git a/tests/wasi_test_resources/unstable/mapdir.out b/tests/wasi_test_resources/unstable/mapdir.out new file mode 100644 index 000000000..b46164a50 --- /dev/null +++ b/tests/wasi_test_resources/unstable/mapdir.out @@ -0,0 +1,14 @@ +{ + "output": "\"./README.md\"\n\"./act1\"\n\"./act2\"\n\"./act3\"\n\"./act4\"\n\"./act5\"\n\"./bookmarks\"\n", + "options": { + "mapdir": [ + [ + ".", + "tests/wasi_test_resources/test_fs/hamlet" + ] + ], + "env": [], + "args": [], + "dir": [] + } +} \ No newline at end of file diff --git a/tests/wasi_test_resources/unstable/path_link.out b/tests/wasi_test_resources/unstable/path_link.out new file mode 100644 index 000000000..c8fc9ef82 --- /dev/null +++ b/tests/wasi_test_resources/unstable/path_link.out @@ -0,0 +1,18 @@ +{ + "output": "ACT V\nSCENE I. A churchyard.\n\n Enter two Clowns, with spades,\nACT V\nSCENE I. A churchyard.\n\n Enter two Clowns, with spades,\nPath still exists\n", + "options": { + "mapdir": [ + [ + "act5", + "tests/wasi_test_resources/test_fs/hamlet/act5" + ], + [ + "temp", + "tests/wasi_test_resources/test_fs/temp" + ] + ], + "env": [], + "args": [], + "dir": [] + } +} \ No newline at end of file diff --git a/tests/wasi_test_resources/unstable/path_rename.out b/tests/wasi_test_resources/unstable/path_rename.out new file mode 100644 index 000000000..de75f0df8 --- /dev/null +++ b/tests/wasi_test_resources/unstable/path_rename.out @@ -0,0 +1,14 @@ +{ + "output": "The original file does not still exist!\n柴犬\n", + "options": { + "mapdir": [ + [ + "temp", + "tests/wasi_test_resources/test_fs/temp" + ] + ], + "env": [], + "args": [], + "dir": [] + } +} \ No newline at end of file diff --git a/tests/wasi_test_resources/unstable/path_symlink.out b/tests/wasi_test_resources/unstable/path_symlink.out new file mode 100644 index 000000000..5df1fc3ef --- /dev/null +++ b/tests/wasi_test_resources/unstable/path_symlink.out @@ -0,0 +1,18 @@ +{ + "output": "ACT III\nSCENE I. A room in the castle.\n\n Enter KING CLAUDIUS,\n", + "options": { + "mapdir": [ + [ + "temp", + "tests/wasi_test_resources/test_fs/temp" + ], + [ + "hamlet", + "tests/wasi_test_resources/test_fs/hamlet" + ] + ], + "env": [], + "args": [], + "dir": [] + } +} \ No newline at end of file diff --git a/tests/wasi_test_resources/unstable/poll_oneoff.out b/tests/wasi_test_resources/unstable/poll_oneoff.out new file mode 100644 index 000000000..1ef6a8f58 --- /dev/null +++ b/tests/wasi_test_resources/unstable/poll_oneoff.out @@ -0,0 +1,18 @@ +{ + "output": "__wasi_event_t { userdata: 1193046, error: 0, type_: 1, u: __wasi_event_u { __wasi_event_fd_readwrite_t { nbytes: 2259, flags: 0 } } }\n[__wasi_event_t { userdata: 1193046, error: 0, type_: 1, u: __wasi_event_u { __wasi_event_fd_readwrite_t { nbytes: 2259, flags: 0 } } }, __wasi_event_t { userdata: 1193046, error: 0, type_: 2, u: __wasi_event_u { __wasi_event_fd_readwrite_t { nbytes: 1234, flags: 0 } } }]\nStdin: OK\nStdout: OK\nStderr: OK\n", + "options": { + "mapdir": [ + [ + "hamlet", + "tests/wasi_test_resources/test_fs/hamlet" + ], + [ + "temp", + "tests/wasi_test_resources/test_fs/temp" + ] + ], + "env": [], + "args": [], + "dir": [] + } +} \ No newline at end of file diff --git a/tests/wasi_test_resources/unstable/quine.out b/tests/wasi_test_resources/unstable/quine.out new file mode 100644 index 000000000..13bb98897 --- /dev/null +++ b/tests/wasi_test_resources/unstable/quine.out @@ -0,0 +1,11 @@ +{ + "output": "// WASI:\n// dir: .\n\nuse std::fs;\nuse std::io::Read;\n\nfn main() {\n let mut this_file =\n fs::File::open(\"tests/wasi_test_resources/quine.rs\").expect(\"could not find src file\");\n let md = this_file.metadata().unwrap();\n let mut in_str = String::new();\n this_file.read_to_string(&mut in_str).unwrap();\n println!(\"{}\", in_str);\n}\n\n", + "options": { + "mapdir": [], + "env": [], + "args": [], + "dir": [ + "." + ] + } +} \ No newline at end of file diff --git a/tests/wasi_test_resources/unstable/readlink.out b/tests/wasi_test_resources/unstable/readlink.out new file mode 100644 index 000000000..b972f8e02 --- /dev/null +++ b/tests/wasi_test_resources/unstable/readlink.out @@ -0,0 +1,14 @@ +{ + "output": "../act1/scene2.txt\nSCENE II. A room of state in the castle.\n\n Enter KING CLAUDIUS, QUEEN GERTRUDE, HAMLET, POLONIUS, LAERTES, VOLTIMAND, CORNELI\n", + "options": { + "mapdir": [ + [ + ".", + "tests/wasi_test_resources/test_fs/hamlet" + ] + ], + "env": [], + "args": [], + "dir": [] + } +} \ No newline at end of file diff --git a/tests/wasi_test_resources/unstable/wasi_sees_virtual_root.out b/tests/wasi_test_resources/unstable/wasi_sees_virtual_root.out new file mode 100644 index 000000000..b894d9af4 --- /dev/null +++ b/tests/wasi_test_resources/unstable/wasi_sees_virtual_root.out @@ -0,0 +1,22 @@ +{ + "output": "\"/act1\"\n\"/act1-again\"\n\"/act2\"\n\"/act1\"\n\"/act1-again\"\n\"/act2\"\n\"/act1\"\n\"/act1-again\"\n\"/act2\"\n\"/act1\"\n\"/act1-again\"\n\"/act2\"\nROOT IS SAFE\n", + "options": { + "mapdir": [ + [ + "act1", + "tests/wasi_test_resources/test_fs/hamlet/act1" + ], + [ + "act2", + "tests/wasi_test_resources/test_fs/hamlet/act2" + ], + [ + "act1-again", + "tests/wasi_test_resources/test_fs/hamlet/act1" + ] + ], + "env": [], + "args": [], + "dir": [] + } +} \ No newline at end of file diff --git a/tests/wasi_test_resources/unstable/writing.out b/tests/wasi_test_resources/unstable/writing.out new file mode 100644 index 000000000..aa3a006f9 --- /dev/null +++ b/tests/wasi_test_resources/unstable/writing.out @@ -0,0 +1,22 @@ +{ + "output": "abcdefghijklmnopqrstuvwxyz\nfile is gone\n", + "options": { + "mapdir": [ + [ + "act1", + "tests/wasi_test_resources/test_fs/hamlet/act1" + ], + [ + "act2", + "tests/wasi_test_resources/test_fs/hamlet/act2" + ], + [ + "act1-again", + "tests/wasi_test_resources/test_fs/hamlet/act1" + ] + ], + "env": [], + "args": [], + "dir": [] + } +} \ No newline at end of file diff --git a/tests/wasi_test_resources/wasi_sees_virtual_root.out b/tests/wasi_test_resources/wasi_sees_virtual_root.out deleted file mode 100644 index f9e5ca114..000000000 --- a/tests/wasi_test_resources/wasi_sees_virtual_root.out +++ /dev/null @@ -1,13 +0,0 @@ -"/act1" -"/act1-again" -"/act2" -"/act1" -"/act1-again" -"/act2" -"/act1" -"/act1-again" -"/act2" -"/act1" -"/act1-again" -"/act2" -ROOT IS SAFE diff --git a/tests/wasi_test_resources/wasi_sees_virtual_root.rs b/tests/wasi_test_resources/wasi_sees_virtual_root.rs index bbbac4354..7a2188903 100644 --- a/tests/wasi_test_resources/wasi_sees_virtual_root.rs +++ b/tests/wasi_test_resources/wasi_sees_virtual_root.rs @@ -1,4 +1,4 @@ -// Args: +// WASI: // mapdir: act1:tests/wasi_test_resources/test_fs/hamlet/act1 // mapdir: act2:tests/wasi_test_resources/test_fs/hamlet/act2 // mapdir: act1-again:tests/wasi_test_resources/test_fs/hamlet/act1 diff --git a/tests/wasi_test_resources/writing.out b/tests/wasi_test_resources/writing.out deleted file mode 100644 index a471ade37..000000000 --- a/tests/wasi_test_resources/writing.out +++ /dev/null @@ -1,2 +0,0 @@ -abcdefghijklmnopqrstuvwxyz -file is gone diff --git a/tests/wasi_test_resources/writing.rs b/tests/wasi_test_resources/writing.rs index 846df14af..60efb9cff 100644 --- a/tests/wasi_test_resources/writing.rs +++ b/tests/wasi_test_resources/writing.rs @@ -1,4 +1,4 @@ -// Args: +// WASI: // mapdir: act1:tests/wasi_test_resources/test_fs/hamlet/act1 // mapdir: act2:tests/wasi_test_resources/test_fs/hamlet/act2 // mapdir: act1-again:tests/wasi_test_resources/test_fs/hamlet/act1 diff --git a/tests/wasitest.rs b/tests/wasitest.rs index ec5d6a311..03da5757c 100644 --- a/tests/wasitest.rs +++ b/tests/wasitest.rs @@ -1,2 +1,109 @@ -pub mod utils; -mod wasitests; +mod utils; +use crate::utils::stdio::StdioCapturer; +use serde::{Deserialize, Serialize}; +use wasmer::compiler::{compile_with, compiler_for_backend, Backend}; +use wasmer::Func; +use wasmer_wasi::state::WasiState; +use wasmer_wasi::{generate_import_object_from_state, get_wasi_version}; + +use lazy_static::lazy_static; +use std::sync::Mutex; +lazy_static! { + // We want to run wasi tests one by one + // Based from: https://stackoverflow.com/questions/51694017/how-can-i-avoid-running-some-tests-in-parallel + static ref WASI_LOCK: Mutex<()> = Mutex::new(()); +} + +/// This is the structure of the `.out` file +#[derive(Debug, Default, Serialize, Deserialize)] +pub struct WasiTest { + /// The program expected output + pub output: String, + /// The program options + pub options: WasiOptions, +} + +/// The options provied when executed a WASI Wasm program +#[derive(Debug, Default, Serialize, Deserialize)] +pub struct WasiOptions { + /// Mapped pre-opened dirs + pub mapdir: Vec<(String, String)>, + /// Environment vars + pub env: Vec<(String, String)>, + /// Program arguments + pub args: Vec, + /// Pre-opened directories + pub dir: Vec, +} + +// The generated tests (from build.rs) look like: +// #[cfg(test)] +// mod singlepass { +// mod wasi { +// #[test] +// fn hello() -> anyhow::Result<()> { +// crate::run_wasi( +// "tests/wasi_test_resources/snapshot1/hello.wasm", +// "tests/wasi_test_resources/snapshot1/hello.out", +// "singlepass" +// ) +// } +// } +// } +include!(concat!(env!("OUT_DIR"), "/generated_wasitests.rs")); + +fn run_wasi( + wasm_program_path: &str, + wasi_json_test_path: &str, + backend: &str, +) -> anyhow::Result<()> { + let _shared = WASI_LOCK.lock().unwrap_or_else(|e| e.into_inner()); + + let backend = utils::get_backend_from_str(backend)?; + + let wasi_json_test = std::fs::read(wasi_json_test_path)?; + let wasitest: WasiTest = serde_json::from_slice(&wasi_json_test)?; + + 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 wasi_version = get_wasi_version(&module, true).expect("WASI module"); + // println!("Executing WASI: {:?}", wasitest); + let mut state_builder = WasiState::new(""); + let wasi_state = state_builder + .envs(wasitest.options.env) + .args(wasitest.options.args) + .preopen_dirs(wasitest.options.dir)? + .map_dirs(wasitest.options.mapdir)? + .build()?; + + let import_object = generate_import_object_from_state(wasi_state, wasi_version); + + let 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(); + + let start: Func<(), ()> = instance + .exports + .get("_start") + .map_err(|e| format!("{:?}", e)) + .expect("start function in wasi module"); + + start.call().expect("execute the wasm"); + + let output = capturer.end().unwrap().0; + let expected_output = wasitest.output; + + assert!( + output.contains(&expected_output), + "Output: `{}` does not contain expected output: `{}`", + output, + expected_output + ); + + Ok(()) +} diff --git a/tests/wasitests/README.md b/tests/wasitests/README.md deleted file mode 100644 index 921f50c86..000000000 --- a/tests/wasitests/README.md +++ /dev/null @@ -1,5 +0,0 @@ -Most of the files here are generated. - -`_common.rs` is a file containing a macro that the generated tests use to avoid code duplication. - -If you want to add new features, edit `_common.rs` to change the macro or `tests/generate-wasi-tests` to change anything else. diff --git a/tests/wasitests/_common.rs b/tests/wasitests/_common.rs deleted file mode 100644 index bd11a407b..000000000 --- a/tests/wasitests/_common.rs +++ /dev/null @@ -1,80 +0,0 @@ -use std::env; -use wasmer::compiler::Backend; - -pub fn get_backend() -> Option { - #[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_wasi_output { - ($file:expr, $name:expr, $po_dir_args: expr, $mapdir_args:expr, $envvar_args:expr, $expected:expr) => {{ - use crate::utils::stdio::StdioCapturer; - use wasmer::Func; - use wasmer_wasi::{generate_import_object_for_version, get_wasi_version}; - - let wasm_bytes = include_bytes!($file); - let backend = $crate::wasitests::_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 wasi_version = get_wasi_version(&module, true).expect("WASI module"); - - let import_object = generate_import_object_for_version( - wasi_version, - vec![$name.into()], - vec![], - $po_dir_args, - $mapdir_args, - ); - - let 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(); - - let start: Func<(), ()> = instance - .exports - .get("_start") - .map_err(|e| format!("{:?}", e)) - .expect("start function in wasi module"); - - start.call().expect("execute the wasm"); - - 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 - ); - }}; -} diff --git a/tests/wasitests/mod.rs b/tests/wasitests/mod.rs deleted file mode 100644 index e3fafa621..000000000 --- a/tests/wasitests/mod.rs +++ /dev/null @@ -1,53 +0,0 @@ -// !!! THIS IS A GENERATED FILE !!! -// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME -// Files autogenerated with cargo build. - -// The _common module is not autogenerated. It provides common macros for the wasitests -#[macro_use] -mod _common; -mod snapshot1_close_preopen_fd; -mod snapshot1_create_dir; -mod snapshot1_envvar; -mod snapshot1_fd_allocate; -mod snapshot1_fd_append; -mod snapshot1_fd_close; -mod snapshot1_fd_pread; -mod snapshot1_fd_read; -mod snapshot1_fd_sync; -mod snapshot1_file_metadata; -mod snapshot1_fs_sandbox_test; -mod snapshot1_fseek; -mod snapshot1_hello; -mod snapshot1_isatty; -mod snapshot1_mapdir; -mod snapshot1_path_link; -mod snapshot1_path_rename; -mod snapshot1_path_symlink; -mod snapshot1_poll_oneoff; -mod snapshot1_quine; -mod snapshot1_readlink; -mod snapshot1_wasi_sees_virtual_root; -mod snapshot1_writing; -mod unstable_close_preopen_fd; -mod unstable_create_dir; -mod unstable_envvar; -mod unstable_fd_allocate; -mod unstable_fd_append; -mod unstable_fd_close; -mod unstable_fd_pread; -mod unstable_fd_read; -mod unstable_fd_sync; -mod unstable_file_metadata; -mod unstable_fs_sandbox_test; -mod unstable_fseek; -mod unstable_hello; -mod unstable_isatty; -mod unstable_mapdir; -mod unstable_path_link; -mod unstable_path_rename; -mod unstable_path_symlink; -mod unstable_poll_oneoff; -mod unstable_quine; -mod unstable_readlink; -mod unstable_wasi_sees_virtual_root; -mod unstable_writing; diff --git a/tests/wasitests/snapshot1_close_preopen_fd.rs b/tests/wasitests/snapshot1_close_preopen_fd.rs deleted file mode 100644 index 232d4ec0b..000000000 --- a/tests/wasitests/snapshot1_close_preopen_fd.rs +++ /dev/null @@ -1,19 +0,0 @@ -// !!! THIS IS A GENERATED FILE !!! -// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME -// Files autogenerated with cargo build. - -#[test] -#[ignore] -fn test_snapshot1_close_preopen_fd() { - assert_wasi_output!( - "../wasi_test_resources/snapshot1/close_preopen_fd.wasm", - "snapshot1_close_preopen_fd", - vec![], - vec![( - "hamlet".to_string(), - ::std::path::PathBuf::from("tests/wasi_test_resources/test_fs/hamlet") - ),], - vec![], - "../wasi_test_resources/close_preopen_fd.out" - ); -} diff --git a/tests/wasitests/snapshot1_create_dir.rs b/tests/wasitests/snapshot1_create_dir.rs deleted file mode 100644 index bb665e296..000000000 --- a/tests/wasitests/snapshot1_create_dir.rs +++ /dev/null @@ -1,15 +0,0 @@ -// !!! THIS IS A GENERATED FILE !!! -// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME -// Files autogenerated with cargo build. - -#[test] -fn test_snapshot1_create_dir() { - assert_wasi_output!( - "../wasi_test_resources/snapshot1/create_dir.wasm", - "snapshot1_create_dir", - vec![std::path::PathBuf::from("."),], - vec![], - vec![], - "../wasi_test_resources/create_dir.out" - ); -} diff --git a/tests/wasitests/snapshot1_envvar.rs b/tests/wasitests/snapshot1_envvar.rs deleted file mode 100644 index cecf52017..000000000 --- a/tests/wasitests/snapshot1_envvar.rs +++ /dev/null @@ -1,15 +0,0 @@ -// !!! THIS IS A GENERATED FILE !!! -// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME -// Files autogenerated with cargo build. - -#[test] -fn test_snapshot1_envvar() { - assert_wasi_output!( - "../wasi_test_resources/snapshot1/envvar.wasm", - "snapshot1_envvar", - vec![], - vec![], - vec!["DOG=1".to_string(), "CAT=2".to_string(),], - "../wasi_test_resources/envvar.out" - ); -} diff --git a/tests/wasitests/snapshot1_fd_allocate.rs b/tests/wasitests/snapshot1_fd_allocate.rs deleted file mode 100644 index 631adc917..000000000 --- a/tests/wasitests/snapshot1_fd_allocate.rs +++ /dev/null @@ -1,19 +0,0 @@ -// !!! THIS IS A GENERATED FILE !!! -// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME -// Files autogenerated with cargo build. - -#[test] -#[ignore] -fn test_snapshot1_fd_allocate() { - assert_wasi_output!( - "../wasi_test_resources/snapshot1/fd_allocate.wasm", - "snapshot1_fd_allocate", - vec![], - vec![( - ".".to_string(), - ::std::path::PathBuf::from("tests/wasi_test_resources/test_fs/temp") - ),], - vec![], - "../wasi_test_resources/fd_allocate.out" - ); -} diff --git a/tests/wasitests/snapshot1_fd_append.rs b/tests/wasitests/snapshot1_fd_append.rs deleted file mode 100644 index 800cb1ad3..000000000 --- a/tests/wasitests/snapshot1_fd_append.rs +++ /dev/null @@ -1,18 +0,0 @@ -// !!! THIS IS A GENERATED FILE !!! -// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME -// Files autogenerated with cargo build. - -#[test] -fn test_snapshot1_fd_append() { - assert_wasi_output!( - "../wasi_test_resources/snapshot1/fd_append.wasm", - "snapshot1_fd_append", - vec![], - vec![( - ".".to_string(), - ::std::path::PathBuf::from("tests/wasi_test_resources/test_fs/temp") - ),], - vec![], - "../wasi_test_resources/fd_append.out" - ); -} diff --git a/tests/wasitests/snapshot1_fd_close.rs b/tests/wasitests/snapshot1_fd_close.rs deleted file mode 100644 index 76494cd16..000000000 --- a/tests/wasitests/snapshot1_fd_close.rs +++ /dev/null @@ -1,19 +0,0 @@ -// !!! THIS IS A GENERATED FILE !!! -// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME -// Files autogenerated with cargo build. - -#[test] -#[ignore] -fn test_snapshot1_fd_close() { - assert_wasi_output!( - "../wasi_test_resources/snapshot1/fd_close.wasm", - "snapshot1_fd_close", - vec![], - vec![( - ".".to_string(), - ::std::path::PathBuf::from("tests/wasi_test_resources/test_fs/hamlet") - ),], - vec![], - "../wasi_test_resources/fd_close.out" - ); -} diff --git a/tests/wasitests/snapshot1_fd_pread.rs b/tests/wasitests/snapshot1_fd_pread.rs deleted file mode 100644 index 2c0f01956..000000000 --- a/tests/wasitests/snapshot1_fd_pread.rs +++ /dev/null @@ -1,19 +0,0 @@ -// !!! THIS IS A GENERATED FILE !!! -// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME -// Files autogenerated with cargo build. - -#[test] -#[ignore] -fn test_snapshot1_fd_pread() { - assert_wasi_output!( - "../wasi_test_resources/snapshot1/fd_pread.wasm", - "snapshot1_fd_pread", - vec![], - vec![( - ".".to_string(), - ::std::path::PathBuf::from("tests/wasi_test_resources/test_fs/hamlet") - ),], - vec![], - "../wasi_test_resources/fd_pread.out" - ); -} diff --git a/tests/wasitests/snapshot1_fd_read.rs b/tests/wasitests/snapshot1_fd_read.rs deleted file mode 100644 index 68c7d3a8a..000000000 --- a/tests/wasitests/snapshot1_fd_read.rs +++ /dev/null @@ -1,19 +0,0 @@ -// !!! THIS IS A GENERATED FILE !!! -// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME -// Files autogenerated with cargo build. - -#[test] -#[ignore] -fn test_snapshot1_fd_read() { - assert_wasi_output!( - "../wasi_test_resources/snapshot1/fd_read.wasm", - "snapshot1_fd_read", - vec![], - vec![( - ".".to_string(), - ::std::path::PathBuf::from("tests/wasi_test_resources/test_fs/hamlet") - ),], - vec![], - "../wasi_test_resources/fd_read.out" - ); -} diff --git a/tests/wasitests/snapshot1_fd_sync.rs b/tests/wasitests/snapshot1_fd_sync.rs deleted file mode 100644 index abda06f32..000000000 --- a/tests/wasitests/snapshot1_fd_sync.rs +++ /dev/null @@ -1,18 +0,0 @@ -// !!! THIS IS A GENERATED FILE !!! -// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME -// Files autogenerated with cargo build. - -#[test] -fn test_snapshot1_fd_sync() { - assert_wasi_output!( - "../wasi_test_resources/snapshot1/fd_sync.wasm", - "snapshot1_fd_sync", - vec![], - vec![( - ".".to_string(), - ::std::path::PathBuf::from("tests/wasi_test_resources/test_fs/temp") - ),], - vec![], - "../wasi_test_resources/fd_sync.out" - ); -} diff --git a/tests/wasitests/snapshot1_file_metadata.rs b/tests/wasitests/snapshot1_file_metadata.rs deleted file mode 100644 index 9a15fcdfc..000000000 --- a/tests/wasitests/snapshot1_file_metadata.rs +++ /dev/null @@ -1,15 +0,0 @@ -// !!! THIS IS A GENERATED FILE !!! -// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME -// Files autogenerated with cargo build. - -#[test] -fn test_snapshot1_file_metadata() { - assert_wasi_output!( - "../wasi_test_resources/snapshot1/file_metadata.wasm", - "snapshot1_file_metadata", - vec![std::path::PathBuf::from("."),], - vec![], - vec![], - "../wasi_test_resources/file_metadata.out" - ); -} diff --git a/tests/wasitests/snapshot1_fs_sandbox_test.rs b/tests/wasitests/snapshot1_fs_sandbox_test.rs deleted file mode 100644 index 80bac2752..000000000 --- a/tests/wasitests/snapshot1_fs_sandbox_test.rs +++ /dev/null @@ -1,15 +0,0 @@ -// !!! THIS IS A GENERATED FILE !!! -// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME -// Files autogenerated with cargo build. - -#[test] -fn test_snapshot1_fs_sandbox_test() { - assert_wasi_output!( - "../wasi_test_resources/snapshot1/fs_sandbox_test.wasm", - "snapshot1_fs_sandbox_test", - vec![], - vec![], - vec![], - "../wasi_test_resources/fs_sandbox_test.out" - ); -} diff --git a/tests/wasitests/snapshot1_fseek.rs b/tests/wasitests/snapshot1_fseek.rs deleted file mode 100644 index 6258e07fe..000000000 --- a/tests/wasitests/snapshot1_fseek.rs +++ /dev/null @@ -1,18 +0,0 @@ -// !!! THIS IS A GENERATED FILE !!! -// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME -// Files autogenerated with cargo build. - -#[test] -fn test_snapshot1_fseek() { - assert_wasi_output!( - "../wasi_test_resources/snapshot1/fseek.wasm", - "snapshot1_fseek", - vec![], - vec![( - ".".to_string(), - ::std::path::PathBuf::from("tests/wasi_test_resources/test_fs/hamlet") - ),], - vec![], - "../wasi_test_resources/fseek.out" - ); -} diff --git a/tests/wasitests/snapshot1_hello.rs b/tests/wasitests/snapshot1_hello.rs deleted file mode 100644 index 0522b9344..000000000 --- a/tests/wasitests/snapshot1_hello.rs +++ /dev/null @@ -1,15 +0,0 @@ -// !!! THIS IS A GENERATED FILE !!! -// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME -// Files autogenerated with cargo build. - -#[test] -fn test_snapshot1_hello() { - assert_wasi_output!( - "../wasi_test_resources/snapshot1/hello.wasm", - "snapshot1_hello", - vec![], - vec![], - vec![], - "../wasi_test_resources/hello.out" - ); -} diff --git a/tests/wasitests/snapshot1_isatty.rs b/tests/wasitests/snapshot1_isatty.rs deleted file mode 100644 index 192628454..000000000 --- a/tests/wasitests/snapshot1_isatty.rs +++ /dev/null @@ -1,15 +0,0 @@ -// !!! THIS IS A GENERATED FILE !!! -// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME -// Files autogenerated with cargo build. - -#[test] -fn test_snapshot1_isatty() { - assert_wasi_output!( - "../wasi_test_resources/snapshot1/isatty.wasm", - "snapshot1_isatty", - vec![], - vec![], - vec![], - "../wasi_test_resources/isatty.out" - ); -} diff --git a/tests/wasitests/snapshot1_mapdir.rs b/tests/wasitests/snapshot1_mapdir.rs deleted file mode 100644 index 9ac9074d1..000000000 --- a/tests/wasitests/snapshot1_mapdir.rs +++ /dev/null @@ -1,18 +0,0 @@ -// !!! THIS IS A GENERATED FILE !!! -// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME -// Files autogenerated with cargo build. - -#[test] -fn test_snapshot1_mapdir() { - assert_wasi_output!( - "../wasi_test_resources/snapshot1/mapdir.wasm", - "snapshot1_mapdir", - vec![], - vec![( - ".".to_string(), - ::std::path::PathBuf::from("tests/wasi_test_resources/test_fs/hamlet") - ),], - vec![], - "../wasi_test_resources/mapdir.out" - ); -} diff --git a/tests/wasitests/snapshot1_path_link.rs b/tests/wasitests/snapshot1_path_link.rs deleted file mode 100644 index c919c3458..000000000 --- a/tests/wasitests/snapshot1_path_link.rs +++ /dev/null @@ -1,24 +0,0 @@ -// !!! THIS IS A GENERATED FILE !!! -// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME -// Files autogenerated with cargo build. - -#[test] -fn test_snapshot1_path_link() { - assert_wasi_output!( - "../wasi_test_resources/snapshot1/path_link.wasm", - "snapshot1_path_link", - vec![], - vec![ - ( - "act5".to_string(), - ::std::path::PathBuf::from("tests/wasi_test_resources/test_fs/hamlet/act5") - ), - ( - "temp".to_string(), - ::std::path::PathBuf::from("tests/wasi_test_resources/test_fs/temp") - ), - ], - vec![], - "../wasi_test_resources/path_link.out" - ); -} diff --git a/tests/wasitests/snapshot1_path_rename.rs b/tests/wasitests/snapshot1_path_rename.rs deleted file mode 100644 index 406c4b6f6..000000000 --- a/tests/wasitests/snapshot1_path_rename.rs +++ /dev/null @@ -1,18 +0,0 @@ -// !!! THIS IS A GENERATED FILE !!! -// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME -// Files autogenerated with cargo build. - -#[test] -fn test_snapshot1_path_rename() { - assert_wasi_output!( - "../wasi_test_resources/snapshot1/path_rename.wasm", - "snapshot1_path_rename", - vec![], - vec![( - "temp".to_string(), - ::std::path::PathBuf::from("tests/wasi_test_resources/test_fs/temp") - ),], - vec![], - "../wasi_test_resources/path_rename.out" - ); -} diff --git a/tests/wasitests/snapshot1_path_symlink.rs b/tests/wasitests/snapshot1_path_symlink.rs deleted file mode 100644 index f5f2c8c4c..000000000 --- a/tests/wasitests/snapshot1_path_symlink.rs +++ /dev/null @@ -1,24 +0,0 @@ -// !!! THIS IS A GENERATED FILE !!! -// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME -// Files autogenerated with cargo build. - -#[test] -fn test_snapshot1_path_symlink() { - assert_wasi_output!( - "../wasi_test_resources/snapshot1/path_symlink.wasm", - "snapshot1_path_symlink", - vec![], - vec![ - ( - "temp".to_string(), - ::std::path::PathBuf::from("tests/wasi_test_resources/test_fs/temp") - ), - ( - "hamlet".to_string(), - ::std::path::PathBuf::from("tests/wasi_test_resources/test_fs/hamlet") - ), - ], - vec![], - "../wasi_test_resources/path_symlink.out" - ); -} diff --git a/tests/wasitests/snapshot1_poll_oneoff.rs b/tests/wasitests/snapshot1_poll_oneoff.rs deleted file mode 100644 index be7f55b9a..000000000 --- a/tests/wasitests/snapshot1_poll_oneoff.rs +++ /dev/null @@ -1,25 +0,0 @@ -// !!! THIS IS A GENERATED FILE !!! -// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME -// Files autogenerated with cargo build. - -#[test] -#[ignore] -fn test_snapshot1_poll_oneoff() { - assert_wasi_output!( - "../wasi_test_resources/snapshot1/poll_oneoff.wasm", - "snapshot1_poll_oneoff", - vec![], - vec![ - ( - "hamlet".to_string(), - ::std::path::PathBuf::from("tests/wasi_test_resources/test_fs/hamlet") - ), - ( - "temp".to_string(), - ::std::path::PathBuf::from("tests/wasi_test_resources/test_fs/temp") - ), - ], - vec![], - "../wasi_test_resources/poll_oneoff.out" - ); -} diff --git a/tests/wasitests/snapshot1_quine.rs b/tests/wasitests/snapshot1_quine.rs deleted file mode 100644 index 8ba0cd8d0..000000000 --- a/tests/wasitests/snapshot1_quine.rs +++ /dev/null @@ -1,15 +0,0 @@ -// !!! THIS IS A GENERATED FILE !!! -// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME -// Files autogenerated with cargo build. - -#[test] -fn test_snapshot1_quine() { - assert_wasi_output!( - "../wasi_test_resources/snapshot1/quine.wasm", - "snapshot1_quine", - vec![std::path::PathBuf::from("."),], - vec![], - vec![], - "../wasi_test_resources/quine.out" - ); -} diff --git a/tests/wasitests/snapshot1_readlink.rs b/tests/wasitests/snapshot1_readlink.rs deleted file mode 100644 index ec97fce81..000000000 --- a/tests/wasitests/snapshot1_readlink.rs +++ /dev/null @@ -1,18 +0,0 @@ -// !!! THIS IS A GENERATED FILE !!! -// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME -// Files autogenerated with cargo build. - -#[test] -fn test_snapshot1_readlink() { - assert_wasi_output!( - "../wasi_test_resources/snapshot1/readlink.wasm", - "snapshot1_readlink", - vec![], - vec![( - ".".to_string(), - ::std::path::PathBuf::from("tests/wasi_test_resources/test_fs/hamlet") - ),], - vec![], - "../wasi_test_resources/readlink.out" - ); -} diff --git a/tests/wasitests/snapshot1_wasi_sees_virtual_root.rs b/tests/wasitests/snapshot1_wasi_sees_virtual_root.rs deleted file mode 100644 index 87a33b022..000000000 --- a/tests/wasitests/snapshot1_wasi_sees_virtual_root.rs +++ /dev/null @@ -1,28 +0,0 @@ -// !!! THIS IS A GENERATED FILE !!! -// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME -// Files autogenerated with cargo build. - -#[test] -fn test_snapshot1_wasi_sees_virtual_root() { - assert_wasi_output!( - "../wasi_test_resources/snapshot1/wasi_sees_virtual_root.wasm", - "snapshot1_wasi_sees_virtual_root", - vec![], - vec![ - ( - "act1".to_string(), - ::std::path::PathBuf::from("tests/wasi_test_resources/test_fs/hamlet/act1") - ), - ( - "act2".to_string(), - ::std::path::PathBuf::from("tests/wasi_test_resources/test_fs/hamlet/act2") - ), - ( - "act1-again".to_string(), - ::std::path::PathBuf::from("tests/wasi_test_resources/test_fs/hamlet/act1") - ), - ], - vec![], - "../wasi_test_resources/wasi_sees_virtual_root.out" - ); -} diff --git a/tests/wasitests/snapshot1_writing.rs b/tests/wasitests/snapshot1_writing.rs deleted file mode 100644 index 971142fbd..000000000 --- a/tests/wasitests/snapshot1_writing.rs +++ /dev/null @@ -1,28 +0,0 @@ -// !!! THIS IS A GENERATED FILE !!! -// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME -// Files autogenerated with cargo build. - -#[test] -fn test_snapshot1_writing() { - assert_wasi_output!( - "../wasi_test_resources/snapshot1/writing.wasm", - "snapshot1_writing", - vec![], - vec![ - ( - "act1".to_string(), - ::std::path::PathBuf::from("tests/wasi_test_resources/test_fs/hamlet/act1") - ), - ( - "act2".to_string(), - ::std::path::PathBuf::from("tests/wasi_test_resources/test_fs/hamlet/act2") - ), - ( - "act1-again".to_string(), - ::std::path::PathBuf::from("tests/wasi_test_resources/test_fs/hamlet/act1") - ), - ], - vec![], - "../wasi_test_resources/writing.out" - ); -} diff --git a/tests/wasitests/unstable_close_preopen_fd.rs b/tests/wasitests/unstable_close_preopen_fd.rs deleted file mode 100644 index 2945d14aa..000000000 --- a/tests/wasitests/unstable_close_preopen_fd.rs +++ /dev/null @@ -1,18 +0,0 @@ -// !!! THIS IS A GENERATED FILE !!! -// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME -// Files autogenerated with cargo build. - -#[test] -fn test_unstable_close_preopen_fd() { - assert_wasi_output!( - "../wasi_test_resources/unstable/close_preopen_fd.wasm", - "unstable_close_preopen_fd", - vec![], - vec![( - "hamlet".to_string(), - ::std::path::PathBuf::from("tests/wasi_test_resources/test_fs/hamlet") - ),], - vec![], - "../wasi_test_resources/close_preopen_fd.out" - ); -} diff --git a/tests/wasitests/unstable_create_dir.rs b/tests/wasitests/unstable_create_dir.rs deleted file mode 100644 index 47f51d212..000000000 --- a/tests/wasitests/unstable_create_dir.rs +++ /dev/null @@ -1,15 +0,0 @@ -// !!! THIS IS A GENERATED FILE !!! -// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME -// Files autogenerated with cargo build. - -#[test] -fn test_unstable_create_dir() { - assert_wasi_output!( - "../wasi_test_resources/unstable/create_dir.wasm", - "unstable_create_dir", - vec![std::path::PathBuf::from("."),], - vec![], - vec![], - "../wasi_test_resources/create_dir.out" - ); -} diff --git a/tests/wasitests/unstable_envvar.rs b/tests/wasitests/unstable_envvar.rs deleted file mode 100644 index b4088afbe..000000000 --- a/tests/wasitests/unstable_envvar.rs +++ /dev/null @@ -1,15 +0,0 @@ -// !!! THIS IS A GENERATED FILE !!! -// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME -// Files autogenerated with cargo build. - -#[test] -fn test_unstable_envvar() { - assert_wasi_output!( - "../wasi_test_resources/unstable/envvar.wasm", - "unstable_envvar", - vec![], - vec![], - vec!["DOG=1".to_string(), "CAT=2".to_string(),], - "../wasi_test_resources/envvar.out" - ); -} diff --git a/tests/wasitests/unstable_fd_allocate.rs b/tests/wasitests/unstable_fd_allocate.rs deleted file mode 100644 index 2a55ac499..000000000 --- a/tests/wasitests/unstable_fd_allocate.rs +++ /dev/null @@ -1,18 +0,0 @@ -// !!! THIS IS A GENERATED FILE !!! -// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME -// Files autogenerated with cargo build. - -#[test] -fn test_unstable_fd_allocate() { - assert_wasi_output!( - "../wasi_test_resources/unstable/fd_allocate.wasm", - "unstable_fd_allocate", - vec![], - vec![( - ".".to_string(), - ::std::path::PathBuf::from("tests/wasi_test_resources/test_fs/temp") - ),], - vec![], - "../wasi_test_resources/fd_allocate.out" - ); -} diff --git a/tests/wasitests/unstable_fd_append.rs b/tests/wasitests/unstable_fd_append.rs deleted file mode 100644 index f5c5b8c8f..000000000 --- a/tests/wasitests/unstable_fd_append.rs +++ /dev/null @@ -1,18 +0,0 @@ -// !!! THIS IS A GENERATED FILE !!! -// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME -// Files autogenerated with cargo build. - -#[test] -fn test_unstable_fd_append() { - assert_wasi_output!( - "../wasi_test_resources/unstable/fd_append.wasm", - "unstable_fd_append", - vec![], - vec![( - ".".to_string(), - ::std::path::PathBuf::from("tests/wasi_test_resources/test_fs/temp") - ),], - vec![], - "../wasi_test_resources/fd_append.out" - ); -} diff --git a/tests/wasitests/unstable_fd_close.rs b/tests/wasitests/unstable_fd_close.rs deleted file mode 100644 index 3114823a9..000000000 --- a/tests/wasitests/unstable_fd_close.rs +++ /dev/null @@ -1,18 +0,0 @@ -// !!! THIS IS A GENERATED FILE !!! -// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME -// Files autogenerated with cargo build. - -#[test] -fn test_unstable_fd_close() { - assert_wasi_output!( - "../wasi_test_resources/unstable/fd_close.wasm", - "unstable_fd_close", - vec![], - vec![( - ".".to_string(), - ::std::path::PathBuf::from("tests/wasi_test_resources/test_fs/hamlet") - ),], - vec![], - "../wasi_test_resources/fd_close.out" - ); -} diff --git a/tests/wasitests/unstable_fd_pread.rs b/tests/wasitests/unstable_fd_pread.rs deleted file mode 100644 index 9725a0409..000000000 --- a/tests/wasitests/unstable_fd_pread.rs +++ /dev/null @@ -1,18 +0,0 @@ -// !!! THIS IS A GENERATED FILE !!! -// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME -// Files autogenerated with cargo build. - -#[test] -fn test_unstable_fd_pread() { - assert_wasi_output!( - "../wasi_test_resources/unstable/fd_pread.wasm", - "unstable_fd_pread", - vec![], - vec![( - ".".to_string(), - ::std::path::PathBuf::from("tests/wasi_test_resources/test_fs/hamlet") - ),], - vec![], - "../wasi_test_resources/fd_pread.out" - ); -} diff --git a/tests/wasitests/unstable_fd_read.rs b/tests/wasitests/unstable_fd_read.rs deleted file mode 100644 index fbfba15b0..000000000 --- a/tests/wasitests/unstable_fd_read.rs +++ /dev/null @@ -1,18 +0,0 @@ -// !!! THIS IS A GENERATED FILE !!! -// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME -// Files autogenerated with cargo build. - -#[test] -fn test_unstable_fd_read() { - assert_wasi_output!( - "../wasi_test_resources/unstable/fd_read.wasm", - "unstable_fd_read", - vec![], - vec![( - ".".to_string(), - ::std::path::PathBuf::from("tests/wasi_test_resources/test_fs/hamlet") - ),], - vec![], - "../wasi_test_resources/fd_read.out" - ); -} diff --git a/tests/wasitests/unstable_fd_sync.rs b/tests/wasitests/unstable_fd_sync.rs deleted file mode 100644 index 020b545f5..000000000 --- a/tests/wasitests/unstable_fd_sync.rs +++ /dev/null @@ -1,18 +0,0 @@ -// !!! THIS IS A GENERATED FILE !!! -// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME -// Files autogenerated with cargo build. - -#[test] -fn test_unstable_fd_sync() { - assert_wasi_output!( - "../wasi_test_resources/unstable/fd_sync.wasm", - "unstable_fd_sync", - vec![], - vec![( - ".".to_string(), - ::std::path::PathBuf::from("tests/wasi_test_resources/test_fs/temp") - ),], - vec![], - "../wasi_test_resources/fd_sync.out" - ); -} diff --git a/tests/wasitests/unstable_file_metadata.rs b/tests/wasitests/unstable_file_metadata.rs deleted file mode 100644 index 91ba1bc29..000000000 --- a/tests/wasitests/unstable_file_metadata.rs +++ /dev/null @@ -1,15 +0,0 @@ -// !!! THIS IS A GENERATED FILE !!! -// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME -// Files autogenerated with cargo build. - -#[test] -fn test_unstable_file_metadata() { - assert_wasi_output!( - "../wasi_test_resources/unstable/file_metadata.wasm", - "unstable_file_metadata", - vec![std::path::PathBuf::from("."),], - vec![], - vec![], - "../wasi_test_resources/file_metadata.out" - ); -} diff --git a/tests/wasitests/unstable_fs_sandbox_test.rs b/tests/wasitests/unstable_fs_sandbox_test.rs deleted file mode 100644 index 82048a3c8..000000000 --- a/tests/wasitests/unstable_fs_sandbox_test.rs +++ /dev/null @@ -1,15 +0,0 @@ -// !!! THIS IS A GENERATED FILE !!! -// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME -// Files autogenerated with cargo build. - -#[test] -fn test_unstable_fs_sandbox_test() { - assert_wasi_output!( - "../wasi_test_resources/unstable/fs_sandbox_test.wasm", - "unstable_fs_sandbox_test", - vec![], - vec![], - vec![], - "../wasi_test_resources/fs_sandbox_test.out" - ); -} diff --git a/tests/wasitests/unstable_fseek.rs b/tests/wasitests/unstable_fseek.rs deleted file mode 100644 index 282c67de7..000000000 --- a/tests/wasitests/unstable_fseek.rs +++ /dev/null @@ -1,18 +0,0 @@ -// !!! THIS IS A GENERATED FILE !!! -// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME -// Files autogenerated with cargo build. - -#[test] -fn test_unstable_fseek() { - assert_wasi_output!( - "../wasi_test_resources/unstable/fseek.wasm", - "unstable_fseek", - vec![], - vec![( - ".".to_string(), - ::std::path::PathBuf::from("tests/wasi_test_resources/test_fs/hamlet") - ),], - vec![], - "../wasi_test_resources/fseek.out" - ); -} diff --git a/tests/wasitests/unstable_hello.rs b/tests/wasitests/unstable_hello.rs deleted file mode 100644 index 93f662906..000000000 --- a/tests/wasitests/unstable_hello.rs +++ /dev/null @@ -1,15 +0,0 @@ -// !!! THIS IS A GENERATED FILE !!! -// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME -// Files autogenerated with cargo build. - -#[test] -fn test_unstable_hello() { - assert_wasi_output!( - "../wasi_test_resources/unstable/hello.wasm", - "unstable_hello", - vec![], - vec![], - vec![], - "../wasi_test_resources/hello.out" - ); -} diff --git a/tests/wasitests/unstable_isatty.rs b/tests/wasitests/unstable_isatty.rs deleted file mode 100644 index 9313980db..000000000 --- a/tests/wasitests/unstable_isatty.rs +++ /dev/null @@ -1,15 +0,0 @@ -// !!! THIS IS A GENERATED FILE !!! -// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME -// Files autogenerated with cargo build. - -#[test] -fn test_unstable_isatty() { - assert_wasi_output!( - "../wasi_test_resources/unstable/isatty.wasm", - "unstable_isatty", - vec![], - vec![], - vec![], - "../wasi_test_resources/isatty.out" - ); -} diff --git a/tests/wasitests/unstable_mapdir.rs b/tests/wasitests/unstable_mapdir.rs deleted file mode 100644 index 69b51e609..000000000 --- a/tests/wasitests/unstable_mapdir.rs +++ /dev/null @@ -1,18 +0,0 @@ -// !!! THIS IS A GENERATED FILE !!! -// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME -// Files autogenerated with cargo build. - -#[test] -fn test_unstable_mapdir() { - assert_wasi_output!( - "../wasi_test_resources/unstable/mapdir.wasm", - "unstable_mapdir", - vec![], - vec![( - ".".to_string(), - ::std::path::PathBuf::from("tests/wasi_test_resources/test_fs/hamlet") - ),], - vec![], - "../wasi_test_resources/mapdir.out" - ); -} diff --git a/tests/wasitests/unstable_path_link.rs b/tests/wasitests/unstable_path_link.rs deleted file mode 100644 index 340fa3c55..000000000 --- a/tests/wasitests/unstable_path_link.rs +++ /dev/null @@ -1,24 +0,0 @@ -// !!! THIS IS A GENERATED FILE !!! -// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME -// Files autogenerated with cargo build. - -#[test] -fn test_unstable_path_link() { - assert_wasi_output!( - "../wasi_test_resources/unstable/path_link.wasm", - "unstable_path_link", - vec![], - vec![ - ( - "act5".to_string(), - ::std::path::PathBuf::from("tests/wasi_test_resources/test_fs/hamlet/act5") - ), - ( - "temp".to_string(), - ::std::path::PathBuf::from("tests/wasi_test_resources/test_fs/temp") - ), - ], - vec![], - "../wasi_test_resources/path_link.out" - ); -} diff --git a/tests/wasitests/unstable_path_rename.rs b/tests/wasitests/unstable_path_rename.rs deleted file mode 100644 index 51c194d17..000000000 --- a/tests/wasitests/unstable_path_rename.rs +++ /dev/null @@ -1,18 +0,0 @@ -// !!! THIS IS A GENERATED FILE !!! -// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME -// Files autogenerated with cargo build. - -#[test] -fn test_unstable_path_rename() { - assert_wasi_output!( - "../wasi_test_resources/unstable/path_rename.wasm", - "unstable_path_rename", - vec![], - vec![( - "temp".to_string(), - ::std::path::PathBuf::from("tests/wasi_test_resources/test_fs/temp") - ),], - vec![], - "../wasi_test_resources/path_rename.out" - ); -} diff --git a/tests/wasitests/unstable_path_symlink.rs b/tests/wasitests/unstable_path_symlink.rs deleted file mode 100644 index 2bafcd8b0..000000000 --- a/tests/wasitests/unstable_path_symlink.rs +++ /dev/null @@ -1,24 +0,0 @@ -// !!! THIS IS A GENERATED FILE !!! -// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME -// Files autogenerated with cargo build. - -#[test] -fn test_unstable_path_symlink() { - assert_wasi_output!( - "../wasi_test_resources/unstable/path_symlink.wasm", - "unstable_path_symlink", - vec![], - vec![ - ( - "temp".to_string(), - ::std::path::PathBuf::from("tests/wasi_test_resources/test_fs/temp") - ), - ( - "hamlet".to_string(), - ::std::path::PathBuf::from("tests/wasi_test_resources/test_fs/hamlet") - ), - ], - vec![], - "../wasi_test_resources/path_symlink.out" - ); -} diff --git a/tests/wasitests/unstable_poll_oneoff.rs b/tests/wasitests/unstable_poll_oneoff.rs deleted file mode 100644 index 00e9d8fd2..000000000 --- a/tests/wasitests/unstable_poll_oneoff.rs +++ /dev/null @@ -1,24 +0,0 @@ -// !!! THIS IS A GENERATED FILE !!! -// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME -// Files autogenerated with cargo build. - -#[test] -fn test_unstable_poll_oneoff() { - assert_wasi_output!( - "../wasi_test_resources/unstable/poll_oneoff.wasm", - "unstable_poll_oneoff", - vec![], - vec![ - ( - "hamlet".to_string(), - ::std::path::PathBuf::from("tests/wasi_test_resources/test_fs/hamlet") - ), - ( - "temp".to_string(), - ::std::path::PathBuf::from("tests/wasi_test_resources/test_fs/temp") - ), - ], - vec![], - "../wasi_test_resources/poll_oneoff.out" - ); -} diff --git a/tests/wasitests/unstable_quine.rs b/tests/wasitests/unstable_quine.rs deleted file mode 100644 index ea0adac47..000000000 --- a/tests/wasitests/unstable_quine.rs +++ /dev/null @@ -1,15 +0,0 @@ -// !!! THIS IS A GENERATED FILE !!! -// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME -// Files autogenerated with cargo build. - -#[test] -fn test_unstable_quine() { - assert_wasi_output!( - "../wasi_test_resources/unstable/quine.wasm", - "unstable_quine", - vec![std::path::PathBuf::from("."),], - vec![], - vec![], - "../wasi_test_resources/quine.out" - ); -} diff --git a/tests/wasitests/unstable_readlink.rs b/tests/wasitests/unstable_readlink.rs deleted file mode 100644 index c9a15afef..000000000 --- a/tests/wasitests/unstable_readlink.rs +++ /dev/null @@ -1,18 +0,0 @@ -// !!! THIS IS A GENERATED FILE !!! -// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME -// Files autogenerated with cargo build. - -#[test] -fn test_unstable_readlink() { - assert_wasi_output!( - "../wasi_test_resources/unstable/readlink.wasm", - "unstable_readlink", - vec![], - vec![( - ".".to_string(), - ::std::path::PathBuf::from("tests/wasi_test_resources/test_fs/hamlet") - ),], - vec![], - "../wasi_test_resources/readlink.out" - ); -} diff --git a/tests/wasitests/unstable_wasi_sees_virtual_root.rs b/tests/wasitests/unstable_wasi_sees_virtual_root.rs deleted file mode 100644 index 68affa54c..000000000 --- a/tests/wasitests/unstable_wasi_sees_virtual_root.rs +++ /dev/null @@ -1,28 +0,0 @@ -// !!! THIS IS A GENERATED FILE !!! -// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME -// Files autogenerated with cargo build. - -#[test] -fn test_unstable_wasi_sees_virtual_root() { - assert_wasi_output!( - "../wasi_test_resources/unstable/wasi_sees_virtual_root.wasm", - "unstable_wasi_sees_virtual_root", - vec![], - vec![ - ( - "act1".to_string(), - ::std::path::PathBuf::from("tests/wasi_test_resources/test_fs/hamlet/act1") - ), - ( - "act2".to_string(), - ::std::path::PathBuf::from("tests/wasi_test_resources/test_fs/hamlet/act2") - ), - ( - "act1-again".to_string(), - ::std::path::PathBuf::from("tests/wasi_test_resources/test_fs/hamlet/act1") - ), - ], - vec![], - "../wasi_test_resources/wasi_sees_virtual_root.out" - ); -} diff --git a/tests/wasitests/unstable_writing.rs b/tests/wasitests/unstable_writing.rs deleted file mode 100644 index e3124333d..000000000 --- a/tests/wasitests/unstable_writing.rs +++ /dev/null @@ -1,28 +0,0 @@ -// !!! THIS IS A GENERATED FILE !!! -// ANY MANUAL EDITS MAY BE OVERWRITTEN AT ANY TIME -// Files autogenerated with cargo build. - -#[test] -fn test_unstable_writing() { - assert_wasi_output!( - "../wasi_test_resources/unstable/writing.wasm", - "unstable_writing", - vec![], - vec![ - ( - "act1".to_string(), - ::std::path::PathBuf::from("tests/wasi_test_resources/test_fs/hamlet/act1") - ), - ( - "act2".to_string(), - ::std::path::PathBuf::from("tests/wasi_test_resources/test_fs/hamlet/act2") - ), - ( - "act1-again".to_string(), - ::std::path::PathBuf::from("tests/wasi_test_resources/test_fs/hamlet/act1") - ), - ], - vec![], - "../wasi_test_resources/writing.out" - ); -}