1060: Test the capi with multiple backends r=syrusakbary a=syrusakbary

<!-- 
Prior to submitting a PR, review the CONTRIBUTING.md document for recommendations on how to test:
https://github.com/wasmerio/wasmer/blob/master/CONTRIBUTING.md#pull-requests

-->

# Description

This PR updates the codebase to test the capi with multiple backends.
<!-- 
Provide details regarding the change including motivation,
links to related issues, and the context of the PR.
-->

# Review

- [x] Add a short description of the the change to the CHANGELOG.md file


Co-authored-by: Syrus <me@syrusakbary.com>
Co-authored-by: Syrus Akbary <me@syrusakbary.com>
This commit is contained in:
bors[bot] 2019-12-13 19:54:21 +00:00 committed by GitHub
commit 17aecf9541
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 34 additions and 11 deletions

View File

@ -2,6 +2,7 @@
## **[Unreleased]** ## **[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. - [#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. - [#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 - [#1056](https://github.com/wasmerio/wasmer/pull/1056) Improved `--invoke` args parsing (supporting `i32`, `i64`, `f32` and `f32`) in Wasmer CLI

View File

@ -102,12 +102,34 @@ llvm: spectests-llvm emtests-llvm wasitests-llvm
# All tests # All tests
capi: capi-singlepass:
cargo build --release --features backend-cranelift cargo build --manifest-path lib/runtime-c-api/Cargo.toml --release \
cargo build -p wasmer-runtime-c-api --release --no-default-features --features singlepass-backend,wasi
test-capi: capi capi-cranelift:
cargo test -p wasmer-runtime-c-api --release 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: test-capi-singlepass test-capi-cranelift test-capi-llvm
capi-test: test-capi capi-test: test-capi

View File

@ -180,30 +180,30 @@ jobs:
- checkout: self - checkout: self
submodules: true submodules: true
- template: .azure/install-rust.yml - template: .azure/install-rust.yml
# - template: .azure/install-llvm.yml - template: .azure/install-llvm.yml
- template: .azure/install-sccache.yml - template: .azure/install-sccache.yml
- template: .azure/install-cmake.yml - template: .azure/install-cmake.yml
- bash: | - bash: |
mkdir -p artifacts mkdir -p artifacts
displayName: Create Artifacts Dir displayName: Create Artifacts Dir
- bash: | - bash: |
make capi
make test-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 cp target/release/libwasmer_runtime_c_api.so ./artifacts
find target/release/build -name 'wasmer.h*' -exec cp {} ./artifacts ';' find target/release/build -name 'wasmer.h*' -exec cp {} ./artifacts ';'
displayName: Build c-api (Linux) displayName: Build c-api (Linux)
condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux')) condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux'))
- bash: | - bash: |
make capi make capi
make test-capi
install_name_tool -id "@rpath/libwasmer_runtime_c_api.dylib" target/release/libwasmer_runtime_c_api.dylib 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 cp target/release/libwasmer_runtime_c_api.dylib ./artifacts
displayName: Build c-api (Darwin) displayName: Build c-api (Darwin)
condition: and(succeeded(), eq(variables['Agent.OS'], 'Darwin')) condition: and(succeeded(), eq(variables['Agent.OS'], 'Darwin'))
- bash: | - bash: |
make capi make capi
# Tests are failing on Windows, comment for now
# make test-capi
cp target/release/wasmer_runtime_c_api.dll ./artifacts cp target/release/wasmer_runtime_c_api.dll ./artifacts
displayName: Build c-api (Windows) displayName: Build c-api (Windows)
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT')) condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))

View File

@ -35,9 +35,9 @@ optional = true
[features] [features]
default = ["cranelift-backend", "wasi"] default = ["cranelift-backend", "wasi"]
debug = ["wasmer-runtime/debug"] debug = ["wasmer-runtime/debug"]
singlepass-backend = ["wasmer-runtime/singlepass", "wasmer-runtime/default-backend-singlepass"]
cranelift-backend = ["wasmer-runtime/cranelift", "wasmer-runtime/default-backend-cranelift"] cranelift-backend = ["wasmer-runtime/cranelift", "wasmer-runtime/default-backend-cranelift"]
llvm-backend = ["wasmer-runtime/llvm", "wasmer-runtime/default-backend-llvm"] llvm-backend = ["wasmer-runtime/llvm", "wasmer-runtime/default-backend-llvm"]
singlepass-backend = ["wasmer-runtime/singlepass", "wasmer-runtime/default-backend-singlepass"]
wasi = ["wasmer-wasi"] wasi = ["wasmer-wasi"]
[build-dependencies] [build-dependencies]