diff --git a/src/lib/libfs.js b/src/lib/libfs.js index 4907180698353..8f7a58df004fd 100644 --- a/src/lib/libfs.js +++ b/src/lib/libfs.js @@ -54,7 +54,7 @@ FS.staticInit();`; devices: {}, streams: [], nextInode: 1, - nameTable: null, + nameTable: [], currentPath: '/', initialized: false, // Whether we are currently ignoring permissions. Useful when preparing the @@ -373,7 +373,7 @@ FS.staticInit();`; // if we failed to find it in the cache, call into the VFS return FS.lookup(parent, name); }, - createNode(parent, name, mode, rdev) { + createNode(parent, name, mode, rdev = undefined) { #if ASSERTIONS assert(typeof parent == 'object') #endif @@ -815,7 +815,7 @@ FS.staticInit();`; return FS.mknod(path, mode, 0); }, // Creates a whole directory tree chain if it doesn't yet exist - mkdirTree(path, mode) { + mkdirTree(path, mode = 0o777) { var dirs = path.split('/'); var d = ''; for (var dir of dirs) { @@ -829,7 +829,7 @@ FS.staticInit();`; } } }, - mkdev(path, mode, dev) { + mkdev(path, mode, dev = undefined) { if (typeof dev == 'undefined') { dev = mode; mode = 0o666; @@ -1040,7 +1040,7 @@ FS.staticInit();`; } return link.node_ops.readlink(link); }, - stat(path, dontFollow) { + stat(path, dontFollow = false) { var lookup = FS.lookupPath(path, { follow: !dontFollow }); var node = lookup.node; var getattr = FS.checkOpExists(node.node_ops.getattr, {{{ cDefs.EPERM }}}); @@ -1058,14 +1058,14 @@ FS.staticInit();`; lstat(path) { return FS.stat(path, true); }, - doChmod(stream, node, mode, dontFollow) { + doChmod(stream, node, mode, dontFollow = false) { FS.doSetAttr(stream, node, { mode: (mode & {{{ cDefs.S_IALLUGO }}}) | (node.mode & ~{{{ cDefs.S_IALLUGO }}}), ctime: Date.now(), dontFollow }); }, - chmod(path, mode, dontFollow) { + chmod(path, mode, dontFollow = false) { var node; if (typeof path == 'string') { var lookup = FS.lookupPath(path, { follow: !dontFollow }); @@ -1082,14 +1082,14 @@ FS.staticInit();`; var stream = FS.getStreamChecked(fd); FS.doChmod(stream, stream.node, mode, false); }, - doChown(stream, node, dontFollow) { + doChown(stream, node, dontFollow = false) { FS.doSetAttr(stream, node, { timestamp: Date.now(), dontFollow // we ignore the uid / gid for now }); }, - chown(path, uid, gid, dontFollow) { + chown(path, uid, gid, dontFollow = false) { var node; if (typeof path == 'string') { var lookup = FS.lookupPath(path, { follow: !dontFollow }); @@ -1142,7 +1142,7 @@ FS.staticInit();`; } FS.doTruncate(stream, stream.node, len); }, - utime(path, atime, mtime, dontFollow) { + utime(path, atime, mtime, dontFollow = false) { var lookup = FS.lookupPath(path, { follow: !dontFollow }); FS.doSetAttr(null, lookup.node, { atime: atime, @@ -1305,7 +1305,7 @@ FS.staticInit();`; #endif return stream.position; }, - read(stream, buffer, offset, length, position) { + read(stream, buffer, offset, length, position = undefined) { #if ASSERTIONS assert(offset >= 0); #endif @@ -1342,7 +1342,7 @@ FS.staticInit();`; /** * @param {TypedArray} buffer */ - write(stream, buffer, offset, length, position, canOwn) { + write(stream, buffer, offset, length, position = undefined, canOwn = undefined) { #if ASSERTIONS assert(offset >= 0); assert(buffer.subarray, 'FS.write expects a TypedArray'); @@ -1575,7 +1575,7 @@ FS.staticInit();`; #endif }, staticInit() { - FS.nameTable = new Array(4096); + FS.nameTable.length = 4096; FS.mount(MEMFS, {}, '/'); @@ -1599,7 +1599,7 @@ FS.staticInit();`; #endif }; }, - init(input, output, error) { + init(input = undefined, output = undefined, error = undefined) { #if ASSERTIONS assert(!FS.initialized, 'FS.init was previously called. If you want to initialize later with custom parameters, remove any earlier calls (note that one is automatically added to the generated code)'); #endif @@ -1635,14 +1635,14 @@ FS.staticInit();`; // // old v1 compatibility functions // - findObject(path, dontResolveLastLink) { + findObject(path, dontResolveLastLink = false) { var ret = FS.analyzePath(path, dontResolveLastLink); if (!ret.exists) { return null; } return ret.object; }, - analyzePath(path, dontResolveLastLink) { + analyzePath(path, dontResolveLastLink = false) { // operate from within the context of the symlink's target try { var lookup = FS.lookupPath(path, { follow: !dontResolveLastLink }); @@ -1670,7 +1670,7 @@ FS.staticInit();`; }; return ret; }, - createPath(parent, path, canRead, canWrite) { + createPath(parent, path, canRead = undefined, canWrite = undefined) { parent = typeof parent == 'string' ? parent : FS.getPath(parent); var parts = path.split('/').reverse(); while (parts.length) { @@ -1686,7 +1686,7 @@ FS.staticInit();`; } return current; }, - createFile(parent, name, properties, canRead, canWrite) { + createFile(parent, name, properties, canRead = undefined, canWrite = undefined) { var path = PATH.join2(typeof parent == 'string' ? parent : FS.getPath(parent), name); var mode = FS_getMode(canRead, canWrite); return FS.create(path, mode); @@ -1694,7 +1694,7 @@ FS.staticInit();`; /** * @param {TypedArray|Array|string=} data */ - createDataFile(parent, name, data, canRead, canWrite, canOwn) { + createDataFile(parent, name, data = undefined, canRead = undefined, canWrite = undefined, canOwn = undefined) { var path = name; if (parent) { parent = typeof parent == 'string' ? parent : FS.getPath(parent); @@ -1712,7 +1712,7 @@ FS.staticInit();`; FS.chmod(node, mode); } }, - createDevice(parent, name, input, output) { + createDevice(parent, name, input = undefined, output = undefined) { var path = PATH.join2(typeof parent == 'string' ? parent : FS.getPath(parent), name); var mode = FS_getMode(!!input, !!output); FS.createDevice.major ??= 64; @@ -1789,7 +1789,7 @@ FS.staticInit();`; // Creates a file record for lazy-loading from a URL. XXX This requires a synchronous // XHR, which is not possible in browsers except in a web worker! Use preloading, // either --preload-file in emcc or FS.createPreloadedFile - createLazyFile(parent, name, url, canRead, canWrite) { + createLazyFile(parent, name, url, canRead = undefined, canWrite = undefined) { // Lazy chunked Uint8Array (implements get and length from Uint8Array). // Actual getting is abstracted away for eventual reuse. class LazyUint8Array { diff --git a/src/lib/libmemfs.js b/src/lib/libmemfs.js index 5c0b4d4f53eda..76f79f47b8915 100644 --- a/src/lib/libmemfs.js +++ b/src/lib/libmemfs.js @@ -11,7 +11,7 @@ addToLibrary({ mount(mount) { return MEMFS.createNode(null, '/', {{{ cDefs.S_IFDIR | 0o777 }}}, 0); }, - createNode(parent, name, mode, dev) { + createNode(parent, name, mode, dev = undefined) { if (FS.isBlkdev(mode) || FS.isFIFO(mode)) { // not supported throw new FS.ErrnoError({{{ cDefs.EPERM }}}); @@ -186,7 +186,7 @@ addToLibrary({ throw MEMFS.doesNotExistError; #endif }, - mknod(parent, name, mode, dev) { + mknod(parent, name, mode, dev = undefined) { return MEMFS.createNode(parent, name, mode, dev); }, rename(old_node, new_dir, new_name) { diff --git a/src/lib/libnodefs.js b/src/lib/libnodefs.js index dd839a36f93fd..c099765b0bf05 100644 --- a/src/lib/libnodefs.js +++ b/src/lib/libnodefs.js @@ -62,7 +62,7 @@ addToLibrary({ #endif return NODEFS.createNode(null, '/', NODEFS.getMode(mount.opts.root), 0); }, - createNode(parent, name, mode, dev) { + createNode(parent, name, mode, dev = undefined) { if (!FS.isDir(mode) && !FS.isFile(mode) && !FS.isLink(mode)) { throw new FS.ErrnoError({{{ cDefs.EINVAL }}}); } @@ -200,7 +200,7 @@ addToLibrary({ var mode = NODEFS.getMode(path); return NODEFS.createNode(parent, name, mode); }, - mknod(parent, name, mode, dev) { + mknod(parent, name, mode, dev = undefined) { var node = NODEFS.createNode(parent, name, mode, dev); // create the backing node for this in the fs root as well var path = NODEFS.realPath(node); @@ -314,7 +314,7 @@ addToLibrary({ return { ptr, allocated: true }; }, msync(stream, buffer, offset, length, mmapFlags) { - NODEFS.stream_ops.write(stream, buffer, 0, length, offset, false); + NODEFS.stream_ops.write(stream, buffer, 0, length, offset); // should we check if bytesWritten and length are the same? return 0; } diff --git a/src/lib/libnoderawfs.js b/src/lib/libnoderawfs.js index ce4afbdfa01da..ac4672e4c2e19 100644 --- a/src/lib/libnoderawfs.js +++ b/src/lib/libnoderawfs.js @@ -101,7 +101,7 @@ addToLibrary({ readdir(...args) { return ['.', '..'].concat(fs.readdirSync(...args)); }, unlink(...args) { fs.unlinkSync(...args); }, readlink(...args) { return fs.readlinkSync(...args); }, - stat(path, dontFollow) { + stat(path, dontFollow = false) { var stat = dontFollow ? fs.lstatSync(path) : fs.statSync(path); if (NODEFS.isWindows) { // Windows does not report the 'x' permission bit, so propagate read @@ -133,7 +133,7 @@ addToLibrary({ statfsStream(stream) { return FS.statfs(stream.path); }, - chmod(path, mode, dontFollow) { + chmod(path, mode, dontFollow = false) { mode &= {{{ cDefs.S_IALLUGO }}}; if (NODEFS.isWindows) { // Windows only supports S_IREAD / S_IWRITE (S_IRUSR / S_IWUSR) @@ -171,7 +171,7 @@ addToLibrary({ var stream = FS.getStreamChecked(fd); fs.ftruncateSync(stream.nfd, len); }, - utime(path, atime, mtime, dontFollow) { + utime(path, atime, mtime, dontFollow = false) { // null here for atime or mtime means UTIME_OMIT was passed. Since node // doesn't support this concept we need to first find the existing // timestamps in order to preserve them. diff --git a/src/lib/libsockfs.js b/src/lib/libsockfs.js index 44f9a934e5439..a2778f7acced9 100644 --- a/src/lib/libsockfs.js +++ b/src/lib/libsockfs.js @@ -209,7 +209,7 @@ addToLibrary({ // these functions aren't actually sock_ops members, but we're // abusing the namespace to organize them // - createPeer(sock, addr, port) { + createPeer(sock, addr, port = undefined) { var ws; if (typeof addr == 'object') { diff --git a/src/lib/libsyscall.js b/src/lib/libsyscall.js index 38fa259ba4c87..cd95f5d24142a 100644 --- a/src/lib/libsyscall.js +++ b/src/lib/libsyscall.js @@ -17,7 +17,7 @@ var SyscallsLibrary = { // global constants // shared utilities - calculateAt(dirfd, path, allowEmpty) { + calculateAt(dirfd, path, allowEmpty = false) { if (PATH.isAbs(path)) { return path; } @@ -947,7 +947,7 @@ var SyscallsLibrary = { path = SYSCALLS.getStr(path); path = SYSCALLS.calculateAt(dirfd, path); mode &= ~SYSCALLS.currentUmask; - FS.mkdir(path, mode, 0); + FS.mkdir(path, mode); return 0; }, __syscall_mknodat: (dirfd, path, mode, dev) => { diff --git a/test/codesize/test_codesize_cxx_ctors1.json b/test/codesize/test_codesize_cxx_ctors1.json index ef85ddc7054d5..a0694a1959d2d 100644 --- a/test/codesize/test_codesize_cxx_ctors1.json +++ b/test/codesize/test_codesize_cxx_ctors1.json @@ -1,10 +1,10 @@ { - "a.out.js": 19224, - "a.out.js.gz": 8124, + "a.out.js": 19218, + "a.out.js.gz": 8121, "a.out.nodebug.wasm": 133971, "a.out.nodebug.wasm.gz": 51271, - "total": 153195, - "total_gz": 59395, + "total": 153189, + "total_gz": 59392, "sent": [ "__cxa_throw", "_abort_js", diff --git a/test/codesize/test_codesize_cxx_ctors2.json b/test/codesize/test_codesize_cxx_ctors2.json index 9745a6316785d..71a1328e7d801 100644 --- a/test/codesize/test_codesize_cxx_ctors2.json +++ b/test/codesize/test_codesize_cxx_ctors2.json @@ -1,10 +1,10 @@ { - "a.out.js": 19201, - "a.out.js.gz": 8107, + "a.out.js": 19195, + "a.out.js.gz": 8105, "a.out.nodebug.wasm": 133403, "a.out.nodebug.wasm.gz": 50959, - "total": 152604, - "total_gz": 59066, + "total": 152598, + "total_gz": 59064, "sent": [ "__cxa_throw", "_abort_js", diff --git a/test/codesize/test_codesize_cxx_except.json b/test/codesize/test_codesize_cxx_except.json index 8e083d22ec62b..37a674a597a8b 100644 --- a/test/codesize/test_codesize_cxx_except.json +++ b/test/codesize/test_codesize_cxx_except.json @@ -1,10 +1,10 @@ { - "a.out.js": 22917, - "a.out.js.gz": 9082, + "a.out.js": 22911, + "a.out.js.gz": 9079, "a.out.nodebug.wasm": 176383, "a.out.nodebug.wasm.gz": 58776, - "total": 199300, - "total_gz": 67858, + "total": 199294, + "total_gz": 67855, "sent": [ "__cxa_begin_catch", "__cxa_end_catch", diff --git a/test/codesize/test_codesize_cxx_except_wasm.json b/test/codesize/test_codesize_cxx_except_wasm.json index acce5eb08a6f9..d1e55f9d362f7 100644 --- a/test/codesize/test_codesize_cxx_except_wasm.json +++ b/test/codesize/test_codesize_cxx_except_wasm.json @@ -1,10 +1,10 @@ { - "a.out.js": 19023, - "a.out.js.gz": 8039, + "a.out.js": 19017, + "a.out.js.gz": 8038, "a.out.nodebug.wasm": 149640, "a.out.nodebug.wasm.gz": 56311, - "total": 168663, - "total_gz": 64350, + "total": 168657, + "total_gz": 64349, "sent": [ "_abort_js", "_tzset_js", diff --git a/test/codesize/test_codesize_cxx_except_wasm_legacy.json b/test/codesize/test_codesize_cxx_except_wasm_legacy.json index 7d2e3ac6023e4..a93b588230acd 100644 --- a/test/codesize/test_codesize_cxx_except_wasm_legacy.json +++ b/test/codesize/test_codesize_cxx_except_wasm_legacy.json @@ -1,10 +1,10 @@ { - "a.out.js": 19101, - "a.out.js.gz": 8065, + "a.out.js": 19095, + "a.out.js.gz": 8063, "a.out.nodebug.wasm": 147422, "a.out.nodebug.wasm.gz": 55982, - "total": 166523, - "total_gz": 64047, + "total": 166517, + "total_gz": 64045, "sent": [ "_abort_js", "_tzset_js", diff --git a/test/codesize/test_codesize_cxx_lto.json b/test/codesize/test_codesize_cxx_lto.json index 5bf114b165af0..10cc5c1347880 100644 --- a/test/codesize/test_codesize_cxx_lto.json +++ b/test/codesize/test_codesize_cxx_lto.json @@ -1,10 +1,10 @@ { - "a.out.js": 18568, - "a.out.js.gz": 7818, + "a.out.js": 18562, + "a.out.js.gz": 7814, "a.out.nodebug.wasm": 101064, "a.out.nodebug.wasm.gz": 38292, - "total": 119632, - "total_gz": 46110, + "total": 119626, + "total_gz": 46106, "sent": [ "a (emscripten_resize_heap)", "b (_setitimer_js)", diff --git a/test/codesize/test_codesize_cxx_mangle.json b/test/codesize/test_codesize_cxx_mangle.json index a9df7ddb5796f..0db79c3242a54 100644 --- a/test/codesize/test_codesize_cxx_mangle.json +++ b/test/codesize/test_codesize_cxx_mangle.json @@ -1,10 +1,10 @@ { - "a.out.js": 22967, - "a.out.js.gz": 9103, + "a.out.js": 22961, + "a.out.js.gz": 9100, "a.out.nodebug.wasm": 242663, "a.out.nodebug.wasm.gz": 81001, - "total": 265630, - "total_gz": 90104, + "total": 265624, + "total_gz": 90101, "sent": [ "__cxa_begin_catch", "__cxa_end_catch", diff --git a/test/codesize/test_codesize_cxx_noexcept.json b/test/codesize/test_codesize_cxx_noexcept.json index 608a59b681293..a9206ee2b5d16 100644 --- a/test/codesize/test_codesize_cxx_noexcept.json +++ b/test/codesize/test_codesize_cxx_noexcept.json @@ -1,10 +1,10 @@ { - "a.out.js": 19224, - "a.out.js.gz": 8124, + "a.out.js": 19218, + "a.out.js.gz": 8121, "a.out.nodebug.wasm": 135882, "a.out.nodebug.wasm.gz": 51885, - "total": 155106, - "total_gz": 60009, + "total": 155100, + "total_gz": 60006, "sent": [ "__cxa_throw", "_abort_js", diff --git a/test/codesize/test_codesize_file_preload.expected.js b/test/codesize/test_codesize_file_preload.expected.js index 6999515586248..c4f400b37a3b0 100644 --- a/test/codesize/test_codesize_file_preload.expected.js +++ b/test/codesize/test_codesize_file_preload.expected.js @@ -954,7 +954,7 @@ var MEMFS = { mount(mount) { return MEMFS.createNode(null, "/", 16895, 0); }, - createNode(parent, name, mode, dev) { + createNode(parent, name, mode, dev = undefined) { if (FS.isBlkdev(mode) || FS.isFIFO(mode)) { // not supported throw new FS.ErrnoError(63); @@ -1114,7 +1114,7 @@ var MEMFS = { } throw MEMFS.doesNotExistError; }, - mknod(parent, name, mode, dev) { + mknod(parent, name, mode, dev = undefined) { return MEMFS.createNode(parent, name, mode, dev); }, rename(old_node, new_dir, new_name) { @@ -1361,7 +1361,7 @@ var FS = { devices: {}, streams: [], nextInode: 1, - nameTable: null, + nameTable: [], currentPath: "/", initialized: false, ignorePermissions: true, @@ -1623,7 +1623,7 @@ var FS = { // if we failed to find it in the cache, call into the VFS return FS.lookup(parent, name); }, - createNode(parent, name, mode, rdev) { + createNode(parent, name, mode, rdev = undefined) { var node = new FS.FSNode(parent, name, mode, rdev); FS.hashAddNode(node); return node; @@ -1994,7 +1994,7 @@ var FS = { mode |= 16384; return FS.mknod(path, mode, 0); }, - mkdirTree(path, mode) { + mkdirTree(path, mode = 511) { var dirs = path.split("/"); var d = ""; for (var dir of dirs) { @@ -2008,7 +2008,7 @@ var FS = { } } }, - mkdev(path, mode, dev) { + mkdev(path, mode, dev = undefined) { if (typeof dev == "undefined") { dev = mode; mode = 438; @@ -2206,7 +2206,7 @@ var FS = { } return link.node_ops.readlink(link); }, - stat(path, dontFollow) { + stat(path, dontFollow = false) { var lookup = FS.lookupPath(path, { follow: !dontFollow }); @@ -2226,14 +2226,14 @@ var FS = { lstat(path) { return FS.stat(path, true); }, - doChmod(stream, node, mode, dontFollow) { + doChmod(stream, node, mode, dontFollow = false) { FS.doSetAttr(stream, node, { mode: (mode & 4095) | (node.mode & ~4095), ctime: Date.now(), dontFollow }); }, - chmod(path, mode, dontFollow) { + chmod(path, mode, dontFollow = false) { var node; if (typeof path == "string") { var lookup = FS.lookupPath(path, { @@ -2252,13 +2252,13 @@ var FS = { var stream = FS.getStreamChecked(fd); FS.doChmod(stream, stream.node, mode, false); }, - doChown(stream, node, dontFollow) { + doChown(stream, node, dontFollow = false) { FS.doSetAttr(stream, node, { timestamp: Date.now(), dontFollow }); }, - chown(path, uid, gid, dontFollow) { + chown(path, uid, gid, dontFollow = false) { var node; if (typeof path == "string") { var lookup = FS.lookupPath(path, { @@ -2315,7 +2315,7 @@ var FS = { } FS.doTruncate(stream, stream.node, len); }, - utime(path, atime, mtime, dontFollow) { + utime(path, atime, mtime, dontFollow = false) { var lookup = FS.lookupPath(path, { follow: !dontFollow }); @@ -2457,7 +2457,7 @@ var FS = { stream.ungotten = []; return stream.position; }, - read(stream, buffer, offset, length, position) { + read(stream, buffer, offset, length, position = undefined) { if (length < 0 || position < 0) { throw new FS.ErrnoError(28); } @@ -2483,7 +2483,7 @@ var FS = { if (!seeking) stream.position += bytesRead; return bytesRead; }, - write(stream, buffer, offset, length, position, canOwn) { + write(stream, buffer, offset, length, position = undefined, canOwn = undefined) { if (length < 0 || position < 0) { throw new FS.ErrnoError(28); } @@ -2693,7 +2693,7 @@ var FS = { var stderr = FS.open("/dev/stderr", 1); }, staticInit() { - FS.nameTable = new Array(4096); + FS.nameTable.length = 4096; FS.mount(MEMFS, {}, "/"); FS.createDefaultDirectories(); FS.createDefaultDevices(); @@ -2702,7 +2702,7 @@ var FS = { "MEMFS": MEMFS }; }, - init(input, output, error) { + init(input = undefined, output = undefined, error = undefined) { FS.initialized = true; // Allow Module.stdin etc. to provide defaults, if none explicitly passed to us here FS.createStandardStreams(input, output, error); @@ -2717,14 +2717,14 @@ var FS = { } } }, - findObject(path, dontResolveLastLink) { + findObject(path, dontResolveLastLink = false) { var ret = FS.analyzePath(path, dontResolveLastLink); if (!ret.exists) { return null; } return ret.object; }, - analyzePath(path, dontResolveLastLink) { + analyzePath(path, dontResolveLastLink = false) { // operate from within the context of the symlink's target try { var lookup = FS.lookupPath(path, { @@ -2764,7 +2764,7 @@ var FS = { } return ret; }, - createPath(parent, path, canRead, canWrite) { + createPath(parent, path, canRead = undefined, canWrite = undefined) { parent = typeof parent == "string" ? parent : FS.getPath(parent); var parts = path.split("/").reverse(); while (parts.length) { @@ -2780,12 +2780,12 @@ var FS = { } return current; }, - createFile(parent, name, properties, canRead, canWrite) { + createFile(parent, name, properties, canRead = undefined, canWrite = undefined) { var path = PATH.join2(typeof parent == "string" ? parent : FS.getPath(parent), name); var mode = FS_getMode(canRead, canWrite); return FS.create(path, mode); }, - createDataFile(parent, name, data, canRead, canWrite, canOwn) { + createDataFile(parent, name, data = undefined, canRead = undefined, canWrite = undefined, canOwn = undefined) { var path = name; if (parent) { parent = typeof parent == "string" ? parent : FS.getPath(parent); @@ -2803,7 +2803,7 @@ var FS = { FS.chmod(node, mode); } }, - createDevice(parent, name, input, output) { + createDevice(parent, name, input = undefined, output = undefined) { var path = PATH.join2(typeof parent == "string" ? parent : FS.getPath(parent), name); var mode = FS_getMode(!!input, !!output); FS.createDevice.major ??= 64; @@ -2870,7 +2870,7 @@ var FS = { } } }, - createLazyFile(parent, name, url, canRead, canWrite) { + createLazyFile(parent, name, url, canRead = undefined, canWrite = undefined) { // Lazy chunked Uint8Array (implements get and length from Uint8Array). // Actual getting is abstracted away for eventual reuse. class LazyUint8Array { @@ -3058,7 +3058,7 @@ var FS = { var SYSCALLS = { currentUmask: 18, - calculateAt(dirfd, path, allowEmpty) { + calculateAt(dirfd, path, allowEmpty = false) { if (PATH.isAbs(path)) { return path; } diff --git a/test/codesize/test_codesize_file_preload.json b/test/codesize/test_codesize_file_preload.json index 8a288445877b2..7cfc9c75e04ed 100644 --- a/test/codesize/test_codesize_file_preload.json +++ b/test/codesize/test_codesize_file_preload.json @@ -1,10 +1,10 @@ { - "a.out.js": 22203, - "a.out.js.gz": 9267, + "a.out.js": 22197, + "a.out.js.gz": 9262, "a.out.nodebug.wasm": 1198, "a.out.nodebug.wasm.gz": 730, - "total": 23401, - "total_gz": 9997, + "total": 23395, + "total_gz": 9992, "sent": [ "a (fd_write)" ], diff --git a/test/codesize/test_codesize_files_js_fs.json b/test/codesize/test_codesize_files_js_fs.json index 0c033a7242071..ad9375c481336 100644 --- a/test/codesize/test_codesize_files_js_fs.json +++ b/test/codesize/test_codesize_files_js_fs.json @@ -1,10 +1,10 @@ { - "a.out.js": 17871, - "a.out.js.gz": 7460, + "a.out.js": 17865, + "a.out.js.gz": 7456, "a.out.nodebug.wasm": 381, "a.out.nodebug.wasm.gz": 258, - "total": 18252, - "total_gz": 7718, + "total": 18246, + "total_gz": 7714, "sent": [ "a (fd_write)", "b (fd_read)", diff --git a/test/codesize/test_codesize_hello_dylink.json b/test/codesize/test_codesize_hello_dylink.json index 842afdc14b16f..499eb271e3266 100644 --- a/test/codesize/test_codesize_hello_dylink.json +++ b/test/codesize/test_codesize_hello_dylink.json @@ -1,10 +1,10 @@ { - "a.out.js": 26188, - "a.out.js.gz": 11168, + "a.out.js": 26182, + "a.out.js.gz": 11167, "a.out.nodebug.wasm": 16985, "a.out.nodebug.wasm.gz": 8674, - "total": 43173, - "total_gz": 19842, + "total": 43167, + "total_gz": 19841, "sent": [ "__syscall_stat64", "emscripten_resize_heap", diff --git a/test/codesize/test_codesize_hello_dylink_all.json b/test/codesize/test_codesize_hello_dylink_all.json index ecc5f257dc567..ef38223fdd62f 100644 --- a/test/codesize/test_codesize_hello_dylink_all.json +++ b/test/codesize/test_codesize_hello_dylink_all.json @@ -1,7 +1,7 @@ { - "a.out.js": 270695, + "a.out.js": 270743, "a.out.nodebug.wasm": 588098, - "total": 858793, + "total": 858841, "sent": [ "IMG_Init", "IMG_Load", diff --git a/test/test_other.py b/test/test_other.py index b755d7b681b5f..9aaeb40412bb5 100644 --- a/test/test_other.py +++ b/test/test_other.py @@ -12419,6 +12419,27 @@ def test_closure_warnings(self, flags, outcome): else: self.assertContained(outcome, proc.stderr) + @parameterized({ + '': ([],), + 'nodefs_sockfs': (['-lnodefs.js', '-lsockfs.js'],), + }) + def test_closure_fs_es6(self, args): + # TODO: Delete this test once test_closure_full_js_library can run with + # -sEXPORT_ES6. Currently -sINCLUDE_FULL_LIBRARY + -sEXPORT_ES6 fails due + # to Closure internal compiler errors (JSC_ILLEGAL_MODULE_RENAMING_CONFLICT): + # https://github.com/google/closure-compiler/issues/4344 + self.build('hello_world.c', output_suffix='.mjs', cflags=[ + '-O2', + '-sEXPORT_ES6', + '-sFORCE_FILESYSTEM', + '--closure=1', + ] + args) + create_file('run.mjs', ''' + import Module from './hello_world.mjs'; + await Module(); + ''') + self.assertContained('Hello, world!\n', self.run_js('run.mjs')) + def test_bitcode_input(self): # Verify that bitcode files are accepted as input create_file('main.c', 'void foo(); int main() { return 0; }')