diff --git a/.circleci/config.yml b/.circleci/config.yml index 4f64f4e80a7b1..3091affffee23 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -766,6 +766,8 @@ jobs: - run-tests: title: "node (oldest / 10.19.0)" extra-cflags: "-sMIN_NODE_VERSION=101900" + # We include most but not all of the nodefs and node rawfs tests here. + # test_fs_nodefs_rw, test_fs_nodefs_statvfs, and test_unistd_io_nodefs_bigint fail. test_targets: " other.test_gen_struct_info other.test_native_call_before_init @@ -773,7 +775,57 @@ jobs: other.test_node_unhandled_rejection other.test_full_js_library* core2.test_hello_world - core2.test_fs_write_rawfs" + core2.test_fcntl_open_nodefs + core2.test_fcntl_open_rawfs + core2.test_fgetc_ungetc_nodefs + core2.test_fgetc_ungetc_rawfs + core2.test_fs_append_rawfs + core2.test_fs_emptyPath_rawfs + core2.test_fs_enotdir_nodefs + core2.test_fs_enotdir_rawfs + core2.test_fs_errorstack_rawfs + core2.test_fs_llseek_rawfs + core2.test_fs_mkdir_dotdot_nodefs + core2.test_fs_mkdir_dotdot_rawfs + core2.test_fs_mmap_nodefs + core2.test_fs_mmap_rawfs + core2.test_fs_nodefs_cloexec + core2.test_fs_nodefs_cloexec_rawfs + core2.test_fs_nodefs_dup + core2.test_fs_nodefs_dup_rawfs + core2.test_fs_nodefs_home + core2.test_fs_nodefs_nofollow + core2.test_fs_nodefs_readdir + core2.test_fs_noderawfs_nofollow + core2.test_fs_readdir_ino_matches_stat_ino_nodefs + core2.test_fs_readdir_ino_matches_stat_ino_rawfs + core2.test_fs_readv_rawfs + core2.test_fs_rename_on_existing_nodefs + core2.test_fs_rename_on_existing_rawfs + core2.test_fs_symlink_resolution_nodefs + core2.test_fs_symlink_resolution_rawfs + core2.test_fs_writeFile_rawfs + core2.test_fs_writeFile_wasmfs_rawfs + core2.test_fs_write_rawfs + core2.test_fs_writev_rawfs + core2.test_futimens_rawfs + core2.test_readdir_rawfs + core2.test_stat_chmod_rawfs + core2.test_unistd_access_nodefs + core2.test_unistd_access_rawfs + core2.test_unistd_close_rawfs + core2.test_unistd_dup_rawfs + core2.test_unistd_io_nodefs + core2.test_unistd_links_nodefs + core2.test_unistd_misc_nodefs + core2.test_unistd_pipe_rawfs + core2.test_unistd_symlink_on_nodefs + core2.test_unistd_truncate_nodefs + core2.test_unistd_truncate_rawfs + core2.test_unistd_unlink_nodefs + core2.test_unistd_unlink_rawfs + core2.test_unistd_write_broken_link_rawfs + " # Run a few test with the most recent version of node # In particular we have some tests that require node flags on older # versions of node but not with the most recent version. diff --git a/src/closure-externs/node-externs.js b/src/closure-externs/node-externs.js index 39295ed5b1fa7..afb0c14d52d94 100644 --- a/src/closure-externs/node-externs.js +++ b/src/closure-externs/node-externs.js @@ -126,6 +126,11 @@ fs.Stats.prototype.mtimeMs; */ fs.Stats.prototype.ctimeMs; +/** + * @type {number} + */ +fs.Stats.prototype.blksize; + /** * @param {string} p * @return {boolean} diff --git a/src/library_nodefs.js b/src/library_nodefs.js index b5d893f5a6355..05b1976c392d2 100644 --- a/src/library_nodefs.js +++ b/src/library_nodefs.js @@ -19,11 +19,7 @@ addToLibrary({ isWindows: false, staticInit() { NODEFS.isWindows = !!process.platform.match(/^win/); - var flags = process.binding("constants"); - // Node.js 4 compatibility: it has no namespaces for constants - if (flags["fs"]) { - flags = flags["fs"]; - } + var flags = process.binding("constants")["fs"]; NODEFS.flagsForNodeMap = { "{{{ cDefs.O_APPEND }}}": flags["O_APPEND"], "{{{ cDefs.O_CREAT }}}": flags["O_CREAT"], @@ -123,15 +119,6 @@ addToLibrary({ var stat; NODEFS.tryFSOperation(() => stat = fs.lstatSync(path)); if (NODEFS.isWindows) { - // node.js v0.10.20 doesn't report blksize and blocks on Windows. Fake - // them with default blksize of 4096. - // See http://support.microsoft.com/kb/140365 - if (!stat.blksize) { - stat.blksize = 4096; - } - if (!stat.blocks) { - stat.blocks = (stat.size+stat.blksize-1)/stat.blksize|0; - } // Windows does not report the 'x' permission bit, so propagate read // bits to execute bits. stat.mode |= (stat.mode & {{{ cDefs.S_IRUGO }}}) >> 2; @@ -261,8 +248,6 @@ addToLibrary({ stream.shared.refcount++; }, read(stream, buffer, offset, length, position) { - // Node.js < 6 compatibility: node errors on 0 length reads - if (length === 0) return 0; return NODEFS.tryFSOperation(() => fs.readSync(stream.nfd, new Int8Array(buffer.buffer, offset, length), 0, length, position) ); diff --git a/test/other/codesize/test_codesize_cxx_ctors1.jssize b/test/other/codesize/test_codesize_cxx_ctors1.jssize index 0fad91266841b..74845a5739191 100644 --- a/test/other/codesize/test_codesize_cxx_ctors1.jssize +++ b/test/other/codesize/test_codesize_cxx_ctors1.jssize @@ -1 +1 @@ -20272 +20283 diff --git a/test/other/codesize/test_codesize_cxx_ctors2.gzsize b/test/other/codesize/test_codesize_cxx_ctors2.gzsize index e7f2f2aa09e70..ffa23b506397f 100644 --- a/test/other/codesize/test_codesize_cxx_ctors2.gzsize +++ b/test/other/codesize/test_codesize_cxx_ctors2.gzsize @@ -1 +1 @@ -8334 +8332 diff --git a/test/other/codesize/test_codesize_cxx_ctors2.jssize b/test/other/codesize/test_codesize_cxx_ctors2.jssize index b4fb6fa3b6ed0..9d50095ae089f 100644 --- a/test/other/codesize/test_codesize_cxx_ctors2.jssize +++ b/test/other/codesize/test_codesize_cxx_ctors2.jssize @@ -1 +1 @@ -20240 +20251 diff --git a/test/other/codesize/test_codesize_cxx_except.jssize b/test/other/codesize/test_codesize_cxx_except.jssize index bb19be6b21080..1ecbbebad9238 100644 --- a/test/other/codesize/test_codesize_cxx_except.jssize +++ b/test/other/codesize/test_codesize_cxx_except.jssize @@ -1 +1 @@ -24040 +24051 diff --git a/test/other/codesize/test_codesize_cxx_except_wasm.gzsize b/test/other/codesize/test_codesize_cxx_except_wasm.gzsize index 6a8b03d0c606f..e11d08c1e9fc0 100644 --- a/test/other/codesize/test_codesize_cxx_except_wasm.gzsize +++ b/test/other/codesize/test_codesize_cxx_except_wasm.gzsize @@ -1 +1 @@ -8296 +8298 diff --git a/test/other/codesize/test_codesize_cxx_except_wasm.jssize b/test/other/codesize/test_codesize_cxx_except_wasm.jssize index 40f1ea523e199..d0760fea20860 100644 --- a/test/other/codesize/test_codesize_cxx_except_wasm.jssize +++ b/test/other/codesize/test_codesize_cxx_except_wasm.jssize @@ -1 +1 @@ -20165 +20176 diff --git a/test/other/codesize/test_codesize_cxx_except_wasm_exnref.gzsize b/test/other/codesize/test_codesize_cxx_except_wasm_exnref.gzsize index 6a8b03d0c606f..e11d08c1e9fc0 100644 --- a/test/other/codesize/test_codesize_cxx_except_wasm_exnref.gzsize +++ b/test/other/codesize/test_codesize_cxx_except_wasm_exnref.gzsize @@ -1 +1 @@ -8296 +8298 diff --git a/test/other/codesize/test_codesize_cxx_except_wasm_exnref.jssize b/test/other/codesize/test_codesize_cxx_except_wasm_exnref.jssize index 40f1ea523e199..d0760fea20860 100644 --- a/test/other/codesize/test_codesize_cxx_except_wasm_exnref.jssize +++ b/test/other/codesize/test_codesize_cxx_except_wasm_exnref.jssize @@ -1 +1 @@ -20165 +20176 diff --git a/test/other/codesize/test_codesize_cxx_lto.gzsize b/test/other/codesize/test_codesize_cxx_lto.gzsize index 477a586314ed3..7e8ca2500c174 100644 --- a/test/other/codesize/test_codesize_cxx_lto.gzsize +++ b/test/other/codesize/test_codesize_cxx_lto.gzsize @@ -1 +1 @@ -8364 +8362 diff --git a/test/other/codesize/test_codesize_cxx_lto.jssize b/test/other/codesize/test_codesize_cxx_lto.jssize index e5351bb2b3ec6..424ca27fe72ed 100644 --- a/test/other/codesize/test_codesize_cxx_lto.jssize +++ b/test/other/codesize/test_codesize_cxx_lto.jssize @@ -1 +1 @@ -20348 +20358 diff --git a/test/other/codesize/test_codesize_cxx_mangle.jssize b/test/other/codesize/test_codesize_cxx_mangle.jssize index bb19be6b21080..1ecbbebad9238 100644 --- a/test/other/codesize/test_codesize_cxx_mangle.jssize +++ b/test/other/codesize/test_codesize_cxx_mangle.jssize @@ -1 +1 @@ -24040 +24051 diff --git a/test/other/codesize/test_codesize_cxx_noexcept.jssize b/test/other/codesize/test_codesize_cxx_noexcept.jssize index 0fad91266841b..74845a5739191 100644 --- a/test/other/codesize/test_codesize_cxx_noexcept.jssize +++ b/test/other/codesize/test_codesize_cxx_noexcept.jssize @@ -1 +1 @@ -20272 +20283 diff --git a/test/other/codesize/test_codesize_files_js_fs.gzsize b/test/other/codesize/test_codesize_files_js_fs.gzsize index 1a0aa753be972..6c91e7cae6c8a 100644 --- a/test/other/codesize/test_codesize_files_js_fs.gzsize +++ b/test/other/codesize/test_codesize_files_js_fs.gzsize @@ -1 +1 @@ -7652 +7653 diff --git a/test/other/codesize/test_codesize_files_js_fs.jssize b/test/other/codesize/test_codesize_files_js_fs.jssize index 9b275a14be9a9..5549f3cd84f9a 100644 --- a/test/other/codesize/test_codesize_files_js_fs.jssize +++ b/test/other/codesize/test_codesize_files_js_fs.jssize @@ -1 +1 @@ -18819 +18830