Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert #3145 #3344

Merged
merged 16 commits into from
Nov 23, 2022
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 11 additions & 14 deletions .github/workflows/test-sys.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -202,20 +202,6 @@ jobs:
'${{ runner.tool_cache }}/cargo-sccache/bin/sccache' -s
echo 'RUSTC_WRAPPER=${{ runner.tool_cache }}/cargo-sccache/bin/sccache' >> $GITHUB_ENV
shell: bash
- name: Test integration CLI
if: matrix.run_test && matrix.os != 'windows-2019'
shell: bash
run: |
make && make build-wasmer && make build-capi && make package-capi && make package
export WASMER_DIR=`pwd`/package
make test-integration-cli
env:
TARGET: ${{ matrix.target }}
TARGET_DIR: target/${{ matrix.target }}/release
CARGO_TARGET: --target ${{ matrix.target }}
WAPM_DEV_TOKEN: ${{ secrets.WAPM_DEV_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

fschutt marked this conversation as resolved.
Show resolved Hide resolved
#- name: Test integration CLI
# if: matrix.run_test && matrix.os == 'windows-2019'
# shell: bash
Expand Down Expand Up @@ -261,6 +247,17 @@ jobs:
shell: bash
run: |
export WASMER_DIR=`pwd`/package && make test-capi
- name: Test integration CLI
if: matrix.run_test && matrix.os != 'windows-2019'
shell: bash
run: |
make build-wasmer && make build-capi && make package-capi && make package && export WASMER_DIR=`pwd`/package && make test-integration-cli
env:
TARGET: ${{ matrix.target }}
TARGET_DIR: target/${{ matrix.target }}/release
CARGO_TARGET: --target ${{ matrix.target }}
WAPM_DEV_TOKEN: ${{ secrets.WAPM_DEV_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build Doc
if: matrix.run_build_docs
run: |
Expand Down
10 changes: 0 additions & 10 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,6 @@ Looking for changes that affect our C API? See the [C API Changelog](lib/c-api/C

## **Unreleased**


## Added


## Changed


## Fixed


## 3.0.0 - 20/11/2022

## Added
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,7 @@ test-capi-crate-%:
--no-default-features --features wat,compiler,wasi,middlewares,webc_runner $(capi_compiler_features) -- --nocapture

test-capi-integration-%:
# note: you need to do make build-capi and make package-capi first!
# Test the Wasmer C API tests for C
cd lib/c-api/tests; WASMER_CAPI_CONFIG=$(shell echo $@ | sed -e s/test-capi-integration-//) WASMER_DIR=`pwd`/../../../package make test
# Test the Wasmer C API examples
Expand Down
6 changes: 3 additions & 3 deletions examples/wasi_pipes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
use std::io::{Read, Write};
use wasmer::{Instance, Module, Store};
use wasmer_compiler_cranelift::Cranelift;
use wasmer_wasi::{WasiBidirectionalSharedPipePair, WasiState};
use wasmer_wasi::{Pipe, WasiState};

fn main() -> Result<(), Box<dyn std::error::Error>> {
let wasm_path = concat!(
Expand All @@ -36,8 +36,8 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {

println!("Creating `WasiEnv`...");
// First, we create the `WasiEnv` with the stdio pipes
let mut input = WasiBidirectionalSharedPipePair::new().with_blocking(false);
let mut output = WasiBidirectionalSharedPipePair::new().with_blocking(false);
let mut input = Pipe::new();
let mut output = Pipe::new();
let wasi_env = WasiState::new("hello")
.stdin(Box::new(input.clone()))
.stdout(Box::new(output.clone()))
Expand Down
46 changes: 26 additions & 20 deletions lib/api/tests/externals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,25 +210,28 @@ fn memory_grow() -> Result<(), String> {
fn function_new() -> Result<(), String> {
let mut store = Store::default();
let function = Function::new_typed(&mut store, || {});
assert_eq!(function.ty(&mut store), FunctionType::new(vec![], vec![]));
assert_eq!(
function.ty(&mut store).clone(),
FunctionType::new(vec![], vec![])
);
let function = Function::new_typed(&mut store, |_a: i32| {});
assert_eq!(
function.ty(&mut store),
function.ty(&mut store).clone(),
FunctionType::new(vec![Type::I32], vec![])
);
let function = Function::new_typed(&mut store, |_a: i32, _b: i64, _c: f32, _d: f64| {});
assert_eq!(
function.ty(&mut store),
function.ty(&mut store).clone(),
FunctionType::new(vec![Type::I32, Type::I64, Type::F32, Type::F64], vec![])
);
let function = Function::new_typed(&mut store, || -> i32 { 1 });
assert_eq!(
function.ty(&mut store),
function.ty(&mut store).clone(),
FunctionType::new(vec![], vec![Type::I32])
);
let function = Function::new_typed(&mut store, || -> (i32, i64, f32, f64) { (1, 2, 3.0, 4.0) });
assert_eq!(
function.ty(&mut store),
function.ty(&mut store).clone(),
FunctionType::new(vec![], vec![Type::I32, Type::I64, Type::F32, Type::F64])
);
Ok(())
Expand All @@ -243,11 +246,14 @@ fn function_new_env() -> Result<(), String> {
let my_env = MyEnv {};
let env = FunctionEnv::new(&mut store, my_env);
let function = Function::new_typed_with_env(&mut store, &env, |_env: FunctionEnvMut<MyEnv>| {});
assert_eq!(function.ty(&mut store), FunctionType::new(vec![], vec![]));
assert_eq!(
function.ty(&mut store).clone(),
FunctionType::new(vec![], vec![])
);
let function =
Function::new_typed_with_env(&mut store, &env, |_env: FunctionEnvMut<MyEnv>, _a: i32| {});
assert_eq!(
function.ty(&mut store),
function.ty(&mut store).clone(),
FunctionType::new(vec![Type::I32], vec![])
);
let function = Function::new_typed_with_env(
Expand All @@ -256,13 +262,13 @@ fn function_new_env() -> Result<(), String> {
|_env: FunctionEnvMut<MyEnv>, _a: i32, _b: i64, _c: f32, _d: f64| {},
);
assert_eq!(
function.ty(&mut store),
function.ty(&mut store).clone(),
FunctionType::new(vec![Type::I32, Type::I64, Type::F32, Type::F64], vec![])
);
let function =
Function::new_typed_with_env(&mut store, &env, |_env: FunctionEnvMut<MyEnv>| -> i32 { 1 });
assert_eq!(
function.ty(&mut store),
function.ty(&mut store).clone(),
FunctionType::new(vec![], vec![Type::I32])
);
let function = Function::new_typed_with_env(
Expand All @@ -271,7 +277,7 @@ fn function_new_env() -> Result<(), String> {
|_env: FunctionEnvMut<MyEnv>| -> (i32, i64, f32, f64) { (1, 2, 3.0, 4.0) },
);
assert_eq!(
function.ty(&mut store),
function.ty(&mut store).clone(),
FunctionType::new(vec![], vec![Type::I32, Type::I64, Type::F32, Type::F64])
);
Ok(())
Expand All @@ -288,35 +294,35 @@ fn function_new_dynamic() -> Result<(), String> {
&function_type,
|_values: &[Value]| unimplemented!(),
);
assert_eq!(function.ty(&mut store), function_type);
assert_eq!(function.ty(&mut store).clone(), function_type);
let function_type = FunctionType::new(vec![Type::I32], vec![]);
let function = Function::new(
&mut store,
&function_type,
|_values: &[Value]| unimplemented!(),
);
assert_eq!(function.ty(&mut store), function_type);
assert_eq!(function.ty(&mut store).clone(), function_type);
let function_type = FunctionType::new(vec![Type::I32, Type::I64, Type::F32, Type::F64], vec![]);
let function = Function::new(
&mut store,
&function_type,
|_values: &[Value]| unimplemented!(),
);
assert_eq!(function.ty(&mut store), function_type);
assert_eq!(function.ty(&mut store).clone(), function_type);
let function_type = FunctionType::new(vec![], vec![Type::I32]);
let function = Function::new(
&mut store,
&function_type,
|_values: &[Value]| unimplemented!(),
);
assert_eq!(function.ty(&mut store), function_type);
assert_eq!(function.ty(&mut store).clone(), function_type);
let function_type = FunctionType::new(vec![], vec![Type::I32, Type::I64, Type::F32, Type::F64]);
let function = Function::new(
&mut store,
&function_type,
|_values: &[Value]| unimplemented!(),
);
assert_eq!(function.ty(&mut store), function_type);
assert_eq!(function.ty(&mut store).clone(), function_type);

// Using array signature
let function_type = ([Type::V128], [Type::I32, Type::F32, Type::F64]);
Expand Down Expand Up @@ -350,39 +356,39 @@ fn function_new_dynamic_env() -> Result<(), String> {
&function_type,
|_env: FunctionEnvMut<MyEnv>, _values: &[Value]| unimplemented!(),
);
assert_eq!(function.ty(&mut store), function_type);
assert_eq!(function.ty(&mut store).clone(), function_type);
let function_type = FunctionType::new(vec![Type::I32], vec![]);
let function = Function::new_with_env(
&mut store,
&env,
&function_type,
|_env: FunctionEnvMut<MyEnv>, _values: &[Value]| unimplemented!(),
);
assert_eq!(function.ty(&mut store), function_type);
assert_eq!(function.ty(&mut store).clone(), function_type);
let function_type = FunctionType::new(vec![Type::I32, Type::I64, Type::F32, Type::F64], vec![]);
let function = Function::new_with_env(
&mut store,
&env,
&function_type,
|_env: FunctionEnvMut<MyEnv>, _values: &[Value]| unimplemented!(),
);
assert_eq!(function.ty(&mut store), function_type);
assert_eq!(function.ty(&mut store).clone(), function_type);
let function_type = FunctionType::new(vec![], vec![Type::I32]);
let function = Function::new_with_env(
&mut store,
&env,
&function_type,
|_env: FunctionEnvMut<MyEnv>, _values: &[Value]| unimplemented!(),
);
assert_eq!(function.ty(&mut store), function_type);
assert_eq!(function.ty(&mut store).clone(), function_type);
let function_type = FunctionType::new(vec![], vec![Type::I32, Type::I64, Type::F32, Type::F64]);
let function = Function::new_with_env(
&mut store,
&env,
&function_type,
|_env: FunctionEnvMut<MyEnv>, _values: &[Value]| unimplemented!(),
);
assert_eq!(function.ty(&mut store), function_type);
assert_eq!(function.ty(&mut store).clone(), function_type);

// Using array signature
let function_type = ([Type::V128], [Type::I32, Type::F32, Type::F64]);
Expand Down
10 changes: 5 additions & 5 deletions lib/api/tests/reference_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ pub mod reference_types {
let global: &Global = instance.exports.get_global("global")?;
{
let er = ExternRef::new(&mut store, 3usize);
global.set(&mut store, Value::ExternRef(Some(er)))?;
global.set(&mut store, Value::ExternRef(Some(er.clone())))?;
}
let get_from_global: TypedFunction<(), Option<ExternRef>> = instance
.exports
Expand Down Expand Up @@ -398,7 +398,7 @@ pub mod reference_types {

let er = ExternRef::new(&mut store, 3usize);

let result = pass_extern_ref.call(&mut store, Some(er));
let result = pass_extern_ref.call(&mut store, Some(er.clone()));
assert!(result.is_err());

Ok(())
Expand Down Expand Up @@ -442,7 +442,7 @@ pub mod reference_types {
let result = grow_table_with_ref.call(&mut store, Some(er1.clone()), 10_000)?;
assert_eq!(result, -1);

let result = grow_table_with_ref.call(&mut store, Some(er1), 8)?;
let result = grow_table_with_ref.call(&mut store, Some(er1.clone()), 8)?;
assert_eq!(result, 2);

for i in 2..10 {
Expand All @@ -454,15 +454,15 @@ pub mod reference_types {
}

{
fill_table_with_ref.call(&mut store, Some(er2), 0, 2)?;
fill_table_with_ref.call(&mut store, Some(er2.clone()), 0, 2)?;
}

{
table2.set(&mut store, 0, Value::ExternRef(Some(er3.clone())))?;
table2.set(&mut store, 1, Value::ExternRef(Some(er3.clone())))?;
table2.set(&mut store, 2, Value::ExternRef(Some(er3.clone())))?;
table2.set(&mut store, 3, Value::ExternRef(Some(er3.clone())))?;
table2.set(&mut store, 4, Value::ExternRef(Some(er3)))?;
table2.set(&mut store, 4, Value::ExternRef(Some(er3.clone())))?;
}

{
Expand Down
Loading