Commit Graph

91 Commits

Author SHA1 Message Date
Mark McCaskey
bc9b92c323 Add null checks to new destructors in C API 2019-10-29 15:18:45 -07:00
Mark McCaskey
a104d08c04 Update ImportObject C API to use iterators 2019-10-29 14:55:14 -07:00
Mark McCaskey
2a532b8ce5 Add tests for C API import_object and WASI updates 2019-10-25 14:24:22 -07:00
Ethan Frey
e8a918e2e5 %lld -> %ld fixes cargo test compile error 2019-09-18 23:25:35 +02:00
Ivan Enderlin
1f1ecb7e00 test(runtime-c-api) Use calloc and simplify code. 2019-09-06 10:20:36 +02:00
Ivan Enderlin
a67ce539ef test: Fix CS. 2019-09-05 15:10:09 +02:00
Ivan Enderlin
a2343f9f0d test(runtime-c-api) Fully test all kind of exports. 2019-09-05 15:08:23 +02:00
Syrus
998a25e2d1 Fixed windows tests 2019-08-25 00:24:21 -07:00
Yaron Wittenstein
f64eee894e [FIX] test-context.c imports contains now the expected mul import too 2019-08-01 19:31:33 +03:00
Yaron Wittenstein
3f4ffb0e2d Merge branch 'develop' into c-api-import_object_t 2019-08-01 18:15:21 +03:00
Yaron Wittenstein
524585942a deleting test-context binary 2019-08-01 17:24:51 +03:00
Yaron Wittenstein
09d704d053 Merge branch 'master' into c-api-extract-instance_context-from-instance 2019-08-01 14:08:47 +03:00
Yaron Wittenstein
f73180f45e wasmer-c-api:
* adding `wasmer_import_object_new` and `wasmer_import_object_extend`
* adding test file `test-module-import-instantiate.c`
2019-08-01 14:06:25 +03:00
Syrus
70a767e204 Improved exported memory tests 2019-08-01 01:28:11 -07:00
Syrus
2c6fbcba1f Improved runtime_c_api_tests 2019-08-01 01:27:36 -07:00
Yaron Wittenstein
ab76755ade runtime-c-api:
* import.rs - adding `import_object_t` and `wasmer_import_object_destroy`
* instance.rs - adding `wasmer_module_import_instantiate`
2019-08-01 10:48:03 +03:00
Syrus
676bccff3c Tryin gto make c_api_tests verbose mitigates the flaky error
Each time `make capi` is run, there is a flaky error:

```
Running target/release/deps/runtime_c_api_tests-3df0f74fcea1252d

running 1 test
test test_c_api ... FAILED

failures:

---- test_c_api stdout ----
Running command: `cmake` arg: Some(".")
output:
status: 0
stdout:
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/syrusakbary/Development/wasmer/lib/runtime-c-api/tests

stderr:

Running command: `make` arg: Some("-Wdev -Werror=dev")
output:
status: 0
stdout:
[  7%] Built target test-tables
[ 15%] Built target test-module-exports
[ 23%] Built target test-module-imports
[ 30%] Built target test-globals
[ 38%] Built target test-imports
[ 46%] Built target test-module
[ 53%] Built target test-module-serialize
[ 61%] Built target test-memory
[ 69%] Built target test-validate
[ 76%] Built target test-import-function
[ 84%] Built target test-instantiate
[ 92%] Built target test-exports
[100%] Built target test-exported-memory

stderr:

Running command: `make` arg: Some("test")
output:
status: 2
stdout:
Running tests...
Test project /Users/syrusakbary/Development/wasmer/lib/runtime-c-api/tests
      Start  1: test-exported-memory
 1/13 Test  #1: test-exported-memory .............Child aborted***Exception:   0.00 sec
      Start  2: test-exports
 2/13 Test  #2: test-exports .....................   Passed    0.01 sec
      Start  3: test-globals
 3/13 Test  #3: test-globals .....................   Passed    0.00 sec
      Start  4: test-import-function
 4/13 Test  #4: test-import-function .............   Passed    0.01 sec
      Start  5: test-imports
 5/13 Test  #5: test-imports .....................   Passed    0.01 sec
      Start  6: test-instantiate
 6/13 Test  #6: test-instantiate .................   Passed    0.01 sec
      Start  7: test-memory
 7/13 Test  #7: test-memory ......................   Passed    0.00 sec
      Start  8: test-module
 8/13 Test  #8: test-module ......................   Passed    0.01 sec
      Start  9: test-module-exports
 9/13 Test  #9: test-module-exports ..............   Passed    0.01 sec
      Start 10: test-module-imports
10/13 Test #10: test-module-imports ..............   Passed    0.01 sec
      Start 11: test-module-serialize
11/13 Test #11: test-module-serialize ............   Passed    0.01 sec
      Start 12: test-tables
12/13 Test #12: test-tables ......................   Passed    0.00 sec
      Start 13: test-validate
13/13 Test #13: test-validate ....................   Passed    0.00 sec

92% tests passed, 1 tests failed out of 13

Total Test time (real) =   0.08 sec

The following tests FAILED:
	  1 - test-exported-memory (Child aborted)

stderr:
Errors while running CTest
make[1]: *** [test] Error 8

thread 'test_c_api' panicked at 'Command failed with exit status: ExitStatus(ExitStatus(512))', lib/runtime-c-api/tests/runtime_c_api_tests.rs:43:17
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
```
2019-08-01 00:22:52 -07:00
Yaron Wittenstein
dd91a8208a changes after PR review https://github.com/wasmerio/wasmer/pull/602#pullrequestreview-269368270 2019-08-01 08:48:20 +03:00
Yaron Wittenstein
0fb7eb1e19 tests/test-context.c - destroying resources in the end 2019-07-31 14:48:22 +03:00
Yaron Wittenstein
f6b5f1ba1b wasmer-c-api: adding asserts to tests/test-context.c 2019-07-31 14:32:38 +03:00
Yaron Wittenstein
847dd6f65e c-api: adding wasmer_instance_context_get (instance.rs) 2019-07-31 14:12:25 +03:00
Syrus
7a120f48d7 Fixed capi 2019-07-05 19:55:03 -07:00
losfair
669f76025c Add callinfo trampoline into the C API. 2019-06-05 01:25:37 +08:00
losfair
d70cb9695e Add trampoline-related functions to C API. 2019-06-03 15:31:42 -07:00
Ivan Enderlin
f68379a6df test(runtime-c-api) Use *_arity variables when calling wasmer_export_func_call. 2019-05-14 11:49:40 +02:00
Ivan Enderlin
8c8586faaa test(runtime-c-api) Assert returned value from wasmer_last_error_message. 2019-05-13 10:52:55 +02:00
Ivan Enderlin
4d0312f0ed test(runtime-c-api) New test suite for wasmer_export_to_memory. 2019-03-27 10:49:28 +01:00
Ivan Enderlin
5661540097 chore(runtime-c-api) Move .wasm files into the assets directory. 2019-03-27 09:42:56 +01:00
Ivan Enderlin
57a82fa5cf fix(runtime-c-api) wasmer_serialized_module_from_bytes accepts bytes + length instead of wasmer_byte_array. 2019-03-19 16:24:59 +01:00
Ivan Enderlin
46edd20725 feat(runtime-c-api) Add the wasmer_serialized_module_from_bytes function.
This function is required to transform a `wasmer_byte_array` into a
`wasmer_serialized_module_t`. This is the complementary function of
`wasmer_serialized_module_bytes`.
2019-03-19 10:51:43 +01:00
Ivan Enderlin
5e31a1b6d1 feat(runtime-c-api) Introduce the wasmer_serialized_module_t struct type.
The `wasmer_module_serialize` function now computes a
`wasmer_serialized_module_t` value. The `wasmer_module_deserialize`
function takes this value as an input. Same for
`wasmer_serialized_module_destroy`.

