Skip to content

Commit

Permalink
Merge pull request #1015 from nodejs/main
Browse files Browse the repository at this point in the history
Create a new pull request by comparing changes across two branches
  • Loading branch information
GulajavaMinistudio authored Aug 12, 2024
2 parents db1fc05 + 9a4eb21 commit 51fa7c0
Show file tree
Hide file tree
Showing 210 changed files with 8,234 additions and 3,671 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@
/doc/api/permissions.md @nodejs/security-wg
/lib/internal/process/permission.js @nodejs/security-wg
/src/permission/* @nodejs/security-wg
/test/parallel/test-permission-* @nodejs/security-wg

# Dependency Update Tools

Expand Down
2 changes: 1 addition & 1 deletion benchmark/fs/bench-chownSync.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function main({ n, type, method }) {
}
}
bench.end(n);
assert(hasError);
assert.ok(hasError);
break;
}
default:
Expand Down
2 changes: 1 addition & 1 deletion benchmark/fs/bench-linkSync.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function main({ n, type }) {
}
}
bench.end(n);
assert(hasError);
assert.ok(hasError);
break;
}
default:
Expand Down
4 changes: 2 additions & 2 deletions benchmark/fs/bench-readlinkSync.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function main({ n, type }) {
returnValue = fs.readlinkSync(tmpdir.resolve(`.readlink-sync-${i}`), { encoding: 'utf8' });
}
bench.end(n);
assert(returnValue);
assert.ok(returnValue);
break;
}

Expand All @@ -45,7 +45,7 @@ function main({ n, type }) {
}
}
bench.end(n);
assert(hasError);
assert.ok(hasError);
break;
}
default:
Expand Down
2 changes: 1 addition & 1 deletion benchmark/fs/bench-readvSync.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function main({ n, type }) {
}

bench.end(n);
assert(hasError);
assert.ok(hasError);
break;
}
default:
Expand Down
2 changes: 1 addition & 1 deletion benchmark/fs/bench-renameSync.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function main({ n, type }) {
}
}
bench.end(n);
assert(hasError);
assert.ok(hasError);
break;
}
case 'valid': {
Expand Down
2 changes: 1 addition & 1 deletion benchmark/fs/bench-symlinkSync.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function main({ n, type }) {
}
}
bench.end(n);
assert(hasError);
assert.ok(hasError);
break;
}
default:
Expand Down
4 changes: 2 additions & 2 deletions benchmark/fs/bench-writevSync.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function main({ n, type }) {
}

bench.end(n);
assert(result);
assert.ok(result);
fs.closeSync(fd);
break;
case 'invalid': {
Expand All @@ -46,7 +46,7 @@ function main({ n, type }) {
}

bench.end(n);
assert(hasError);
assert.ok(hasError);
break;
}
default:
Expand Down
2 changes: 1 addition & 1 deletion benchmark/fs/read-stream-throughput.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ function main(conf) {
}

function runTest(filesize, highWaterMark, encoding, n) {
assert(fs.statSync(filename).size === filesize * n);
assert.strictEqual(fs.statSync(filename).size, filesize * n);
const rs = fs.createReadStream(filename, {
highWaterMark,
encoding,
Expand Down
12 changes: 6 additions & 6 deletions benchmark/misc/startup-cli-version.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ const availableCli = [
].filter((cli) => existsSync(path.resolve(__dirname, '../../', cli)));
const bench = common.createBenchmark(main, {
cli: availableCli,
count: [30],
n: [30],
});

function spawnProcess(cli, bench, state) {
const cmd = process.execPath || process.argv[0];
while (state.finished < state.count) {
while (state.finished < state.n) {
const child = spawnSync(cmd, [cli, '--version'], {
env: { npm_config_loglevel: 'silent', ...process.env },
});
Expand All @@ -41,15 +41,15 @@ function spawnProcess(cli, bench, state) {
bench.start();
}

if (state.finished === state.count) {
bench.end(state.count);
if (state.finished === state.n) {
bench.end(state.n);
}
}
}

function main({ count, cli }) {
function main({ n, cli }) {
cli = path.resolve(__dirname, '../../', cli);
const warmup = 3;
const state = { count, finished: -warmup };
const state = { n, finished: -warmup };
spawnProcess(cli, bench, state);
}
16 changes: 8 additions & 8 deletions benchmark/misc/startup-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ const bench = common.createBenchmark(main, {
'test/fixtures/snapshot/typescript',
],
mode: ['process', 'worker'],
count: [30],
n: [30],
});

function spawnProcess(script, bench, state) {
const cmd = process.execPath || process.argv[0];
while (state.finished < state.count) {
while (state.finished < state.n) {
const child = spawnSync(cmd, [script]);
if (child.status !== 0) {
console.log('---- STDOUT ----');
Expand All @@ -32,8 +32,8 @@ function spawnProcess(script, bench, state) {
bench.start();
}

if (state.finished === state.count) {
bench.end(state.count);
if (state.finished === state.n) {
bench.end(state.n);
}
}
}
Expand All @@ -49,18 +49,18 @@ function spawnWorker(script, bench, state) {
// Finished warmup.
bench.start();
}
if (state.finished < state.count) {
if (state.finished < state.n) {
spawnWorker(script, bench, state);
} else {
bench.end(state.count);
bench.end(state.n);
}
});
}

function main({ count, script, mode }) {
function main({ n, script, mode }) {
script = path.resolve(__dirname, '../../', `${script}.js`);
const warmup = 3;
const state = { count, finished: -warmup };
const state = { n, finished: -warmup };
if (mode === 'worker') {
Worker = require('worker_threads').Worker;
spawnWorker(script, bench, state);
Expand Down
35 changes: 32 additions & 3 deletions deps/cares/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ INCLUDE (CheckCSourceCompiles)
INCLUDE (CheckStructHasMember)
INCLUDE (CheckLibraryExists)

PROJECT (c-ares LANGUAGES C VERSION "1.32.3" )
PROJECT (c-ares LANGUAGES C VERSION "1.33.0" )

# Set this version before release
SET (CARES_VERSION "${PROJECT_VERSION}")
Expand All @@ -30,7 +30,7 @@ INCLUDE (GNUInstallDirs) # include this *AFTER* PROJECT(), otherwise paths are w
# For example, a version of 4:0:2 would generate output such as:
# libname.so -> libname.so.2
# libname.so.2 -> libname.so.2.2.0
SET (CARES_LIB_VERSIONINFO "19:3:17")
SET (CARES_LIB_VERSIONINFO "20:0:18")


OPTION (CARES_STATIC "Build as a static library" OFF)
Expand All @@ -42,6 +42,7 @@ OPTION (CARES_BUILD_CONTAINER_TESTS "Build and run container tests (implies CARE
OPTION (CARES_BUILD_TOOLS "Build tools" ON)
OPTION (CARES_SYMBOL_HIDING "Hide private symbols in shared libraries" OFF)
OPTION (CARES_THREADS "Build with thread-safety support" ON)
OPTION (CARES_COVERAGE "Build for code coverage" OFF)
SET (CARES_RANDOM_FILE "/dev/urandom" CACHE STRING "Suitable File / Device Path for entropy, such as /dev/urandom")


Expand Down Expand Up @@ -265,7 +266,7 @@ IF (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
ELSEIF (CMAKE_SYSTEM_NAME STREQUAL "Linux")
LIST (APPEND SYSFLAGS -D_GNU_SOURCE -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700)
ELSEIF (CMAKE_SYSTEM_NAME STREQUAL "SunOS")
LIST (APPEND SYSFLAGS -D__EXTENSIONS__ -D_REENTRANT -D_XOPEN_SOURCE=700)
LIST (APPEND SYSFLAGS -D__EXTENSIONS__ -D_REENTRANT -D_XOPEN_SOURCE=600)
ELSEIF (CMAKE_SYSTEM_NAME STREQUAL "AIX")
LIST (APPEND SYSFLAGS -D_ALL_SOURCE -D_XOPEN_SOURCE=700 -D_USE_IRS)
ELSEIF (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
Expand Down Expand Up @@ -409,6 +410,7 @@ CHECK_STRUCT_HAS_MEMBER("struct sockaddr_in6" sin6_scope_id "${CMAKE_EXTRA_INCLU
CHECK_SYMBOL_EXISTS (closesocket "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_CLOSESOCKET)
CHECK_SYMBOL_EXISTS (CloseSocket "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_CLOSESOCKET_CAMEL)
CHECK_SYMBOL_EXISTS (connect "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_CONNECT)
CHECK_SYMBOL_EXISTS (connectx "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_CONNECTX)
CHECK_SYMBOL_EXISTS (fcntl "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_FCNTL)
CHECK_SYMBOL_EXISTS (freeaddrinfo "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_FREEADDRINFO)
CHECK_SYMBOL_EXISTS (getaddrinfo "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_GETADDRINFO)
Expand All @@ -423,6 +425,10 @@ CHECK_SYMBOL_EXISTS (if_indextoname "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_IF_INDE
CHECK_SYMBOL_EXISTS (if_nametoindex "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_IF_NAMETOINDEX)
CHECK_SYMBOL_EXISTS (ConvertInterfaceIndexToLuid "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_CONVERTINTERFACEINDEXTOLUID)
CHECK_SYMBOL_EXISTS (ConvertInterfaceLuidToNameA "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_CONVERTINTERFACELUIDTONAMEA)
CHECK_SYMBOL_EXISTS (NotifyIpInterfaceChange "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_NOTIFYIPINTERFACECHANGE)
CHECK_SYMBOL_EXISTS (RegisterWaitForSingleObject "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_REGISTERWAITFORSINGLEOBJECT)


CHECK_SYMBOL_EXISTS (inet_net_pton "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_INET_NET_PTON)
IF (NOT WIN32)
# Disabled on Windows, because these functions are only really supported on Windows
Expand Down Expand Up @@ -682,6 +688,27 @@ IF (HAVE_ARPA_NAMESER_COMPAT_H)
SET (CARES_HAVE_ARPA_NAMESER_COMPAT_H 1)
ENDIF()


# Coverage
IF (CARES_COVERAGE)
# set compiler flags
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ftest-coverage -fprofile-arcs")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftest-coverage -fprofile-arcs")

# find required tools
FIND_PROGRAM(LCOV lcov REQUIRED)
FIND_PROGRAM(GENHTML genhtml REQUIRED)

# add coverage target
ADD_CUSTOM_TARGET(coverage
# gather data
COMMAND ${LCOV} --directory . --capture --output-file coverage.info
# generate report
COMMAND ${GENHTML} --demangle-cpp -o coverage coverage.info
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
)
ENDIF()

# TRANSFORM_MAKEFILE_INC
#
# This function consumes the "Makefile.inc" autotools file, and converts it into
Expand Down Expand Up @@ -729,6 +756,8 @@ IF (CARES_BUILD_TESTS OR CARES_BUILD_CONTAINER_TESTS)
ENDIF ()




# Export targets
IF (CARES_INSTALL)
SET (CMAKECONFIG_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}")
Expand Down
2 changes: 0 additions & 2 deletions deps/cares/LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# c-ares license

MIT License

Copyright (c) 1998 Massachusetts Institute of Technology
Expand Down
72 changes: 72 additions & 0 deletions deps/cares/Makefile.Watcom
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,19 @@ all: $(ARESBUILDH) $(OBJ_BASE) $(TARGETS) $(DEMOS) .SYMBOLIC
$(OBJ_BASE):
-$(MD) $^@
-$(MD) $^@\stat
-$(MD) $^@\stat\dsa
-$(MD) $^@\stat\event
-$(MD) $^@\stat\legacy
-$(MD) $^@\stat\record
-$(MD) $^@\stat\str
-$(MD) $^@\stat\util
-$(MD) $^@\dyn
-$(MD) $^@\dyn\dsa
-$(MD) $^@\dyn\event
-$(MD) $^@\dyn\legacy
-$(MD) $^@\dyn\record
-$(MD) $^@\dyn\str
-$(MD) $^@\dyn\util
-$(MD) $^@\tools

$(ARESBUILDH): .EXISTSONLY
Expand Down Expand Up @@ -129,7 +141,19 @@ vclean realclean: clean .SYMBOLIC
-$(RM) $(TARGETS) $(LIBNAME).map
-$(RM) $(DEMOS) $(DEMOS:.exe=.map)
-$(RD) $(OBJ_BASE)\stat
-$(RD) $(OBJ_BASE)\stat\dsa
-$(RD) $(OBJ_BASE)\stat\event
-$(RD) $(OBJ_BASE)\stat\legacy
-$(RD) $(OBJ_BASE)\stat\record
-$(RD) $(OBJ_BASE)\stat\str
-$(RD) $(OBJ_BASE)\stat\util
-$(RD) $(OBJ_BASE)\dyn
-$(RD) $(OBJ_BASE)\dyn\dsa
-$(RD) $(OBJ_BASE)\dyn\event
-$(RD) $(OBJ_BASE)\dyn\legacy
-$(RD) $(OBJ_BASE)\dyn\record
-$(RD) $(OBJ_BASE)\dyn\str
-$(RD) $(OBJ_BASE)\dyn\util
-$(RD) $(OBJ_BASE)\tools
-$(RD) $(OBJ_BASE)

Expand All @@ -144,10 +168,58 @@ $(RESOURCE): src\lib\cares.rc .AUTODEPEND
.c{$(OBJ_BASE)\dyn}.obj:
$(CC) $(CFLAGS) -bd .\src\lib\$^& -fo=$^@

.ERASE
{dsa}.c{$(OBJ_BASE)\dyn\dsa}.obj:
$(CC) $(CFLAGS) -bd .\src\lib\dsa\$^& -fo=$^@

.ERASE
{event}.c{$(OBJ_BASE)\dyn\event}.obj:
$(CC) $(CFLAGS) -bd .\src\lib\event\$^& -fo=$^@

.ERASE
{legacy}.c{$(OBJ_BASE)\dyn\legacy}.obj:
$(CC) $(CFLAGS) -bd .\src\lib\legacy\$^& -fo=$^@

.ERASE
{record}.c{$(OBJ_BASE)\dyn\record}.obj:
$(CC) $(CFLAGS) -bd .\src\lib\record\$^& -fo=$^@

.ERASE
{str}.c{$(OBJ_BASE)\dyn\str}.obj:
$(CC) $(CFLAGS) -bd .\src\lib\str\$^& -fo=$^@

.ERASE
{util}.c{$(OBJ_BASE)\dyn\util}.obj:
$(CC) $(CFLAGS) -bd .\src\lib\util\$^& -fo=$^@

.ERASE
.c{$(OBJ_BASE)\stat}.obj:
$(CC) $(CFLAGS) -DCARES_STATICLIB .\src\lib\$^& -fo=$^@

.ERASE
{dsa}.c{$(OBJ_BASE)\stat\dsa}.obj:
$(CC) $(CFLAGS) -DCARES_STATICLIB .\src\lib\dsa\$^& -fo=$^@

.ERASE
{event}.c{$(OBJ_BASE)\stat\event}.obj:
$(CC) $(CFLAGS) -DCARES_STATICLIB .\src\lib\event\$^& -fo=$^@

.ERASE
{legacy}.c{$(OBJ_BASE)\stat\legacy}.obj:
$(CC) $(CFLAGS) -DCARES_STATICLIB .\src\lib\legacy\$^& -fo=$^@

.ERASE
{record}.c{$(OBJ_BASE)\stat\record}.obj:
$(CC) $(CFLAGS) -DCARES_STATICLIB .\src\lib\record\$^& -fo=$^@

.ERASE
{str}.c{$(OBJ_BASE)\stat\str}.obj:
$(CC) $(CFLAGS) -DCARES_STATICLIB .\src\lib\str\$^& -fo=$^@

.ERASE
{util}.c{$(OBJ_BASE)\stat\util}.obj:
$(CC) $(CFLAGS) -DCARES_STATICLIB .\src\lib\util\$^& -fo=$^@

$(LINK_ARG): $(__MAKEFILES__)
%create $^@
@%append $^@ system nt dll
Expand Down
2 changes: 1 addition & 1 deletion deps/cares/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
AUTOMAKE_OPTIONS = foreign nostdinc 1.9.6
ACLOCAL_AMFLAGS = -I m4 --install

MSVCFILES = msvc_ver.inc buildconf.bat
MSVCFILES = buildconf.bat

# adig and ahost are just sample programs and thus not mentioned with the
# regular sources and headers
Expand Down
Loading

0 comments on commit 51fa7c0

Please sign in to comment.