From 39f5a7925486113e30f5b73eb4e863cfb6664e1f Mon Sep 17 00:00:00 2001 From: Syrus Date: Thu, 12 Dec 2019 16:38:58 -0800 Subject: [PATCH 1/3] Test the capi with multiple backends --- Makefile | 32 +++++++++++++++++++++++++++----- azure-pipelines.yml | 8 ++++---- lib/runtime-c-api/Cargo.toml | 2 +- 3 files changed, 32 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 935a6a69218..0a4d806980b 100644 --- a/Makefile +++ b/Makefile @@ -102,12 +102,34 @@ llvm: spectests-llvm emtests-llvm wasitests-llvm # All tests -capi: - cargo build --release --features backend-cranelift - cargo build -p wasmer-runtime-c-api --release +capi-singlepass: + cargo build --manifest-path lib/runtime-c-api/Cargo.toml --release \ + --no-default-features --features singlepass-backend,wasi + +capi-cranelift: + cargo build --manifest-path lib/runtime-c-api/Cargo.toml --release \ + --no-default-features --features cranelift-backend,wasi + +capi-llvm: + cargo build --manifest-path lib/runtime-c-api/Cargo.toml --release \ + --no-default-features --features llvm-backend,wasi + +# We use cranelift as the default backend for the capi for now +capi: capi-cranelift + +test-capi-singlepass: capi-singlepass + cargo test --manifest-path lib/runtime-c-api/Cargo.toml --release \ + --no-default-features --features singlepass-backend,wasi + +test-capi-cranelift: capi-cranelift + cargo test --manifest-path lib/runtime-c-api/Cargo.toml --release \ + --no-default-features --features cranelift-backend,wasi + +test-capi-llvm: capi-llvm + cargo test --manifest-path lib/runtime-c-api/Cargo.toml --release \ + --no-default-features --features llvm-backend,wasi -test-capi: capi - cargo test -p wasmer-runtime-c-api --release +test-capi: test-capi-singlepass test-capi-cranelift test-capi-llvm capi-test: test-capi diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 6ad407923c4..43a32604d20 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -187,23 +187,23 @@ jobs: mkdir -p artifacts displayName: Create Artifacts Dir - bash: | - make capi make test-capi + displayName: Test c-api + condition: and(succeeded(), not(eq(variables['Agent.OS'], 'Windows_NT'))) + - bash: | + make capi cp target/release/libwasmer_runtime_c_api.so ./artifacts find target/release/build -name 'wasmer.h*' -exec cp {} ./artifacts ';' displayName: Build c-api (Linux) condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux')) - bash: | make capi - make test-capi install_name_tool -id "@rpath/libwasmer_runtime_c_api.dylib" target/release/libwasmer_runtime_c_api.dylib cp target/release/libwasmer_runtime_c_api.dylib ./artifacts displayName: Build c-api (Darwin) condition: and(succeeded(), eq(variables['Agent.OS'], 'Darwin')) - bash: | make capi - # Tests are failing on Windows, comment for now - # make test-capi cp target/release/wasmer_runtime_c_api.dll ./artifacts displayName: Build c-api (Windows) condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT')) diff --git a/lib/runtime-c-api/Cargo.toml b/lib/runtime-c-api/Cargo.toml index 0a278b6ba2e..39046d3d187 100644 --- a/lib/runtime-c-api/Cargo.toml +++ b/lib/runtime-c-api/Cargo.toml @@ -35,9 +35,9 @@ optional = true [features] default = ["cranelift-backend", "wasi"] debug = ["wasmer-runtime/debug"] +singlepass-backend = ["wasmer-runtime/singlepass", "wasmer-runtime/default-backend-singlepass"] cranelift-backend = ["wasmer-runtime/cranelift", "wasmer-runtime/default-backend-cranelift"] llvm-backend = ["wasmer-runtime/llvm", "wasmer-runtime/default-backend-llvm"] -singlepass-backend = ["wasmer-runtime/singlepass", "wasmer-runtime/default-backend-singlepass"] wasi = ["wasmer-wasi"] [build-dependencies] From 8a2a429a2dc87ca5afcd1983a1a12601f59508e9 Mon Sep 17 00:00:00 2001 From: Syrus Date: Thu, 12 Dec 2019 17:05:36 -0800 Subject: [PATCH 2/3] Added changes to the changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5292539c29d..74c52c61352 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## **[Unreleased]** +- [#1060](https://github.com/wasmerio/wasmer/pull/1060) Test the capi with all the backends - [#1058](https://github.com/wasmerio/wasmer/pull/1058) Fix minor panic issue when `wasmer::compile_with` called with llvm backend. - [#858](https://github.com/wasmerio/wasmer/pull/858) Minor panic fix when wasmer binary with `loader` option run a module without exported `_start` function. - [#1056](https://github.com/wasmerio/wasmer/pull/1056) Improved `--invoke` args parsing (supporting `i32`, `i64`, `f32` and `f32`) in Wasmer CLI From 6946d6883a88835117836f2a55cc215d1ce7d3e9 Mon Sep 17 00:00:00 2001 From: Syrus Date: Fri, 13 Dec 2019 11:52:59 -0800 Subject: [PATCH 3/3] Install LLVM for the CAPI --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 43a32604d20..6308d422bc6 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -180,7 +180,7 @@ jobs: - checkout: self submodules: true - template: .azure/install-rust.yml - # - template: .azure/install-llvm.yml + - template: .azure/install-llvm.yml - template: .azure/install-sccache.yml - template: .azure/install-cmake.yml - bash: |