Skip to content

Commit 2efe1d6

Browse files
authored
Merge branch 'main' into cw-audio-test-must-run
2 parents aa71ef8 + c50c33d commit 2efe1d6

File tree

12 files changed

+98
-15
lines changed

12 files changed

+98
-15
lines changed

src/jsifier.mjs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import {
3333
compileTimeContext,
3434
printErr,
3535
readFile,
36+
runInMacroContext,
3637
warn,
3738
warnOnce,
3839
warningOccured,
@@ -79,6 +80,19 @@ function stringifyWithFunctions(obj) {
7980
if (Array.isArray(obj)) {
8081
return '[' + obj.map(stringifyWithFunctions).join(',') + ']';
8182
}
83+
84+
// preserve the type of the object if it is one of [Map, Set, WeakMap, WeakSet].
85+
const builtinContainers = runInMacroContext('[Map, Set, WeakMap, WeakSet]', {
86+
filename: '<internal>',
87+
});
88+
for (const container of builtinContainers) {
89+
if (obj instanceof container) {
90+
const className = container.name;
91+
assert(!obj.size, `cannot stringify ${className} with data`);
92+
return `new ${className}`;
93+
}
94+
}
95+
8296
var rtn = '{\n';
8397
for (const [key, value] of Object.entries(obj)) {
8498
var str = stringifyWithFunctions(value);

src/lib/libhtml5_webgl.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,10 @@ var LibraryHtml5WebGL = {
109109
#endif
110110

111111
var canvas = findCanvasEventTarget(target);
112-
112+
#if OFFSCREENCANVAS_SUPPORT
113+
// If our canvas from findCanvasEventTarget is actually an offscreen canvas record, we should extract the inner canvas.
114+
if (canvas?.canvas) { canvas = canvas.canvas; }
115+
#endif
113116
#if GL_DEBUG
114117
var targetStr = UTF8ToString(target);
115118
#endif

src/lib/libsyscall.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -794,7 +794,11 @@ var SyscallsLibrary = {
794794
}
795795
case {{{ cDefs.F_SETLK }}}:
796796
case {{{ cDefs.F_SETLKW }}}:
797-
return 0; // Pretend that the locking is successful.
797+
// Pretend that the locking is successful. These are process-level locks,
798+
// and Emscripten programs are a single process. If we supported linking a
799+
// filesystem between programs, we'd need to do more here.
800+
// See https://github.com/emscripten-core/emscripten/issues/23697
801+
return 0;
798802
#if SYSCALL_DEBUG
799803
case {{{ cDefs.F_GETOWN_EX }}}:
800804
case {{{ cDefs.F_SETOWN }}}:

system/lib/libc/emscripten_libc_stubs.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,10 @@ weak void setgrent(void) {
147147
// ==========================================================================
148148

149149
weak int flock(int fd, int operation) {
150-
// int flock(int fd, int operation);
151-
// Pretend to succeed
150+
// Pretend that the locking is successful. These are process-level locks,
151+
// and Emscripten programs are a single process. If we supported linking a
152+
// filesystem between programs, we'd need to do more here.
153+
// See https://github.com/emscripten-core/emscripten/issues/23697
152154
return 0;
153155
}
154156

system/lib/wasmfs/syscalls.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1521,8 +1521,11 @@ int __syscall_fcntl64(int fd, int cmd, ...) {
15211521
case F_SETLKW: {
15221522
static_assert(F_SETLK == F_SETLK64);
15231523
static_assert(F_SETLKW == F_SETLKW64);
1524-
// Always error for now, until we implement byte-range locks.
1525-
return -EACCES;
1524+
// Pretend that the locking is successful. These are process-level locks,
1525+
// and Emscripten programs are a single process. If we supported linking a
1526+
// filesystem between programs, we'd need to do more here.
1527+
// See https://github.com/emscripten-core/emscripten/issues/23697
1528+
return 0;
15261529
}
15271530
default: {
15281531
// TODO: support any remaining cmds

test/browser/webgl_create_context_swapcontrol.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,13 @@ int main() {
2323
EMSCRIPTEN_RESULT res = emscripten_webgl_make_context_current(context);
2424
assert(res == EMSCRIPTEN_RESULT_SUCCESS);
2525
assert(emscripten_webgl_get_current_context() == context);
26+
emscripten_webgl_destroy_context(context);
27+
// Test that creating a context for a canvas that's already been used once succeeds
28+
context = emscripten_webgl_create_context("#canvas", &attrs);
29+
assert(context > 0); // Must have received a valid context.
30+
res = emscripten_webgl_make_context_current(context);
31+
assert(res == EMSCRIPTEN_RESULT_SUCCESS);
32+
assert(emscripten_webgl_get_current_context() == context);
33+
emscripten_webgl_destroy_context(context);
2634
return 0;
2735
}

test/common.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1167,7 +1167,6 @@ def set_temp_dir(self, temp_dir):
11671167
@classmethod
11681168
def setUpClass(cls):
11691169
super().setUpClass()
1170-
print('(checking sanity from test runner)') # do this after we set env stuff
11711170
shared.check_sanity(force=True)
11721171

11731172
def setUp(self):

test/parallel_testsuite.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717

1818
NUM_CORES = None
19+
seen_class = set()
1920

2021

2122
def run_test(test):
@@ -24,6 +25,9 @@ def run_test(test):
2425
temp_dir = tempfile.mkdtemp(prefix='emtest_')
2526
test.set_temp_dir(temp_dir)
2627
try:
28+
if test.__class__ not in seen_class:
29+
seen_class.add(test.__class__)
30+
test.__class__.setUpClass()
2731
test(result)
2832
except unittest.SkipTest as e:
2933
result.addSkip(test, e)

test/sqlite/test.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,22 @@ int main(){
3232
NULL
3333
};
3434

35-
rc = sqlite3_open(":memory:", &db);
36-
if( rc ){
37-
fprintf(stderr, "Can't open database: %s\n", sqlite3_errmsg(db));
35+
rc = sqlite3_open("test.db", &db);
36+
if (rc) {
37+
printf("Can't open database: %s\n", sqlite3_errmsg(db));
3838
sqlite3_close(db);
3939
exit(1);
4040
}
41+
4142
for (i = 0; commands[i]; i++) {
4243
rc = sqlite3_exec(db, commands[i], callback, 0, &zErrMsg);
43-
if( rc!=SQLITE_OK ){
44-
fprintf(stderr, "SQL error on %d: %s\n", i, zErrMsg);
44+
if (rc != SQLITE_OK){
45+
printf("SQL error on %d: %s\n", i, zErrMsg);
4546
sqlite3_free(zErrMsg);
4647
exit(1);
4748
}
4849
}
50+
4951
sqlite3_close(db);
5052
return 0;
5153
}

test/sqlite/benchmark.out renamed to test/sqlite/test.out

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
count(*) = 2
22

3-
datetime('2012-04-16 12:35:57', '+1 days') = 2012-04-17 12:35:57
4-
53
a = 1
64
b = 13153
75
c = thirteen thousand one hundred fifty three

0 commit comments

Comments
 (0)