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

test+doc(c-api): Test and document the C A PI #1851

Merged
merged 20 commits into from
Dec 11, 2020
Merged

Conversation

Hywan
Copy link
Contributor

@Hywan Hywan commented Nov 30, 2020

Description

This PR improves the test suites and the documentation of the C API.

Review

  • Add a short description of the the change to the CHANGELOG.md file

@Hywan Hywan added 📦 lib-c-api About wasmer-c-api 🧪 tests I love tests 📚 documentation Do you like to read? labels Nov 30, 2020
@Hywan Hywan self-assigned this Nov 30, 2020
lib/c-api/src/wasm_c_api/engine.rs Show resolved Hide resolved
lib/c-api/src/wasm_c_api/engine.rs Show resolved Hide resolved
use inline_c::assert_c;

#[test]
fn test_engine_new() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this test really useful? It seems redundant with the examples from the documentation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I initially wanted to improve this test, but our C API doesn't offer enough features. Let's keep this as is, and I'll improve it later.

lib/c-api/src/wasm_c_api/instance.rs Show resolved Hide resolved
Hywan added 4 commits December 1, 2020 11:37
This patch does several things:

1. It applies our Rust patterns for C API by replacing the raw pointer
   by `Option<Box<T>>`,
2. It allows `wasm_$name_vec_delete` to handle null pointer,
3. Because it takes ownership of the `wasm_$name_vec_t`, the pointer
   is correctly dropped (which fix the memory leak).
@jubianchi jubianchi added the 1.0 Wasmer at 1.0 label Dec 4, 2020
@Hywan Hywan marked this pull request as ready for review December 10, 2020 15:19
@Hywan
Copy link
Contributor Author

Hywan commented Dec 10, 2020

bors try

bors bot added a commit that referenced this pull request Dec 10, 2020
@bors
Copy link
Contributor

bors bot commented Dec 10, 2020

try

Build failed:

@Hywan
Copy link
Contributor Author

Hywan commented Dec 10, 2020

bors try

bors bot added a commit that referenced this pull request Dec 10, 2020
@bors
Copy link
Contributor

bors bot commented Dec 10, 2020

try

Build failed:

@Hywan
Copy link
Contributor Author

Hywan commented Dec 10, 2020

So. I pushed a commit. Git says everything is up-to-date. But the commit doesn't appear here. Hmmm.

@Hywan
Copy link
Contributor Author

Hywan commented Dec 10, 2020

bors try

bors bot added a commit that referenced this pull request Dec 10, 2020
@bors
Copy link
Contributor

bors bot commented Dec 10, 2020

try

Build failed:

Because we test the C API with many features combination, we can't ensure tests will pass with every combination
@jubianchi
Copy link
Contributor

bors try

bors bot added a commit that referenced this pull request Dec 10, 2020
@bors
Copy link
Contributor

bors bot commented Dec 10, 2020

@Hywan
Copy link
Contributor Author

Hywan commented Dec 11, 2020

bors r+

@bors
Copy link
Contributor

bors bot commented Dec 11, 2020

@bors bors bot merged commit 4f174f8 into wasmerio:master Dec 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.0 Wasmer at 1.0 📚 documentation Do you like to read? 📦 lib-c-api About wasmer-c-api 🧪 tests I love tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants