Skip to content

Commit

Permalink
Make primitive tests go back and forth, fix float params in imported …
Browse files Browse the repository at this point in the history
…functions (#188)

* Make primitive tests go back and forth (broken floats)

This reveals 2 issues:

1) Floats are not passed properly when the guest calls a host function, see #180

2) The tests were not robust enough to catch that.

This commit at least partially fixes the second problem. Also, the tested functions now have more intuitive names and do not rely on "magic" constants.

* Pass float argument to imported function as a one-sized array

This works around this issue:
#180

Thankfully it seems to be fixed in wasmer3, so this code will probably
need to change again in the wasmer3 branch to no longer use this hack.

* Split primitive float methods for wasmer2 workaround

Since the wasmer2 bug affect only one runtime, it felt wrong to change the float primitive methods to accommodate it.

Instead, there are now 2 primitive float methods, one "normal" one, and one with the workaround implemented. The wasmer2  runtime simply calls the one with the workaround instead. Other runtimes can then call the normal one as usual.

* Update bindings test snapshot

* Update wasmer test

* Update ts runtime tests

* Update ts runtime imports

* Use the wasmer2 workaround in ts runtime as well

* Fix missing quote in status text

* Summarize changes into changelog
  • Loading branch information
kajacx authored Mar 20, 2023
1 parent ad437ef commit de72d30
Show file tree
Hide file tree
Showing 11 changed files with 791 additions and 519 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
- Every field in the `RustPluginConfig` builder can be set to `RustPluginConfigValue::Workspace`
to indicate the value in the generated `Cargo.toml` should come from the workspace instead.
- Add `description`, `readme` and `license` fields to `RustPluginConfig`.
- Changed primitive tests in example to go call imported functions from the plugin.

### Fixed

- Added workaround for imported functions with float arguments for wasmer2 in example,
see [#180](https://github.com/fiberplane/fp-bindgen/issues/180).

## [3.0.0-beta.1] - 2023-02-14

Expand Down
Loading

0 comments on commit de72d30

Please sign in to comment.