Skip to content

Embind port #7239

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

Draft
wants to merge 38 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
test
  • Loading branch information
kripken committed Apr 1, 2024
commit c3143095679e12bd27a7630b8bd8400a67429059
1 change: 1 addition & 0 deletions check.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@ def run():
('unit', run_unittest),
('binaryenjs', binaryenjs.test_binaryen_js),
('binaryenjs_wasm', binaryenjs.test_binaryen_wasm),
('binaryenjs_embind', binaryenjs.test_binaryen_embind),
('lit', run_lit),
('gtest', run_gtest),
])
Expand Down
16 changes: 16 additions & 0 deletions scripts/test/binaryenjs.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,19 @@ def test_binaryen_js():

def test_binaryen_wasm():
do_test_binaryen_js_with(shared.BINARYEN_WASM)


def test_binaryen_embind():
print('\n[ checking binaryen.js (embind) testcases (' + shared.BINARYEN_EMBIND + ')... ]\n')

for s in sorted(os.listdir(os.path.join(shared.options.binaryen_test, 'binaryen-embind.js'))):
if not s.endswith('.js'):
continue
print(s)
test_path = os.path.join(shared.options.binaryen_test, 'binaryen-embind.js', s)

# Run the test and pass the build as an argument, so it knows where to
# load it.
out = support.run_command([shared.NODEJS, test_path, shared.BINARYEN_EMBIND])
assert('success.' in out)

1 change: 1 addition & 0 deletions scripts/test/shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ def is_exe(fpath):
'wasm-emscripten-finalize')]
BINARYEN_JS = os.path.join(options.binaryen_bin, 'binaryen_js.js')
BINARYEN_WASM = os.path.join(options.binaryen_bin, 'binaryen_wasm.js')
BINARYEN_EMBIND = os.path.join(options.binaryen_bin, 'binaryen_embind_wasm.js')


def wrap_with_valgrind(cmd):
Expand Down
13 changes: 13 additions & 0 deletions test/binaryen-embind.js/basics.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const assert = require('node:assert');
const argv = require('node:process');

const binaryen_js_path = argv.argv[2];

const factory = require(binaryen_js_path);

factory().then((Module) => {
assert.ok(Module.Builder, 'the Builder class must be exposed');

console.log('success.');
});