Skip to content

Commit

Permalink
[wasm64] Fix a lot of the remaining browser tests
Browse files Browse the repository at this point in the history
This also inverts the testing logic such that we run all browser
tests in wasm64 mode.  Tests that don't currently pass are annotated
with @no_wasm64.
  • Loading branch information
sbc100 committed Nov 8, 2023
1 parent e5bffd1 commit c1a9b5d
Show file tree
Hide file tree
Showing 11 changed files with 213 additions and 79 deletions.
23 changes: 1 addition & 22 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -790,28 +790,7 @@ jobs:
steps:
- run-tests-chrome:
title: "browser64"
test_targets: "
browser64.test_canvas_focus
browser64.test_anisotropic
browser64.test_webgpu_get_device
browser64.test_fetch_*
browser64.test_pthread_*
browser64.test_wget_*
browser64.test_emscripten_async_wget_*
browser64.test_wasm_worker_*
browser64.test_sdl_*
browser64.test_sdl1_*
browser64.test_egl*
browser64.test_gl_*
browser64.test_glgears*
browser64.test_glfw*
browser64.test_glew
browser64.test_idbstore*
browser64.test_fs_idbfs*
browser64.test_webgl*
browser64.test_glbook
browser64.test_gles2_emulation*
"
test_targets: "browser64 skip:browser64.test_zzz_zzz_4gb_fail"
test-browser-firefox:
executor: bionic
steps:
Expand Down
6 changes: 3 additions & 3 deletions src/library_pthread.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ var LibraryPThread = {

#if PTHREADS_PROFILING
getThreadName(pthreadPtr) {
var profilerBlock = {{{ makeGetValue('pthreadPtr', C_STRUCTS.pthread.profilerBlock, POINTER_TYPE) }}};
var profilerBlock = {{{ makeGetValue('pthreadPtr', C_STRUCTS.pthread.profilerBlock, '*') }}};
if (!profilerBlock) return "";
return UTF8ToString(profilerBlock + {{{ C_STRUCTS.thread_profiler_block.name }}});
},
Expand All @@ -162,7 +162,7 @@ var LibraryPThread = {
},

threadStatusAsString(pthreadPtr) {
var profilerBlock = {{{ makeGetValue('pthreadPtr', C_STRUCTS.pthread.profilerBlock, POINTER_TYPE) }}};
var profilerBlock = {{{ makeGetValue('pthreadPtr', C_STRUCTS.pthread.profilerBlock, '*') }}};
var status = (profilerBlock == 0) ? 0 : Atomics.load(HEAPU32, {{{ getHeapOffset('profilerBlock + ' + C_STRUCTS.thread_profiler_block.threadStatus, 'i32') }}});
return PThread.threadStatusToString(status);
},
Expand Down Expand Up @@ -761,7 +761,7 @@ var LibraryPThread = {
// Deduce which WebGL canvases (HTMLCanvasElements or OffscreenCanvases) should be passed over to the
// Worker that hosts the spawned pthread.
// Comma-delimited list of CSS selectors that must identify canvases by IDs: "#canvas1, #canvas2, ..."
var transferredCanvasNames = attr ? {{{ makeGetValue('attr', C_STRUCTS.pthread_attr_t._a_transferredcanvases, POINTER_TYPE) }}} : 0;
var transferredCanvasNames = attr ? {{{ makeGetValue('attr', C_STRUCTS.pthread_attr_t._a_transferredcanvases, '*') }}} : 0;
#if OFFSCREENCANVASES_TO_PTHREAD
// Proxied canvases string pointer -1 is used as a special token to fetch
// whatever canvases were passed to build in -s
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ u64 MonotonicNanoTime() {
return (u64)ts.tv_sec * (1000ULL * 1000 * 1000) + ts.tv_nsec;
}

// FIXME implement on this platform.
void GetMemoryProfile(fill_profile_f cb, uptr *stats) {}

} // namespace __sanitizer

#endif
File renamed without changes.
2 changes: 1 addition & 1 deletion test/browser/async_2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ __attribute__((noinline)) int calc(int x) {
}
// Keep the recursion by passing the function pointer between C++ and JS, so
// that we have a deeply nested stack.
int (*fp)(int) = (int(*)(int))EM_ASM_INT({
int (*fp)(int) = (int(*)(int))EM_ASM_PTR({
return $0;
}, &calc);
return fp(x - 1);
Expand Down
2 changes: 1 addition & 1 deletion test/fs_after_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#define NAME "file.cpp"

EMSCRIPTEN_KEEPALIVE
extern "C" void finish(void*) {
extern "C" void finish() {
EM_ASM({
var printed = Module['extraSecretBuffer'].split('Iteration').length - 1;
console.log(printed);
Expand Down
2 changes: 1 addition & 1 deletion test/runtime_misuse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ extern "C" {
int noted = 0;

char* EMSCRIPTEN_KEEPALIVE note(int n) {
EM_ASM({ Module.noted = $0 }, (long)&noted);
EM_ASM({ Module.noted = Number($0); out("set noted " + Module.noted) }, (long)&noted);
EM_ASM({ out([$0, $1]) }, n, noted);
noted += n;
EM_ASM({ out(['noted is now', $0]) }, noted);
Expand Down
2 changes: 1 addition & 1 deletion test/runtime_misuse_2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ extern "C" {
int noted = 0;

char* EMSCRIPTEN_KEEPALIVE note(int n) {
EM_ASM({ Module.noted = $0 }, (long)&noted);
EM_ASM({ Module.noted = Number($0) }, (long)&noted);
EM_ASM({ out([$0, $1]) }, n, noted);
noted += n;
EM_ASM({ out(['noted is now', $0]) }, noted);
Expand Down
Loading

0 comments on commit c1a9b5d

Please sign in to comment.