The new function `wasmer_serialized_module_bytes` allows to read the
bytes inside the `wasmer_serialized_mdule_t` structure.
2019-03-19 10:04:31 +01:00
Ivan Enderlin
6605a02316 feat(runtime-c-api) Add the wasmer_module_serialization_destroy function. 2019-03-18 16:05:04 +01:00
Ivan Enderlin
c8872f1a6f test(runtime-c-api) Test the new wasmer_module_(de)?serialize functions.
This test suite compiles a module, then serializes it, deserializes
it, and continues by creating an instance and calling a function on
it. It allows to test the entire roundtrip.
2019-03-15 12:04:23 +01:00
Ivan Enderlin
f2760249b6 fix(runtime-c-api) Reorganize the tests by alphabetic order. 2019-03-15 12:04:23 +01:00
Ivan Enderlin
5db05fd609
Merge branch 'master' into feat-runtime-c-api-instance-context-data 2019-03-12 09:02:05 +01:00
Ivan Enderlin
675f6817ba test(runtime-c-api) Free allocations.
Don't forget to free `context_data` :-).
2019-03-11 17:41:17 +01:00
Ivan Enderlin
170de02dd3 test(runtime-c-api) Test the wasmer_instance_context_data_* functions. 2019-03-11 17:34:13 +01:00
Ivan Enderlin
3fea07dc8a fix(runtime-c-api) Fix the imports length.
`imports` contains `func_import`, `global_import`, `memory_import` and
`table_import`, so 4 items. This patch updates the length of `imports`
when calling the `wasmer_instantiate` function.
2019-03-11 14:35:51 +01:00
Brandon Fish
628caf0a74 Make import_func_new/destroy not const 2019-03-07 22:59:11 -06:00
Ivan Enderlin
1dfae80c65 test(runtime-c-api) Fix compilation errors in test-exports.c. 2019-03-07 10:15:32 +01:00
Ivan Enderlin
725aff6fee test(runtime-c-api) Fix a compilation error in test-instantiate.c. 2019-03-07 10:15:32 +01:00
Ivan Enderlin
603f1fc57d test(runtime-c-api) Fix compilation errors in test-import-function.c. 2019-03-07 10:15:32 +01:00
Ivan Enderlin
2a0e42c1e5 test(runtime-c-api) Fix compilation errors in test-memory.c. 2019-03-07 10:15:32 +01:00
Ivan Enderlin
dcb4032e9d test(runtime-c-api) Fix compilation errors in test-imports.c. 2019-03-07 10:15:32 +01:00
Ivan Enderlin
c658224f0c test(runtime-c-api) Transforms all C/C++ warnings into errors.
This patch ensures that all our examples and tests do not generate
warnings. In C, it can be catastrophic sometimes…

Also, be sure that the `cmake` command doesn't emit any warnings too.
2019-03-07 10:15:32 +01:00
Brandon Fish
2077fb448a Fix C API table/global/memory imports 2019-03-02 22:28:00 -06:00
Brandon Fish
adfdf4d85d Merge branch 'master' into feature/add-c-api-module-import-descriptors 2019-03-01 12:50:35 -06:00
Brandon Fish
0792cc7018 Merge branch 'master' into feature/c-api-call-an-exported-func 2019-03-01 12:14:56 -06:00
Mackenzie Clark
2a7a8c0069
newline in test-module-imports.c 2019-02-27 10:41:22 -08:00
Brandon Fish
b008a054de Fix C API to allow calling an exported func 2019-02-24 12:22:24 -06:00