diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index d8cf1aad0df..eab2a07f243 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -218,8 +218,8 @@ jobs: run: | ls target/release alias wasmer=target/release/wasmer - ./target/release/wasmer compile --target=x86_64-apple-darwin tests/integration/cli/assets/qjs.wasm -o qjs_mac_from_linux.wjit - #./target/release/wasmer compile --target=x86_64-pc-windows-msvc tests/integration/cli/assets/qjs.wasm -o qjs_win_from_linux.wjit + ./target/release/wasmer compile --target=x86_64-apple-darwin lib/c-api/tests/assets/qjs.wasm -o qjs_mac_from_linux.wjit + #./target/release/wasmer compile --target=x86_64-pc-windows-msvc lib/c-api/tests/assets/qjs.wasm -o qjs_win_from_linux.wjit mkdir cross cp qjs_mac_from_linux.wjit cross #cp qjs_win_from_linux.wjit cross @@ -230,8 +230,8 @@ jobs: run: | ls target/release alias wasmer=target/release/wasmer - ./target/release/wasmer compile --target=x86_64-unknown-linux-gnu tests/integration/cli/assets/qjs.wasm -o qjs_linux_from_mac.wjit - #./target/release/wasmer compile --target=x86_64-pc-windows-msvc tests/integration/cli/assets/qjs.wasm -o qjs_win_from_mac.wjit + ./target/release/wasmer compile --target=x86_64-unknown-linux-gnu lib/c-api/tests/assets/qjs.wasm -o qjs_linux_from_mac.wjit + #./target/release/wasmer compile --target=x86_64-pc-windows-msvc lib/c-api/tests/assets/qjs.wasm -o qjs_win_from_mac.wjit mkdir cross cp qjs_linux_from_mac.wjit cross #cp qjs_win_from_mac.wjit cross diff --git a/.gitignore b/.gitignore index b8902db70cd..f131b023288 100644 --- a/.gitignore +++ b/.gitignore @@ -13,8 +13,3 @@ api-docs-repo/ # Generated by tests on Android /avd /core -/lib/c-api/examples/exports-function -/lib/c-api/examples/exports-global -/lib/c-api/examples/imports-exports -/lib/c-api/examples/instance -/lib/c-api/examples/memory diff --git a/CHANGELOG.md b/CHANGELOG.md index ebb25ac6af9..ee30d59cdce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ ### Changed - [#1874](https://github.com/wasmerio/wasmer/pull/1874) Set `CompilerConfig` to be owned (following wasm-c-api) +- [#1880](https://github.com/wasmerio/wasmer/pull/1880) Remove cmake dependency for tests ## 1.0.0-beta1 - 2020-12-01 diff --git a/Makefile b/Makefile index 8cfec57f37b..6efabc6b5e9 100644 --- a/Makefile +++ b/Makefile @@ -52,7 +52,7 @@ ifneq (,$(filter $(ARCH),aarch64 arm64)) ifneq (, $(findstring llvm,$(compilers))) test_compilers_engines += llvm-native endif - # if we are in Darwin, we use the system libffi for the capi + # if we are in macos arm64, we use the system libffi for the capi ifeq ($(UNAME_S), Darwin) capi_default_features := --features system-libffi endif @@ -224,19 +224,17 @@ test-packages: # The test-capi rules depend on the build-capi rules to build the .a files to # link the tests against. cargo test doesn't know that the tests will be running -# cmake + make to build programs whose dependencies cargo isn't aware of. - test-capi: $(foreach compiler_engine,$(test_compilers_engines),test-capi-$(compiler_engine)) -test-capi-singlepass-jit: build-capi-singlepass-jit test-capi-examples +test-capi-singlepass-jit: build-capi-singlepass-jit test-capi-tests cargo test --manifest-path lib/c-api/Cargo.toml --release \ --no-default-features --features deprecated,wat,jit,singlepass,wasi $(capi_default_features) -- --nocapture -test-capi-cranelift-jit: build-capi-cranelift-jit test-capi-examples +test-capi-cranelift-jit: build-capi-cranelift-jit test-capi-tests cargo test --manifest-path lib/c-api/Cargo.toml --release \ --no-default-features --features deprecated,wat,jit,cranelift,wasi $(capi_default_features) -- --nocapture -test-capi-cranelift-native: build-capi-cranelift-native test-capi-examples +test-capi-cranelift-native: build-capi-cranelift-native test-capi-tests cargo test --manifest-path lib/c-api/Cargo.toml --release \ --no-default-features --features deprecated,wat,native,cranelift,wasi $(capi_default_features) -- --nocapture @@ -248,7 +246,10 @@ test-capi-llvm-native: cargo test --manifest-path lib/c-api/Cargo.toml --release \ --no-default-features --features deprecated,wat,native,llvm,wasi $(capi_default_features) -- --nocapture -test-capi-examples: package-capi +test-capi-tests: package-capi + # Test the Wasmer C API tests for C + cd lib/c-api/tests; WASMER_DIR=`pwd`/../../../package make test + # Test the Wasmer C API examples cd lib/c-api/examples; WASMER_DIR=`pwd`/../../../package make run test-wasi-unit: @@ -287,8 +288,6 @@ else cp target/release/wasmer package/bin/ endif - - package-capi: mkdir -p "package/include" mkdir -p "package/lib" @@ -301,6 +300,8 @@ ifeq ($(OS), Windows_NT) cp target/release/wasmer_c_api.lib package/lib else ifeq ($(UNAME_S), Darwin) + # For some reason in macOS arm64 there are issues if we copy constantly in the install_name_tool util + rm -f package/lib/libwasmer.dylib cp target/release/libwasmer_c_api.dylib package/lib/libwasmer.dylib cp target/release/libwasmer_c_api.a package/lib/libwasmer.a # Fix the rpath for the dylib diff --git a/lib/c-api/examples/.gitignore b/lib/c-api/examples/.gitignore index 5761abcfdf0..c391b6c24a7 100644 --- a/lib/c-api/examples/.gitignore +++ b/lib/c-api/examples/.gitignore @@ -1 +1,9 @@ + +* *.o + + +# Unignore files ending with `.c` (i.e. `wasm-c-api-wasi.c`) +!*.c +# Unignore Makefile +!Makefile diff --git a/lib/c-api/examples/Makefile b/lib/c-api/examples/Makefile index 02e2e2ba7bb..44b99cc25dd 100644 --- a/lib/c-api/examples/Makefile +++ b/lib/c-api/examples/Makefile @@ -1,4 +1,3 @@ - $(info Using provided WASMER_DIR=$(WASMER_DIR)) ifeq (,$(wildcard $(WASMER_DIR)/bin/wasmer)) diff --git a/lib/c-api/tests/.gitignore b/lib/c-api/tests/.gitignore new file mode 100644 index 00000000000..36e000ce2e2 --- /dev/null +++ b/lib/c-api/tests/.gitignore @@ -0,0 +1,6 @@ +# ignore wasm-c-api binaries +wasm-c-api-* +test-* + +# Unignore files ending with `.c` (i.e. `wasm-c-api-wasi.c`) +!*.c diff --git a/lib/c-api/tests/Makefile b/lib/c-api/tests/Makefile new file mode 100644 index 00000000000..50d99c1ef76 --- /dev/null +++ b/lib/c-api/tests/Makefile @@ -0,0 +1,75 @@ +$(info Using provided WASMER_DIR=$(WASMER_DIR)) + +ifeq (,$(wildcard $(WASMER_DIR)/bin/wasmer)) + CFLAGS = -g -I$(WASMER_DIR)/include + LDFLAGS = -Wl,-rpath,$(WASMER_DIR)/lib + LDLIBS = -L$(WASMER_DIR)/lib -lwasmer +else + CFLAGS = -g -I$(shell $(WASMER_DIR)/bin/wasmer config --includedir) + LDFLAGS = -Wl,-rpath,$(shell $(WASMER_DIR)/bin/wasmer config --libdir) + LDLIBS = $(shell $(WASMER_DIR)/bin/wasmer config --libs) +endif + +$(info * CFLAGS: $(CFLAGS)) +$(info * LDFLAGS: $(LDFLAGS)) +$(info * LDLIBS: $(LDLIBS)) + +CAPI_WASMER_TESTS = \ + test-early-exit test-memory test-wasi \ + test-wat2wasm + +CAPI_BASE_TESTS = \ + wasm-c-api/example/callback wasm-c-api/example/global wasm-c-api/example/hello \ + wasm-c-api/example/memory wasm-c-api/example/reflect wasm-c-api/example/serialize \ + wasm-c-api/example/start wasm-c-api/example/trap + +CAPI_BASE_TESTS_NOT_WORKING = \ + wasm-c-api/example/finalize wasm-c-api/example/hostref wasm-c-api/example/multi \ + wasm-c-api/example/table wasm-c-api/example/threads + +DEPRECATED_TESTS = \ + deprecated/test-context deprecated/test-import-object deprecated/test-module-imports \ + deprecated/test-import-trap deprecated/test-module-serialize \ + deprecated/test-exported-memory deprecated/test-imports deprecated/test-module \ + deprecated/test-exports deprecated/test-instantiate deprecated/test-tables \ + deprecated/test-globals deprecated/test-memory deprecated/test-validate \ + deprecated/test-module-exports deprecated/test-module-import-instantiate + +DEPRECATED_NOT_WORKING = test-import-function test-import-function-callinfo test-wasi-import-object test-emscripten-import-object + +ALL = $(CAPI_BASE_TESTS) $(CAPI_WASMER_TESTS) $(DEPRECATED_TESTS) + +test-%: %.o +deprecated/test-%: deprecated/%.o + +.PHONY: all +all: $(ALL) + +.PHONY: test-capi-wasmer +.SILENT: test-capi-wasmer +test-capi-wasmer: $(CAPI_WASMER_TESTS) + set -o errexit; \ + $(foreach example,$?,echo Running \"$(example)\" example; cd $(shell dirname $(realpath $(example))) && ./$(shell basename $(example)); echo;) + +.PHONY: test-capi-base +.SILENT: test-capi-base +test-capi-base: $(CAPI_BASE_TESTS) + set -o errexit; \ + $(foreach example,$?,echo Running \"$(example)\" example; cd $(shell dirname $(realpath $(example))) && ./$(shell basename $(example)); echo;) + +.PHONY: test-capi-base +.SILENT: test-capi-base +test-capi: test-capi-base test-capi-wasmer + +.PHONY: test-deprecated +.SILENT: test-deprecated +test-deprecated: $(DEPRECATED_TESTS) + set -o errexit; \ + $(foreach example,$?,echo Running \"$(example)\" example; cd $(shell dirname $(realpath $(example))) && ./$(shell basename $(example)); echo;) + +test: test-capi test-deprecated + +.SILENT: clean +.PHONY: clean +clean: + $(foreach file,$(ALL),rm -f $(file).o $(file)) diff --git a/lib/c-api/tests/wasm_c_api/assets/call_trap.wasm b/lib/c-api/tests/assets/call_trap.wasm similarity index 100% rename from lib/c-api/tests/wasm_c_api/assets/call_trap.wasm rename to lib/c-api/tests/assets/call_trap.wasm diff --git a/lib/c-api/tests/wasm_c_api/assets/call_trap.wat b/lib/c-api/tests/assets/call_trap.wat similarity index 100% rename from lib/c-api/tests/wasm_c_api/assets/call_trap.wat rename to lib/c-api/tests/assets/call_trap.wat diff --git a/lib/c-api/tests/wasm_c_api/assets/qjs.wasm b/lib/c-api/tests/assets/qjs.wasm similarity index 100% rename from lib/c-api/tests/wasm_c_api/assets/qjs.wasm rename to lib/c-api/tests/assets/qjs.wasm diff --git a/lib/c-api/tests/deprecated/.gitignore b/lib/c-api/tests/deprecated/.gitignore index e1956243e72..36e000ce2e2 100644 --- a/lib/c-api/tests/deprecated/.gitignore +++ b/lib/c-api/tests/deprecated/.gitignore @@ -1,35 +1,3 @@ -CMakeLists.txt.user -CMakeCache.txt -CMakeFiles -CMakeScripts -Testing -Makefile -cmake_install.cmake -install_manifest.txt -compile_commands.json -CTestTestfile.cmake -_deps -rust-build -test-context -test-exported-memory -test-exports -test-globals -test-import-function -test-import-trap -test-import-object -test-imports -test-instantiate -test-memory -test-module -test-module-exports -test-module-import-instantiate -test-module-imports -test-module-serialize -test-tables -test-validate -test-wasi-import-object -test-emscripten-import-object - # ignore wasm-c-api binaries wasm-c-api-* test-* diff --git a/lib/c-api/tests/deprecated/CMakeLists.txt b/lib/c-api/tests/deprecated/CMakeLists.txt deleted file mode 100644 index 813c5927fa7..00000000000 --- a/lib/c-api/tests/deprecated/CMakeLists.txt +++ /dev/null @@ -1,130 +0,0 @@ -cmake_minimum_required (VERSION 2.6) -project (WasmerDeprecatedCApiTests) - -add_executable(test-context test-context.c) -add_executable(test-exported-memory test-exported-memory.c) -add_executable(test-exports test-exports.c) -add_executable(test-globals test-globals.c) -add_executable(test-import-object test-import-object.c) -add_executable(test-import-trap test-import-trap.c) -add_executable(test-imports test-imports.c) -add_executable(test-instantiate test-instantiate.c) -add_executable(test-memory test-memory.c) -add_executable(test-module test-module.c) -add_executable(test-module-exports test-module-exports.c) -add_executable(test-module-import-instantiate test-module-import-instantiate.c) -add_executable(test-module-imports test-module-imports.c) -add_executable(test-module-serialize test-module-serialize.c) -add_executable(test-tables test-tables.c) -add_executable(test-validate test-validate.c) - -if (DEFINED WASI_TESTS) - add_executable(test-wasi-import-object test-wasi-import-object.c) -endif() - -if (DEFINED EMSCRIPTEN_TESTS) - add_executable(test-emscripten-import-object test-emscripten-import-object.c) -endif() - -include_directories(../../) - -find_library( - WASMER_LIB NAMES libwasmer_c_api.dylib libwasmer_c_api.so wasmer_c_api.dll - PATHS ${CMAKE_SOURCE_DIR}/../../../../target/release/ - REQUIRED -) - -enable_testing() - -set( - COMPILER_OPTIONS - # Clang or gcc - $<$,$>: - "-Werror" > - # MSVC - $<$: - "/WX" > -) - -target_link_libraries(test-context general ${WASMER_LIB}) -target_compile_options(test-context PRIVATE ${COMPILER_OPTIONS}) -add_test(test-context test-context) - -target_link_libraries(test-exported-memory general ${WASMER_LIB}) -target_compile_options(test-exported-memory PRIVATE ${COMPILER_OPTIONS}) -add_test(test-exported-memory test-exported-memory) - -target_link_libraries(test-exports general ${WASMER_LIB}) -target_compile_options(test-exports PRIVATE ${COMPILER_OPTIONS}) -add_test(test-exports test-exports) - -target_link_libraries(test-globals general ${WASMER_LIB}) -target_compile_options(test-globals PRIVATE ${COMPILER_OPTIONS}) -add_test(test-globals test-globals) - -target_link_libraries(test-import-object general ${WASMER_LIB}) -target_compile_options(test-import-object PRIVATE ${COMPILER_OPTIONS}) -add_test(test-import-object test-import-object) - -# trampoline functionality not yet implemented -#target_link_libraries(test-import-function general ${WASMER_LIB}) -#target_compile_options(test-import-function PRIVATE ${COMPILER_OPTIONS}) -#add_test(test-import-function test-import-function) - -target_link_libraries(test-import-trap general ${WASMER_LIB}) -target_compile_options(test-import-trap PRIVATE ${COMPILER_OPTIONS}) -add_test(test-import-trap test-import-trap) - -target_link_libraries(test-imports general ${WASMER_LIB}) -target_compile_options(test-imports PRIVATE ${COMPILER_OPTIONS}) -add_test(test-imports test-imports) - -target_link_libraries(test-instantiate general ${WASMER_LIB}) -target_compile_options(test-instantiate PRIVATE ${COMPILER_OPTIONS}) -add_test(test-instantiate test-instantiate) - -target_link_libraries(test-memory general ${WASMER_LIB}) -target_compile_options(test-memory PRIVATE ${COMPILER_OPTIONS}) -add_test(test-memory test-memory) - -target_link_libraries(test-module general ${WASMER_LIB}) -target_compile_options(test-module PRIVATE ${COMPILER_OPTIONS}) -add_test(test-module test-module) - -target_link_libraries(test-module-exports general ${WASMER_LIB}) -target_compile_options(test-module-exports PRIVATE ${COMPILER_OPTIONS}) -add_test(test-module-exports test-module-exports) - -target_link_libraries(test-module-import-instantiate general ${WASMER_LIB}) -target_compile_options(test-module-import-instantiate PRIVATE ${COMPILER_OPTIONS}) -add_test(test-module-import-instantiate test-module-import-instantiate) - -target_link_libraries(test-module-imports general ${WASMER_LIB}) -target_compile_options(test-module-imports PRIVATE ${COMPILER_OPTIONS}) -add_test(test-module-imports test-module-imports) - -target_link_libraries(test-module-serialize general ${WASMER_LIB}) -target_compile_options(test-module-serialize PRIVATE ${COMPILER_OPTIONS}) -add_test(test-module-serialize test-module-serialize) - -target_link_libraries(test-tables general ${WASMER_LIB}) -target_compile_options(test-tables PRIVATE ${COMPILER_OPTIONS}) -add_test(test-tables test-tables) - -target_link_libraries(test-validate general ${WASMER_LIB}) -target_compile_options(test-validate PRIVATE ${COMPILER_OPTIONS}) -add_test(test-validate test-validate) - -if (DEFINED WASI_TESTS) - target_link_libraries(test-wasi-import-object general ${WASMER_LIB}) - target_compile_options(test-wasi-import-object PRIVATE ${COMPILER_OPTIONS}) - # TODO: reenable this test - #add_test(test-wasi-import-object test-wasi-import-object) -endif() - -# TODO: reenable this test -#if (DEFINED EMSCRIPTEN_TESTS) -# target_link_libraries(test-emscripten-import-object general ${WASMER_LIB}) -# target_compile_options(test-emscripten-import-object PRIVATE ${COMPILER_OPTIONS}) -# add_test(test-emscripten-import-object test-emscripten-import-object) -#endif() diff --git a/lib/c-api/tests/deprecated_tests.rs b/lib/c-api/tests/deprecated_tests.rs deleted file mode 100644 index 36a59e101d1..00000000000 --- a/lib/c-api/tests/deprecated_tests.rs +++ /dev/null @@ -1,23 +0,0 @@ -mod test_c_helpers; - -use test_c_helpers::compile_with_cmake_and_run_test; - -#[test] -#[cfg(feature = "deprecated")] -fn test_deprecated_c_api() { - let project_tests_dir = concat!(env!("CARGO_MANIFEST_DIR"), "/tests/deprecated/"); - - let cmake_args = vec![ - ".", - #[cfg(feature = "wasi")] - "-DWASI_TESTS=ON", - #[cfg(feature = "emscripten")] - "-DEMSCRIPTEN_TESTS=ON", - // We need something like this to get this working on Windows, but this doesn't seem - // quite right -- perhaps it's double escaping the quotes? - #[cfg(target_os = "windows")] - r#"-G "MinGW Makefiles""#, - ]; - - compile_with_cmake_and_run_test(project_tests_dir, cmake_args); -} diff --git a/lib/c-api/tests/wasm_c_api/test-early-exit.c b/lib/c-api/tests/test-early-exit.c similarity index 100% rename from lib/c-api/tests/wasm_c_api/test-early-exit.c rename to lib/c-api/tests/test-early-exit.c diff --git a/lib/c-api/tests/wasm_c_api/test-memory.c b/lib/c-api/tests/test-memory.c similarity index 100% rename from lib/c-api/tests/wasm_c_api/test-memory.c rename to lib/c-api/tests/test-memory.c diff --git a/lib/c-api/tests/wasm_c_api/test-wasi.c b/lib/c-api/tests/test-wasi.c similarity index 100% rename from lib/c-api/tests/wasm_c_api/test-wasi.c rename to lib/c-api/tests/test-wasi.c diff --git a/lib/c-api/tests/wasm_c_api/test-wat2wasm.c b/lib/c-api/tests/test-wat2wasm.c similarity index 100% rename from lib/c-api/tests/wasm_c_api/test-wat2wasm.c rename to lib/c-api/tests/test-wat2wasm.c diff --git a/lib/c-api/tests/test_c_helpers/mod.rs b/lib/c-api/tests/test_c_helpers/mod.rs deleted file mode 100644 index 22c3c937a0d..00000000000 --- a/lib/c-api/tests/test_c_helpers/mod.rs +++ /dev/null @@ -1,47 +0,0 @@ -use std::process::Command; - -pub fn compile_with_cmake_and_run_test(project_tests_dir: &str, cmake_args: Vec<&str>) { - run_command( - "rm", - project_tests_dir, - vec![ - "-f", // we use -f so it doesn't fail if the file doesn't exist - "CMakeCache.txt", - ], - ); - run_command("cmake", project_tests_dir, cmake_args); - run_command("make", project_tests_dir, vec!["clean"]); - run_command("make", project_tests_dir, vec!["-Wdev", "-Werror=dev"]); - run_command("make", project_tests_dir, vec!["test", "ARGS=\"-V\""]); -} - -pub fn run_command(command_str: &str, dir: &str, args: Vec<&str>) { - println!( - "Running command: `{}` with arguments: {:?}", - command_str, args - ); - - let mut command = Command::new(command_str); - command.args(&args); - command.current_dir(dir); - - match command.output() { - Ok(result) => { - println!( - "> Status: `{:?}`\n> Stdout: `{}`\n> Stderr: `{}`", - result.status.code(), - String::from_utf8_lossy(&result.stdout[..]), - String::from_utf8_lossy(&result.stderr[..]), - ); - - if result.status.success() { - assert!(true) - } else { - panic!("Command failed with exit status: `{:?}`", result.status); - } - } - Err(error) => panic!("Command failed: `{}`", error), - } - - println!("\n"); -} diff --git a/lib/c-api/tests/wasm_c_api/wasm-c-api/.gitignore b/lib/c-api/tests/wasm-c-api/.gitignore similarity index 100% rename from lib/c-api/tests/wasm_c_api/wasm-c-api/.gitignore rename to lib/c-api/tests/wasm-c-api/.gitignore diff --git a/lib/c-api/tests/wasm_c_api/wasm-c-api/Dockerfile b/lib/c-api/tests/wasm-c-api/Dockerfile similarity index 100% rename from lib/c-api/tests/wasm_c_api/wasm-c-api/Dockerfile rename to lib/c-api/tests/wasm-c-api/Dockerfile diff --git a/lib/c-api/tests/wasm_c_api/wasm-c-api/LICENSE b/lib/c-api/tests/wasm-c-api/LICENSE similarity index 100% rename from lib/c-api/tests/wasm_c_api/wasm-c-api/LICENSE rename to lib/c-api/tests/wasm-c-api/LICENSE diff --git a/lib/c-api/tests/wasm_c_api/wasm-c-api/README.md b/lib/c-api/tests/wasm-c-api/README.md similarity index 100% rename from lib/c-api/tests/wasm_c_api/wasm-c-api/README.md rename to lib/c-api/tests/wasm-c-api/README.md diff --git a/lib/c-api/tests/wasm_c_api/wasm-c-api/example/callback.c b/lib/c-api/tests/wasm-c-api/example/callback.c similarity index 100% rename from lib/c-api/tests/wasm_c_api/wasm-c-api/example/callback.c rename to lib/c-api/tests/wasm-c-api/example/callback.c diff --git a/lib/c-api/tests/wasm_c_api/wasm-c-api/example/callback.cc b/lib/c-api/tests/wasm-c-api/example/callback.cc similarity index 100% rename from lib/c-api/tests/wasm_c_api/wasm-c-api/example/callback.cc rename to lib/c-api/tests/wasm-c-api/example/callback.cc diff --git a/lib/c-api/tests/wasm_c_api/wasm-c-api/example/callback.wasm b/lib/c-api/tests/wasm-c-api/example/callback.wasm similarity index 100% rename from lib/c-api/tests/wasm_c_api/wasm-c-api/example/callback.wasm rename to lib/c-api/tests/wasm-c-api/example/callback.wasm diff --git a/lib/c-api/tests/wasm_c_api/wasm-c-api/example/callback.wat b/lib/c-api/tests/wasm-c-api/example/callback.wat similarity index 100% rename from lib/c-api/tests/wasm_c_api/wasm-c-api/example/callback.wat rename to lib/c-api/tests/wasm-c-api/example/callback.wat diff --git a/lib/c-api/tests/wasm_c_api/wasm-c-api/example/finalize.c b/lib/c-api/tests/wasm-c-api/example/finalize.c similarity index 100% rename from lib/c-api/tests/wasm_c_api/wasm-c-api/example/finalize.c rename to lib/c-api/tests/wasm-c-api/example/finalize.c diff --git a/lib/c-api/tests/wasm_c_api/wasm-c-api/example/finalize.cc b/lib/c-api/tests/wasm-c-api/example/finalize.cc similarity index 100% rename from lib/c-api/tests/wasm_c_api/wasm-c-api/example/finalize.cc rename to lib/c-api/tests/wasm-c-api/example/finalize.cc diff --git a/lib/c-api/tests/wasm_c_api/wasm-c-api/example/finalize.wasm b/lib/c-api/tests/wasm-c-api/example/finalize.wasm similarity index 100% rename from lib/c-api/tests/wasm_c_api/wasm-c-api/example/finalize.wasm rename to lib/c-api/tests/wasm-c-api/example/finalize.wasm diff --git a/lib/c-api/tests/wasm_c_api/wasm-c-api/example/finalize.wat b/lib/c-api/tests/wasm-c-api/example/finalize.wat similarity index 100% rename from lib/c-api/tests/wasm_c_api/wasm-c-api/example/finalize.wat rename to lib/c-api/tests/wasm-c-api/example/finalize.wat diff --git a/lib/c-api/tests/wasm_c_api/wasm-c-api/example/global.c b/lib/c-api/tests/wasm-c-api/example/global.c similarity index 100% rename from lib/c-api/tests/wasm_c_api/wasm-c-api/example/global.c rename to lib/c-api/tests/wasm-c-api/example/global.c diff --git a/lib/c-api/tests/wasm_c_api/wasm-c-api/example/global.cc b/lib/c-api/tests/wasm-c-api/example/global.cc similarity index 100% rename from lib/c-api/tests/wasm_c_api/wasm-c-api/example/global.cc rename to lib/c-api/tests/wasm-c-api/example/global.cc diff --git a/lib/c-api/tests/wasm_c_api/wasm-c-api/example/global.wasm b/lib/c-api/tests/wasm-c-api/example/global.wasm similarity index 100% rename from lib/c-api/tests/wasm_c_api/wasm-c-api/example/global.wasm rename to lib/c-api/tests/wasm-c-api/example/global.wasm diff --git a/lib/c-api/tests/wasm_c_api/wasm-c-api/example/global.wat b/lib/c-api/tests/wasm-c-api/example/global.wat similarity index 100% rename from lib/c-api/tests/wasm_c_api/wasm-c-api/example/global.wat rename to lib/c-api/tests/wasm-c-api/example/global.wat diff --git a/lib/c-api/tests/wasm_c_api/wasm-c-api/example/hello.c b/lib/c-api/tests/wasm-c-api/example/hello.c similarity index 100% rename from lib/c-api/tests/wasm_c_api/wasm-c-api/example/hello.c rename to lib/c-api/tests/wasm-c-api/example/hello.c diff --git a/lib/c-api/tests/wasm_c_api/wasm-c-api/example/hello.cc b/lib/c-api/tests/wasm-c-api/example/hello.cc similarity index 100% rename from lib/c-api/tests/wasm_c_api/wasm-c-api/example/hello.cc rename to lib/c-api/tests/wasm-c-api/example/hello.cc diff --git a/lib/c-api/tests/wasm_c_api/wasm-c-api/example/hello.wasm b/lib/c-api/tests/wasm-c-api/example/hello.wasm similarity index 100% rename from lib/c-api/tests/wasm_c_api/wasm-c-api/example/hello.wasm rename to lib/c-api/tests/wasm-c-api/example/hello.wasm diff --git a/lib/c-api/tests/wasm_c_api/wasm-c-api/example/hello.wat b/lib/c-api/tests/wasm-c-api/example/hello.wat similarity index 100% rename from lib/c-api/tests/wasm_c_api/wasm-c-api/example/hello.wat rename to lib/c-api/tests/wasm-c-api/example/hello.wat diff --git a/lib/c-api/tests/wasm_c_api/wasm-c-api/example/hostref.c b/lib/c-api/tests/wasm-c-api/example/hostref.c similarity index 100% rename from lib/c-api/tests/wasm_c_api/wasm-c-api/example/hostref.c rename to lib/c-api/tests/wasm-c-api/example/hostref.c diff --git a/lib/c-api/tests/wasm_c_api/wasm-c-api/example/hostref.cc b/lib/c-api/tests/wasm-c-api/example/hostref.cc similarity index 100% rename from lib/c-api/tests/wasm_c_api/wasm-c-api/example/hostref.cc rename to lib/c-api/tests/wasm-c-api/example/hostref.cc diff --git a/lib/c-api/tests/wasm_c_api/wasm-c-api/example/hostref.wasm b/lib/c-api/tests/wasm-c-api/example/hostref.wasm similarity index 100% rename from lib/c-api/tests/wasm_c_api/wasm-c-api/example/hostref.wasm rename to lib/c-api/tests/wasm-c-api/example/hostref.wasm diff --git a/lib/c-api/tests/wasm_c_api/wasm-c-api/example/hostref.wat b/lib/c-api/tests/wasm-c-api/example/hostref.wat similarity index 100% rename from lib/c-api/tests/wasm_c_api/wasm-c-api/example/hostref.wat rename to lib/c-api/tests/wasm-c-api/example/hostref.wat diff --git a/lib/c-api/tests/wasm_c_api/wasm-c-api/example/memory.c b/lib/c-api/tests/wasm-c-api/example/memory.c similarity index 100% rename from lib/c-api/tests/wasm_c_api/wasm-c-api/example/memory.c rename to lib/c-api/tests/wasm-c-api/example/memory.c diff --git a/lib/c-api/tests/wasm_c_api/wasm-c-api/example/memory.cc b/lib/c-api/tests/wasm-c-api/example/memory.cc similarity index 100% rename from lib/c-api/tests/wasm_c_api/wasm-c-api/example/memory.cc rename to lib/c-api/tests/wasm-c-api/example/memory.cc diff --git a/lib/c-api/tests/wasm_c_api/wasm-c-api/example/memory.wasm b/lib/c-api/tests/wasm-c-api/example/memory.wasm similarity index 100% rename from lib/c-api/tests/wasm_c_api/wasm-c-api/example/memory.wasm rename to lib/c-api/tests/wasm-c-api/example/memory.wasm diff --git a/lib/c-api/tests/wasm_c_api/wasm-c-api/example/memory.wat b/lib/c-api/tests/wasm-c-api/example/memory.wat similarity index 100% rename from lib/c-api/tests/wasm_c_api/wasm-c-api/example/memory.wat rename to lib/c-api/tests/wasm-c-api/example/memory.wat diff --git a/lib/c-api/tests/wasm_c_api/wasm-c-api/example/multi.c b/lib/c-api/tests/wasm-c-api/example/multi.c similarity index 100% rename from lib/c-api/tests/wasm_c_api/wasm-c-api/example/multi.c rename to lib/c-api/tests/wasm-c-api/example/multi.c diff --git a/lib/c-api/tests/wasm_c_api/wasm-c-api/example/multi.cc b/lib/c-api/tests/wasm-c-api/example/multi.cc similarity index 100% rename from lib/c-api/tests/wasm_c_api/wasm-c-api/example/multi.cc rename to lib/c-api/tests/wasm-c-api/example/multi.cc diff --git a/lib/c-api/tests/wasm_c_api/wasm-c-api/example/multi.wasm b/lib/c-api/tests/wasm-c-api/example/multi.wasm similarity index 100% rename from lib/c-api/tests/wasm_c_api/wasm-c-api/example/multi.wasm rename to lib/c-api/tests/wasm-c-api/example/multi.wasm diff --git a/lib/c-api/tests/wasm_c_api/wasm-c-api/example/multi.wat b/lib/c-api/tests/wasm-c-api/example/multi.wat similarity index 100% rename from lib/c-api/tests/wasm_c_api/wasm-c-api/example/multi.wat rename to lib/c-api/tests/wasm-c-api/example/multi.wat diff --git a/lib/c-api/tests/wasm_c_api/wasm-c-api/example/reflect.c b/lib/c-api/tests/wasm-c-api/example/reflect.c similarity index 100% rename from lib/c-api/tests/wasm_c_api/wasm-c-api/example/reflect.c rename to lib/c-api/tests/wasm-c-api/example/reflect.c diff --git a/lib/c-api/tests/wasm_c_api/wasm-c-api/example/reflect.cc b/lib/c-api/tests/wasm-c-api/example/reflect.cc similarity index 100% rename from lib/c-api/tests/wasm_c_api/wasm-c-api/example/reflect.cc rename to lib/c-api/tests/wasm-c-api/example/reflect.cc diff --git a/lib/c-api/tests/wasm_c_api/wasm-c-api/example/reflect.wasm b/lib/c-api/tests/wasm-c-api/example/reflect.wasm similarity index 100% rename from lib/c-api/tests/wasm_c_api/wasm-c-api/example/reflect.wasm rename to lib/c-api/tests/wasm-c-api/example/reflect.wasm diff --git a/lib/c-api/tests/wasm_c_api/wasm-c-api/example/reflect.wat b/lib/c-api/tests/wasm-c-api/example/reflect.wat similarity index 100% rename from lib/c-api/tests/wasm_c_api/wasm-c-api/example/reflect.wat rename to lib/c-api/tests/wasm-c-api/example/reflect.wat diff --git a/lib/c-api/tests/wasm_c_api/wasm-c-api/example/serialize.c b/lib/c-api/tests/wasm-c-api/example/serialize.c similarity index 100% rename from lib/c-api/tests/wasm_c_api/wasm-c-api/example/serialize.c rename to lib/c-api/tests/wasm-c-api/example/serialize.c diff --git a/lib/c-api/tests/wasm_c_api/wasm-c-api/example/serialize.cc b/lib/c-api/tests/wasm-c-api/example/serialize.cc similarity index 100% rename from lib/c-api/tests/wasm_c_api/wasm-c-api/example/serialize.cc rename to lib/c-api/tests/wasm-c-api/example/serialize.cc diff --git a/lib/c-api/tests/wasm_c_api/wasm-c-api/example/serialize.wasm b/lib/c-api/tests/wasm-c-api/example/serialize.wasm similarity index 100% rename from lib/c-api/tests/wasm_c_api/wasm-c-api/example/serialize.wasm rename to lib/c-api/tests/wasm-c-api/example/serialize.wasm diff --git a/lib/c-api/tests/wasm_c_api/wasm-c-api/example/serialize.wat b/lib/c-api/tests/wasm-c-api/example/serialize.wat similarity index 100% rename from lib/c-api/tests/wasm_c_api/wasm-c-api/example/serialize.wat rename to lib/c-api/tests/wasm-c-api/example/serialize.wat diff --git a/lib/c-api/tests/wasm_c_api/wasm-c-api/example/start.c b/lib/c-api/tests/wasm-c-api/example/start.c similarity index 100% rename from lib/c-api/tests/wasm_c_api/wasm-c-api/example/start.c rename to lib/c-api/tests/wasm-c-api/example/start.c diff --git a/lib/c-api/tests/wasm_c_api/wasm-c-api/example/start.cc b/lib/c-api/tests/wasm-c-api/example/start.cc similarity index 100% rename from lib/c-api/tests/wasm_c_api/wasm-c-api/example/start.cc rename to lib/c-api/tests/wasm-c-api/example/start.cc diff --git a/lib/c-api/tests/wasm_c_api/wasm-c-api/example/start.wasm b/lib/c-api/tests/wasm-c-api/example/start.wasm similarity index 100% rename from lib/c-api/tests/wasm_c_api/wasm-c-api/example/start.wasm rename to lib/c-api/tests/wasm-c-api/example/start.wasm diff --git a/lib/c-api/tests/wasm_c_api/wasm-c-api/example/start.wat b/lib/c-api/tests/wasm-c-api/example/start.wat similarity index 100% rename from lib/c-api/tests/wasm_c_api/wasm-c-api/example/start.wat rename to lib/c-api/tests/wasm-c-api/example/start.wat diff --git a/lib/c-api/tests/wasm_c_api/wasm-c-api/example/table.c b/lib/c-api/tests/wasm-c-api/example/table.c similarity index 100% rename from lib/c-api/tests/wasm_c_api/wasm-c-api/example/table.c rename to lib/c-api/tests/wasm-c-api/example/table.c diff --git a/lib/c-api/tests/wasm_c_api/wasm-c-api/example/table.cc b/lib/c-api/tests/wasm-c-api/example/table.cc similarity index 100% rename from lib/c-api/tests/wasm_c_api/wasm-c-api/example/table.cc rename to lib/c-api/tests/wasm-c-api/example/table.cc diff --git a/lib/c-api/tests/wasm_c_api/wasm-c-api/example/table.wasm b/lib/c-api/tests/wasm-c-api/example/table.wasm similarity index 100% rename from lib/c-api/tests/wasm_c_api/wasm-c-api/example/table.wasm rename to lib/c-api/tests/wasm-c-api/example/table.wasm diff --git a/lib/c-api/tests/wasm_c_api/wasm-c-api/example/table.wat b/lib/c-api/tests/wasm-c-api/example/table.wat similarity index 100% rename from lib/c-api/tests/wasm_c_api/wasm-c-api/example/table.wat rename to lib/c-api/tests/wasm-c-api/example/table.wat diff --git a/lib/c-api/tests/wasm_c_api/wasm-c-api/example/threads.c b/lib/c-api/tests/wasm-c-api/example/threads.c similarity index 100% rename from lib/c-api/tests/wasm_c_api/wasm-c-api/example/threads.c rename to lib/c-api/tests/wasm-c-api/example/threads.c diff --git a/lib/c-api/tests/wasm_c_api/wasm-c-api/example/threads.cc b/lib/c-api/tests/wasm-c-api/example/threads.cc similarity index 100% rename from lib/c-api/tests/wasm_c_api/wasm-c-api/example/threads.cc rename to lib/c-api/tests/wasm-c-api/example/threads.cc diff --git a/lib/c-api/tests/wasm_c_api/wasm-c-api/example/threads.wasm b/lib/c-api/tests/wasm-c-api/example/threads.wasm similarity index 100% rename from lib/c-api/tests/wasm_c_api/wasm-c-api/example/threads.wasm rename to lib/c-api/tests/wasm-c-api/example/threads.wasm diff --git a/lib/c-api/tests/wasm_c_api/wasm-c-api/example/threads.wat b/lib/c-api/tests/wasm-c-api/example/threads.wat similarity index 100% rename from lib/c-api/tests/wasm_c_api/wasm-c-api/example/threads.wat rename to lib/c-api/tests/wasm-c-api/example/threads.wat diff --git a/lib/c-api/tests/wasm_c_api/wasm-c-api/example/trap.c b/lib/c-api/tests/wasm-c-api/example/trap.c similarity index 100% rename from lib/c-api/tests/wasm_c_api/wasm-c-api/example/trap.c rename to lib/c-api/tests/wasm-c-api/example/trap.c diff --git a/lib/c-api/tests/wasm_c_api/wasm-c-api/example/trap.cc b/lib/c-api/tests/wasm-c-api/example/trap.cc similarity index 100% rename from lib/c-api/tests/wasm_c_api/wasm-c-api/example/trap.cc rename to lib/c-api/tests/wasm-c-api/example/trap.cc diff --git a/lib/c-api/tests/wasm_c_api/wasm-c-api/example/trap.wasm b/lib/c-api/tests/wasm-c-api/example/trap.wasm similarity index 100% rename from lib/c-api/tests/wasm_c_api/wasm-c-api/example/trap.wasm rename to lib/c-api/tests/wasm-c-api/example/trap.wasm diff --git a/lib/c-api/tests/wasm_c_api/wasm-c-api/example/trap.wat b/lib/c-api/tests/wasm-c-api/example/trap.wat similarity index 100% rename from lib/c-api/tests/wasm_c_api/wasm-c-api/example/trap.wat rename to lib/c-api/tests/wasm-c-api/example/trap.wat diff --git a/lib/c-api/tests/wasm_c_api/wasm-c-api/include/wasm.h b/lib/c-api/tests/wasm-c-api/include/wasm.h similarity index 100% rename from lib/c-api/tests/wasm_c_api/wasm-c-api/include/wasm.h rename to lib/c-api/tests/wasm-c-api/include/wasm.h diff --git a/lib/c-api/tests/wasm_c_api/wasm-c-api/include/wasm.hh b/lib/c-api/tests/wasm-c-api/include/wasm.hh similarity index 100% rename from lib/c-api/tests/wasm_c_api/wasm-c-api/include/wasm.hh rename to lib/c-api/tests/wasm-c-api/include/wasm.hh diff --git a/lib/c-api/tests/wasm_c_api/wasm-c-api/patch/0001-BUILD.gn-add-wasm-v8-lowlevel.patch b/lib/c-api/tests/wasm-c-api/patch/0001-BUILD.gn-add-wasm-v8-lowlevel.patch similarity index 100% rename from lib/c-api/tests/wasm_c_api/wasm-c-api/patch/0001-BUILD.gn-add-wasm-v8-lowlevel.patch rename to lib/c-api/tests/wasm-c-api/patch/0001-BUILD.gn-add-wasm-v8-lowlevel.patch diff --git a/lib/c-api/tests/wasm_c_api/wasm-c-api/src/wasm-bin.cc b/lib/c-api/tests/wasm-c-api/src/wasm-bin.cc similarity index 100% rename from lib/c-api/tests/wasm_c_api/wasm-c-api/src/wasm-bin.cc rename to lib/c-api/tests/wasm-c-api/src/wasm-bin.cc diff --git a/lib/c-api/tests/wasm_c_api/wasm-c-api/src/wasm-bin.hh b/lib/c-api/tests/wasm-c-api/src/wasm-bin.hh similarity index 100% rename from lib/c-api/tests/wasm_c_api/wasm-c-api/src/wasm-bin.hh rename to lib/c-api/tests/wasm-c-api/src/wasm-bin.hh diff --git a/lib/c-api/tests/wasm_c_api/wasm-c-api/src/wasm-c.cc b/lib/c-api/tests/wasm-c-api/src/wasm-c.cc similarity index 100% rename from lib/c-api/tests/wasm_c_api/wasm-c-api/src/wasm-c.cc rename to lib/c-api/tests/wasm-c-api/src/wasm-c.cc diff --git a/lib/c-api/tests/wasm_c_api/wasm-c-api/src/wasm-v8-lowlevel.cc b/lib/c-api/tests/wasm-c-api/src/wasm-v8-lowlevel.cc similarity index 100% rename from lib/c-api/tests/wasm_c_api/wasm-c-api/src/wasm-v8-lowlevel.cc rename to lib/c-api/tests/wasm-c-api/src/wasm-v8-lowlevel.cc diff --git a/lib/c-api/tests/wasm_c_api/wasm-c-api/src/wasm-v8-lowlevel.hh b/lib/c-api/tests/wasm-c-api/src/wasm-v8-lowlevel.hh similarity index 100% rename from lib/c-api/tests/wasm_c_api/wasm-c-api/src/wasm-v8-lowlevel.hh rename to lib/c-api/tests/wasm-c-api/src/wasm-v8-lowlevel.hh diff --git a/lib/c-api/tests/wasm_c_api/wasm-c-api/src/wasm-v8.cc b/lib/c-api/tests/wasm-c-api/src/wasm-v8.cc similarity index 100% rename from lib/c-api/tests/wasm_c_api/wasm-c-api/src/wasm-v8.cc rename to lib/c-api/tests/wasm-c-api/src/wasm-v8.cc diff --git a/lib/c-api/tests/wasm_c_api/.gitignore b/lib/c-api/tests/wasm_c_api/.gitignore deleted file mode 100644 index 4340312fa37..00000000000 --- a/lib/c-api/tests/wasm_c_api/.gitignore +++ /dev/null @@ -1,17 +0,0 @@ -CMakeLists.txt.user -CMakeCache.txt -CMakeFiles -CMakeScripts -Testing -Makefile -cmake_install.cmake -install_manifest.txt -compile_commands.json -CTestTestfile.cmake -_deps -rust-build - -wasm-c-api-* -test-* -# Unignore files ending with `.c` (i.e. `wasm-c-api-wasi.c`) -!*.c diff --git a/lib/c-api/tests/wasm_c_api/CMakeLists.txt b/lib/c-api/tests/wasm_c_api/CMakeLists.txt deleted file mode 100644 index 98c39b49f31..00000000000 --- a/lib/c-api/tests/wasm_c_api/CMakeLists.txt +++ /dev/null @@ -1,155 +0,0 @@ -cmake_minimum_required (VERSION 2.6) -project (WasmerWasmCApiTests) - -# Examples as tests from the `wasm-c-api` repository. -add_executable(wasm-c-api-callback wasm-c-api/example/callback.c) -#add_executable(wasm-c-api-finalize wasm-c-api/example/finalize.c) -add_executable(wasm-c-api-global wasm-c-api/example/global.c) -add_executable(wasm-c-api-hello wasm-c-api/example/hello.c) -#add_executable(wasm-c-api-hostref wasm-c-api/example/hostref.c) -add_executable(wasm-c-api-memory wasm-c-api/example/memory.c) -#add_executable(wasm-c-api-multi wasm-c-api/example/multi.c) -add_executable(wasm-c-api-reflect wasm-c-api/example/reflect.c) -add_executable(wasm-c-api-serialize wasm-c-api/example/serialize.c) -add_executable(wasm-c-api-start wasm-c-api/example/start.c) -#add_executable(wasm-c-api-table wasm-c-api/example/table.c) -#add_executable(wasm-c-api-threads wasm-c-api/example/threads.c) -add_executable(wasm-c-api-trap wasm-c-api/example/trap.c) - -# Our additional tests. -add_executable(test-early-exit test-early-exit.c) -add_executable(test-memory test-memory.c) -add_executable(test-wasi test-wasi.c) -add_executable(test-wat2wasm test-wat2wasm.c) - -include_directories(wasm-c-api/include) -include_directories(../../) - -find_library( - WASMER_LIB NAMES libwasmer_c_api.dylib libwasmer_c_api.so wasmer_c_api.dll - PATHS ${CMAKE_SOURCE_DIR}/../../../../target/release/ - REQUIRED -) - -enable_testing() - -set( - COMPILER_OPTIONS - # Clang or gcc - $<$,$>: - "-Werror" > - # MSVC - $<$: - "/WX" > -) - -target_link_libraries(wasm-c-api-callback general ${WASMER_LIB}) -target_compile_options(wasm-c-api-callback PRIVATE ${COMPILER_OPTIONS}) -add_test(NAME wasm-c-api-callback - COMMAND wasm-c-api-callback - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/wasm-c-api/example/ -) - -#target_link_libraries(wasm-c-api-finalize general ${WASMER_LIB}) -#target_compile_options(wasm-c-api-finalize PRIVATE ${COMPILER_OPTIONS}) -#add_test(NAME wasm-c-api-finalize -# COMMAND wasm-c-api-finalize -# WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/wasm-c-api/example/ -#) - -target_link_libraries(wasm-c-api-global general ${WASMER_LIB}) -target_compile_options(wasm-c-api-global PRIVATE ${COMPILER_OPTIONS}) -add_test(NAME wasm-c-api-global - COMMAND wasm-c-api-global - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/wasm-c-api/example/ -) - -target_link_libraries(wasm-c-api-hello general ${WASMER_LIB}) -target_compile_options(wasm-c-api-hello PRIVATE ${COMPILER_OPTIONS}) -add_test(NAME wasm-c-api-hello - COMMAND wasm-c-api-hello - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/wasm-c-api/example/ -) - -#target_link_libraries(wasm-c-api-hostref general ${WASMER_LIB}) -#target_compile_options(wasm-c-api-hostref PRIVATE ${COMPILER_OPTIONS}) -#add_test(NAME wasm-c-api-hostref -# COMMAND wasm-c-api-hostref -# WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/wasm-c-api/example/ -#) - -target_link_libraries(wasm-c-api-memory general ${WASMER_LIB}) -target_compile_options(wasm-c-api-memory PRIVATE ${COMPILER_OPTIONS}) -add_test(NAME wasm-c-api-memory - COMMAND wasm-c-api-memory - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/wasm-c-api/example/ -) - -#target_link_libraries(wasm-c-api-multi general ${WASMER_LIB}) -#target_compile_options(wasm-c-api-multi PRIVATE ${COMPILER_OPTIONS}) -#add_test(NAME wasm-c-api-multi -# COMMAND wasm-c-api-multi -# WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/wasm-c-api/example/ -#) - -target_link_libraries(wasm-c-api-reflect general ${WASMER_LIB}) -target_compile_options(wasm-c-api-reflect PRIVATE ${COMPILER_OPTIONS}) -add_test(NAME wasm-c-api-reflect - COMMAND wasm-c-api-reflect - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/wasm-c-api/example/ -) - -target_link_libraries(wasm-c-api-serialize general ${WASMER_LIB}) -target_compile_options(wasm-c-api-serialize PRIVATE ${COMPILER_OPTIONS}) -add_test(NAME wasm-c-api-serialize - COMMAND wasm-c-api-serialize - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/wasm-c-api/example/ -) - -target_link_libraries(wasm-c-api-start general ${WASMER_LIB}) -target_compile_options(wasm-c-api-start PRIVATE ${COMPILER_OPTIONS}) -add_test(NAME wasm-c-api-start - COMMAND wasm-c-api-start - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/wasm-c-api/example/ -) - -#target_link_libraries(wasm-c-api-table general ${WASMER_LIB}) -#target_compile_options(wasm-c-api-table PRIVATE ${COMPILER_OPTIONS}) -#add_test(NAME wasm-c-api-table -# COMMAND wasm-c-api-table -# WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/wasm-c-api/example/ -#) - -#target_link_libraries(wasm-c-api-threads general ${WASMER_LIB}) -#target_compile_options(wasm-c-api-threads PRIVATE ${COMPILER_OPTIONS}) -#add_test(NAME wasm-c-api-threads -# COMMAND wasm-c-api-threads -# WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/wasm-c-api/example/ -#) - -target_link_libraries(wasm-c-api-trap general ${WASMER_LIB}) -target_compile_options(wasm-c-api-trap PRIVATE ${COMPILER_OPTIONS}) -add_test(NAME wasm-c-api-trap - COMMAND wasm-c-api-trap - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/wasm-c-api/example/ -) - -set_property(TARGET test-early-exit PROPERTY C_STANDARD 11) -target_link_libraries(test-early-exit general ${WASMER_LIB}) -target_compile_options(test-early-exit PRIVATE ${COMPILER_OPTIONS}) -add_test(test-early-exit test-early-exit) - -set_property(TARGET test-memory PROPERTY C_STANDARD 11) -target_link_libraries(test-memory general ${WASMER_LIB}) -target_compile_options(test-memory PRIVATE ${COMPILER_OPTIONS}) -add_test(test-memory test-memory) - -set_property(TARGET test-wasi PROPERTY C_STANDARD 11) -target_link_libraries(test-wasi general ${WASMER_LIB}) -target_compile_options(test-wasi PRIVATE ${COMPILER_OPTIONS}) -add_test(test-wasi test-wasi) - -set_property(TARGET test-wat2wasm PROPERTY C_STANDARD 11) -target_link_libraries(test-wat2wasm general ${WASMER_LIB}) -target_compile_options(test-wat2wasm PRIVATE ${COMPILER_OPTIONS}) -add_test(test-wat2wasm test-wat2wasm) diff --git a/lib/c-api/tests/wasm_c_api_tests.rs b/lib/c-api/tests/wasm_c_api_tests.rs deleted file mode 100644 index 4f838ee530a..00000000000 --- a/lib/c-api/tests/wasm_c_api_tests.rs +++ /dev/null @@ -1,18 +0,0 @@ -mod test_c_helpers; - -use test_c_helpers::compile_with_cmake_and_run_test; - -#[test] -fn test_wasm_c_api() { - let project_tests_dir = concat!(env!("CARGO_MANIFEST_DIR"), "/tests/wasm_c_api/"); - - let cmake_args = vec![ - ".", - // We need something like this to get this working on Windows, but this doesn't seem - // quite right -- perhaps it's double escaping the quotes? - #[cfg(target_os = "windows")] - r#"-G "MinGW Makefiles""#, - ]; - - compile_with_cmake_and_run_test(project_tests_dir, cmake_args); -} diff --git a/lib/c-api/wasm.h b/lib/c-api/wasm.h index 3202a8f6dd9..14a5311999f 120000 --- a/lib/c-api/wasm.h +++ b/lib/c-api/wasm.h @@ -1 +1 @@ -tests/wasm_c_api/wasm-c-api/include/wasm.h \ No newline at end of file +tests/wasm-c-api/include/wasm.h \ No newline at end of file diff --git a/tests/integration/cli/assets/qjs.wasm b/tests/integration/cli/assets/qjs.wasm deleted file mode 120000 index acf393b8bd2..00000000000 --- a/tests/integration/cli/assets/qjs.wasm +++ /dev/null @@ -1 +0,0 @@ -../../../../lib/c-api/tests/wasm_c_api/assets/qjs.wasm \ No newline at end of file diff --git a/tests/integration/cli/assets/wasm.h b/tests/integration/cli/assets/wasm.h deleted file mode 120000 index 2e4ac6e9322..00000000000 --- a/tests/integration/cli/assets/wasm.h +++ /dev/null @@ -1 +0,0 @@ -../../../../lib/c-api/wasm.h \ No newline at end of file diff --git a/tests/integration/cli/assets/wasmer_wasm.h b/tests/integration/cli/assets/wasmer_wasm.h deleted file mode 120000 index ba89eb02926..00000000000 --- a/tests/integration/cli/assets/wasmer_wasm.h +++ /dev/null @@ -1 +0,0 @@ -../../../../lib/c-api/wasmer_wasm.h \ No newline at end of file diff --git a/tests/integration/cli/src/assets.rs b/tests/integration/cli/src/assets.rs index 4113e0b5cb8..f3ca082a6be 100644 --- a/tests/integration/cli/src/assets.rs +++ b/tests/integration/cli/src/assets.rs @@ -1,7 +1,12 @@ use std::env; use std::path::PathBuf; -pub const ASSET_PATH: &str = concat!(env!("CARGO_MANIFEST_DIR"), "/assets"); +pub const ASSET_PATH: &str = concat!( + env!("CARGO_MANIFEST_DIR"), + "/../../../lib/c-api/tests/assets" +); + +pub const WASMER_INCLUDE_PATH: &str = concat!(env!("CARGO_MANIFEST_DIR"), "/../../../lib/c-api"); pub const WASMER_PATH: &str = concat!( env!("CARGO_MANIFEST_DIR"), diff --git a/tests/integration/cli/tests/compile.rs b/tests/integration/cli/tests/compile.rs index 8b981ead4a7..fc74a4e0e11 100644 --- a/tests/integration/cli/tests/compile.rs +++ b/tests/integration/cli/tests/compile.rs @@ -96,7 +96,7 @@ fn run_c_compile( .arg("-c") .arg(path_to_c_src) .arg("-I") - .arg(ASSET_PATH) + .arg(WASMER_INCLUDE_PATH) .arg("-o") .arg(output_name) .output()?;