Skip to content

Commit

Permalink
add tests/misc_testsuite/component-model-async/fused.wast
Browse files Browse the repository at this point in the history
Signed-off-by: Joel Dice <joel.dice@fermyon.com>
  • Loading branch information
dicej committed Jan 6, 2025
1 parent 3397a83 commit aab8d85
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 1 deletion.
52 changes: 52 additions & 0 deletions tests/misc_testsuite/component-model-async/fused.wast
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
;;! component_model_async = true

;; async lower -> async lift
(component
(component $lifter
(core module $m
(import "" "task.return" (func $task-return (param i32)))
(func (export "foo") (param i32) (call $task-return (local.get 0)))
)
(core type $task-return (func (param i32)))
(core func $task-return (canon task.return $task-return))
(core instance $i (instantiate $m
(with "" (instance (export "task.return" (func $task-return))))
))

(func (export "foo") (param "p1" u32) (result u32)
(canon lift (core func $i "foo") async)
)
)

(component $lowerer
(import "a" (func $foo (param "p1" u32) (result u32)))
(core module $libc (memory (export "memory") 1))
(core instance $libc (instantiate $libc))
(core func $foo (canon lower (func $foo) async (memory $libc "memory")))
(core module $m
(import "libc" "memory" (memory 1))
(import "" "foo" (func $foo (param i32 i32) (result i32)))
(func (export "run")
block
(i32.store offset=0 (i32.const 1200) (i32.const 42))
(call $foo (i32.const 1200) (i32.const 1204))
(i32.eq (i32.load offset=0 (i32.const 1204)) (i32.const 42))
br_if 0
unreachable
end
)
)
(core instance $i (instantiate $m
(with "libc" (instance $libc))
(with "" (instance (export "foo" (func $foo))))
))
(func (export "run") (canon lift (core func $i "run")))
)

(instance $lifter (instantiate $lifter))
(instance $lowerer (instantiate $lowerer (with "a" (func $lifter "foo"))))
(func (export "run") (alias export $lowerer "run"))
)

;; TODO: this requires async support in `wasmtime-wast`:
;;(assert_return (invoke "run"))
1 change: 0 additions & 1 deletion tests/wast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ fn run_wast(test: &WastTest, config: WastConfig) -> anyhow::Result<()> {
};

let mut cfg = Config::new();
cfg.wasm_component_model_async(true);
component_test_util::apply_test_config(&mut cfg, &test_config);
component_test_util::apply_wast_config(&mut cfg, &config);

Expand Down

0 comments on commit aab8d85

Please sign in to comment.