Skip to content
Merged
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
15 changes: 10 additions & 5 deletions test/browser/test_offset_converter.c
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
#include <assert.h>
#include <stdio.h>
#include <emscripten.h>

void *get_pc(void) { return __builtin_return_address(0); }
void *get_pc(void) {
return __builtin_return_address(0);
}

int magic_test_function(void) {
void magic_test_function(void) {
int result = EM_ASM_INT({
function report(x) {
fetch(encodeURI('http://localhost:8888?stdout=' + x));
out(x);
fetch('http://localhost:8888?stdout=' + encodeURIComponent(x));
}
report('magic_test_function: input=' + $0);
var converted = wasmOffsetConverter.getName($0);
report('magic_test_function: converted=' + converted);
return converted == 'magic_test_function';
}, get_pc());
return result;
assert(result);
}

int main(void) {
return magic_test_function();
magic_test_function();
return 0;
}
8 changes: 6 additions & 2 deletions test/test_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -4948,8 +4948,12 @@ def test_minimal_runtime_loader_shell(self, args):
def test_minimal_runtime_hello_world(self, args):
self.btest_exit('small_hello_world.c', args=args + ['-sMINIMAL_RUNTIME'])

def test_offset_converter(self, *args):
self.btest_exit('test_offset_converter.c', assert_returncode=1, args=['-sUSE_OFFSET_CONVERTER', '-gsource-map', '-sPROXY_TO_PTHREAD', '-pthread'])
@parameterized({
'': ([],),
'pthread': (['-sPROXY_TO_PTHREAD', '-pthread'],)
})
def test_offset_converter(self, args):
self.btest_exit('test_offset_converter.c', args=['-sUSE_OFFSET_CONVERTER', '-gsource-map'] + args)

# Tests emscripten_unwind_to_js_event_loop() behavior
def test_emscripten_unwind_to_js_event_loop(self, *args):
Expand Down
Loading