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

Remove JS wrapper and instead export necessary functions for wrapper implementers #6224

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
*.py text eol=lf
*.sh text eol=lf
test/binaryen.js/*.txt text eol=lf
10 changes: 4 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -462,9 +462,8 @@ if(EMSCRIPTEN)
target_link_libraries(binaryen_wasm "-sEXPORT_NAME=Binaryen")
target_link_libraries(binaryen_wasm "-sNODERAWFS=0")
target_link_libraries(binaryen_wasm "-sEXPORT_ES6")
target_link_libraries(binaryen_wasm "-sEXPORTED_RUNTIME_METHODS=allocateUTF8OnStack,stringToAscii")
target_link_libraries(binaryen_wasm "-sEXPORTED_FUNCTIONS=_malloc,_free")
target_link_libraries(binaryen_wasm "--post-js=${CMAKE_CURRENT_SOURCE_DIR}/src/js/binaryen.js-post.js")
target_link_libraries(binaryen_wasm "-sEXPORTED_RUNTIME_METHODS=allocateUTF8OnStack,UTF8ToString,stringToAscii,stackSave,stackRestore,stackAlloc")
target_link_libraries(binaryen_wasm "-sEXPORTED_FUNCTIONS=_malloc,_free,out")
target_link_libraries(binaryen_wasm "-msign-ext")
target_link_libraries(binaryen_wasm "-mbulk-memory")
target_link_libraries(binaryen_wasm optimized "--closure=1")
Expand Down Expand Up @@ -500,9 +499,8 @@ if(EMSCRIPTEN)
else()
target_link_libraries(binaryen_js "-sEXPORT_ES6=1")
endif()
target_link_libraries(binaryen_js "-sEXPORTED_RUNTIME_METHODS=allocateUTF8OnStack,stringToAscii")
target_link_libraries(binaryen_js "-sEXPORTED_FUNCTIONS=_malloc,_free")
target_link_libraries(binaryen_js "--post-js=${CMAKE_CURRENT_SOURCE_DIR}/src/js/binaryen.js-post.js")
target_link_libraries(binaryen_js "-sEXPORTED_RUNTIME_METHODS=allocateUTF8OnStack,UTF8ToString,stringToAscii,stackSave,stackRestore,stackAlloc")
target_link_libraries(binaryen_js "-sEXPORTED_FUNCTIONS=_malloc,_free,out")
# js_of_ocaml needs a specified variable with special comment to provide the library to consumers
if(JS_OF_OCAML)
target_link_libraries(binaryen_js "--extern-pre-js=${CMAKE_CURRENT_SOURCE_DIR}/src/js/binaryen.jsoo-extern-pre.js")
Expand Down
2 changes: 0 additions & 2 deletions Contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ Use this handy checklist to make sure your new instructions are fully supported:
- [ ] Support added in various classes inheriting OverriddenVisitor (and possibly other non-OverriddenVisitor classes as necessary)
- [ ] Support added to src/tools/fuzzing.h
- [ ] C API support added in src/binaryen-c.h and src/binaryen-c.cpp
- [ ] JS API support added in src/js/binaryen.js-post.js
- [ ] C API tested in test/example/c-api-kitchen-sink.c
- [ ] JS API tested in test/binaryen.js/kitchen-sink.js
- [ ] Tests added in test/spec
- [ ] Tests added in top-level test/
5 changes: 1 addition & 4 deletions check.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import unittest
from collections import OrderedDict

from scripts.test import binaryenjs
from scripts.test import lld
from scripts.test import shared
from scripts.test import support
Expand Down Expand Up @@ -370,8 +369,6 @@ def run():
('validator', run_validator_tests),
('example', run_example_tests),
('unit', run_unittest),
('binaryenjs', binaryenjs.test_binaryen_js),
('binaryenjs_wasm', binaryenjs.test_binaryen_wasm),
('lit', run_lit),
('gtest', run_gtest),
])
Expand All @@ -380,7 +377,7 @@ def run():
# Run all the tests
def main():
all_suites = TEST_SUITES.keys()
skip_by_default = ['binaryenjs', 'binaryenjs_wasm']
skip_by_default = []

if shared.options.list_suites:
for suite in all_suites:
Expand Down
4 changes: 1 addition & 3 deletions scripts/auto_update_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import sys
from collections import OrderedDict

from test import binaryenjs
from test import lld
from test import shared
from test import support
Expand Down Expand Up @@ -173,14 +172,13 @@ def update_lit_tests():
('spec', update_spec_tests),
('lld', lld.update_lld_tests),
('wasm2js', wasm2js.update_wasm2js_tests),
('binaryenjs', binaryenjs.update_binaryen_js_tests),
('lit', update_lit_tests),
])


def main():
all_suites = TEST_SUITES.keys()
skip_by_default = ['binaryenjs']
skip_by_default = []

if shared.options.list_suites:
for suite in all_suites:
Expand Down
4 changes: 0 additions & 4 deletions scripts/emcc-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,8 @@ mkdir -p emcc-build
echo "emcc-tests: build:wasm"
emcmake cmake -B emcc-build -DCMAKE_BUILD_TYPE=Release -G Ninja
ninja -C emcc-build binaryen_wasm
echo "emcc-tests: test:wasm"
./check.py --binaryen-bin=emcc-build/bin binaryenjs_wasm
echo "emcc-tests: done:wasm"

echo "emcc-tests: build:js"
ninja -C emcc-build binaryen_js
echo "emcc-tests: test:js"
./check.py --binaryen-bin=emcc-build/bin binaryenjs
echo "emcc-tests: done:js"
115 changes: 0 additions & 115 deletions scripts/test/binaryenjs.py

This file was deleted.

17 changes: 0 additions & 17 deletions scripts/test/support.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,20 +188,3 @@ def run_command(cmd, expected_status=0, stderr=None,
raise Exception(('run_command unexpected stderr',
"expected '%s', actual '%s'" % (expected_err, err)))
return out


def node_has_webassembly(cmd):
cmd = [cmd, '-e', 'process.stdout.write(typeof WebAssembly)']
return run_command(cmd) == 'object'


def js_test_wrap():
# common wrapper code for JS tests, waiting for binaryen.js to become ready
# and providing common utility used by all tests:
return '''
(async function __in_test_code__() {
var binaryen = await Binaryen()
function assert(x) { if (!x) throw Error('Test assertion failed'); }
%TEST%
})();
'''
87 changes: 0 additions & 87 deletions test/binaryen.js/atomics.js

This file was deleted.

70 changes: 0 additions & 70 deletions test/binaryen.js/atomics.js.txt

This file was deleted.

Loading
Loading