diff --git a/Makefile b/Makefile index 81dbd9f4d19434..a76c04b4993b13 100644 --- a/Makefile +++ b/Makefile @@ -314,15 +314,6 @@ benchmark/napi/function_args/build/Release/binding.node: all \ --directory="$(shell pwd)/benchmark/napi/function_args" \ --nodedir="$(shell pwd)" -# Implicitly depends on $(NODE_EXE). We don't depend on it explicitly because -# it always triggers a rebuild due to it being a .PHONY rule. See the comment -# near the build-addons rule for more background. -test/gc/build/Release/binding.node: test/gc/binding.cc test/gc/binding.gyp - $(NODE) deps/npm/node_modules/node-gyp/bin/node-gyp rebuild \ - --python="$(PYTHON)" \ - --directory="$(shell pwd)/test/gc" \ - --nodedir="$(shell pwd)" - DOCBUILDSTAMP_PREREQS = tools/doc/addon-verify.js doc/api/addons.md ifeq ($(OSTYPE),aix) @@ -405,20 +396,12 @@ clear-stalled: echo $${PS_OUT} | xargs kill -9; \ fi -.PHONY: test-gc -test-gc: all test/gc/build/Release/binding.node - $(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) gc - -.PHONY: test-gc-clean -test-gc-clean: - $(RM) -r test/gc/build - test-build: | all build-addons build-addons-napi test-build-addons-napi: all build-addons-napi .PHONY: test-all -test-all: test-build test/gc/build/Release/binding.node ## Run everything in test/. +test-all: test-build ## Run everything in test/. $(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=debug,release test-all-valgrind: test-build @@ -1185,7 +1168,6 @@ LINT_CPP_FILES = $(filter-out $(LINT_CPP_EXCLUDE), $(wildcard \ test/cctest/*.h \ test/addons-napi/*/*.cc \ test/addons-napi/*/*.h \ - test/gc/binding.cc \ tools/icu/*.cc \ tools/icu/*.h \ )) diff --git a/test/README.md b/test/README.md index 302db9d0bb8ad7..df95cedb340b3b 100644 --- a/test/README.md +++ b/test/README.md @@ -21,7 +21,6 @@ GitHub with the `autocrlf` git config flag set to true. |common | |Common modules shared among many tests. [Documentation](./common/README.md)| |es-module |Yes |Test ESM module loading.| |fixtures | |Test fixtures used in various tests throughout the test suite.| -|gc |No |Tests for garbage collection related functionality.| |internet |No |Tests that make real outbound connections (mainly networking related modules). Tests for networking related modules may also be present in other directories, but those tests do not make outbound connections.| |known_issues |Yes |Tests reproducing known issues within the system. All tests inside of this directory are expected to fail consistently. If a test doesn't fail on certain platforms, those should be skipped via `known_issues.status`.| |message |Yes |Tests for messages that are output for various conditions (```console.log```, error messages etc.)| diff --git a/test/gc/.gitignore b/test/gc/.gitignore deleted file mode 100644 index 567609b1234a9b..00000000000000 --- a/test/gc/.gitignore +++ /dev/null @@ -1 +0,0 @@ -build/ diff --git a/test/gc/binding.cc b/test/gc/binding.cc deleted file mode 100644 index 8bde3b8505cf37..00000000000000 --- a/test/gc/binding.cc +++ /dev/null @@ -1,80 +0,0 @@ -#include "node.h" -#include "uv.h" - -#include -#include - -#include - -#ifdef NDEBUG -#define CHECK(x) do { if (!(x)) abort(); } while (false) -#else -#define CHECK assert -#endif - -#define CHECK_EQ(a, b) CHECK((a) == (b)) - -namespace { - -struct Callback { - inline Callback(v8::Isolate* isolate, - v8::Local object, - v8::Local function) - : object(isolate, object), function(isolate, function) {} - - v8::Persistent object; - v8::Persistent function; -}; - -static uv_async_t async_handle; -static std::vector callbacks; - -inline void Prime() { - uv_ref(reinterpret_cast(&async_handle)); - CHECK_EQ(0, uv_async_send(&async_handle)); -} - -inline void AsyncCallback(uv_async_t*) { - auto isolate = v8::Isolate::GetCurrent(); - v8::HandleScope handle_scope(isolate); - auto context = isolate->GetCurrentContext(); - auto global = context->Global(); - while (!callbacks.empty()) { - v8::HandleScope handle_scope(isolate); - auto callback = callbacks.back(); - callbacks.pop_back(); - auto function = v8::Local::New(isolate, callback->function); - delete callback; - if (node::MakeCallback(isolate, global, function, 0, nullptr).IsEmpty()) - return Prime(); // Have exception, flush remainder on next loop tick. - } - uv_unref(reinterpret_cast(&async_handle)); -} - -inline void OnGC(const v8::FunctionCallbackInfo& info) { - CHECK(info[0]->IsObject()); - CHECK(info[1]->IsFunction()); - auto object = info[0].As(); - auto function = info[1].As(); - auto callback = new Callback(info.GetIsolate(), object, function); - auto on_callback = [] (const v8::WeakCallbackInfo& data) { - auto callback = data.GetParameter(); - callbacks.push_back(callback); - callback->object.Reset(); - Prime(); - }; - callback->object.SetWeak(callback, on_callback, - v8::WeakCallbackType::kParameter); -} - -inline void Initialize(v8::Local exports, - v8::Local module, - v8::Local context) { - NODE_SET_METHOD(module->ToObject(context).ToLocalChecked(), "exports", OnGC); - CHECK_EQ(0, uv_async_init(uv_default_loop(), &async_handle, AsyncCallback)); - uv_unref(reinterpret_cast(&async_handle)); -} - -} // anonymous namespace - -NODE_MODULE_CONTEXT_AWARE(NODE_GYP_MODULE_NAME, Initialize) diff --git a/test/gc/binding.gyp b/test/gc/binding.gyp deleted file mode 100644 index dc89633601723f..00000000000000 --- a/test/gc/binding.gyp +++ /dev/null @@ -1,9 +0,0 @@ -{ - 'targets': [ - { - 'target_name': 'binding', - 'defines': [ 'V8_DEPRECATION_WARNINGS=1' ], - 'sources': [ 'binding.cc' ], - }, - ], -} diff --git a/test/gc/testcfg.py b/test/gc/testcfg.py deleted file mode 100644 index d6bbcd60fff199..00000000000000 --- a/test/gc/testcfg.py +++ /dev/null @@ -1,6 +0,0 @@ -import sys, os -sys.path.append(os.path.join(os.path.dirname(__file__), '..')) -import testpy - -def GetConfiguration(context, root): - return testpy.SimpleTestConfiguration(context, root, 'gc', ['--expose-gc']) diff --git a/test/gc/test-http-client-connaborted.js b/test/parallel/test-gc-http-client-connaborted.js similarity index 86% rename from test/gc/test-http-client-connaborted.js rename to test/parallel/test-gc-http-client-connaborted.js index 008d75bca5d0b1..3218c054ed4a2a 100644 --- a/test/gc/test-http-client-connaborted.js +++ b/test/parallel/test-gc-http-client-connaborted.js @@ -1,5 +1,6 @@ 'use strict'; -// just like test/gc/http-client.js, +// Flags: --expose-gc +// just like test-gc-http-client.js, // but aborting every connection that comes in. const common = require('../common'); @@ -9,7 +10,6 @@ function serverHandler(req, res) { } const http = require('http'); -const weak = require(`./build/${common.buildType}/binding`); const todo = 500; let done = 0; let count = 0; @@ -36,7 +36,7 @@ function getall() { }, cb).on('error', cb); count++; - weak(req, afterGC); + common.onGC(req, { ongc }); })(); setImmediate(getall); @@ -45,7 +45,7 @@ function getall() { for (let i = 0; i < 10; i++) getall(); -function afterGC() { +function ongc() { countGC++; } diff --git a/test/gc/test-http-client-onerror.js b/test/parallel/test-gc-http-client-onerror.js similarity index 88% rename from test/gc/test-http-client-onerror.js rename to test/parallel/test-gc-http-client-onerror.js index 8b05e941749c63..8842da93c30dcf 100644 --- a/test/gc/test-http-client-onerror.js +++ b/test/parallel/test-gc-http-client-onerror.js @@ -1,5 +1,6 @@ 'use strict'; -// just like test/gc/http-client.js, +// Flags: --expose-gc +// just like test-gc-http-client.js, // but with an on('error') handler that does nothing. const common = require('../common'); @@ -11,7 +12,6 @@ function serverHandler(req, res) { } const http = require('http'); -const weak = require(`./build/${common.buildType}/binding`); const todo = 500; let done = 0; let count = 0; @@ -42,7 +42,7 @@ function getall() { }, cb).on('error', onerror); count++; - weak(req, afterGC); + common.onGC(req, { ongc }); })(); setImmediate(getall); @@ -53,7 +53,7 @@ function runTest() { getall(); } -function afterGC() { +function ongc() { countGC++; } diff --git a/test/gc/test-http-client-timeout.js b/test/parallel/test-gc-http-client-timeout.js similarity index 88% rename from test/gc/test-http-client-timeout.js rename to test/parallel/test-gc-http-client-timeout.js index c396a89032bf0e..e6878021ef9b89 100644 --- a/test/gc/test-http-client-timeout.js +++ b/test/parallel/test-gc-http-client-timeout.js @@ -1,5 +1,6 @@ 'use strict'; -// just like test/gc/http-client.js, +// Flags: --expose-gc +// just like test-gc-http-client.js, // but with a timeout set const common = require('../common'); @@ -13,7 +14,6 @@ function serverHandler(req, res) { } const http = require('http'); -const weak = require(`./build/${common.buildType}/binding`); const todo = 550; let done = 0; let count = 0; @@ -45,7 +45,7 @@ function getall() { }); count++; - weak(req, afterGC); + common.onGC(req, { ongc }); })(); setImmediate(getall); @@ -54,7 +54,7 @@ function getall() { for (let i = 0; i < 10; i++) getall(); -function afterGC() { +function ongc() { countGC++; } diff --git a/test/gc/test-http-client.js b/test/parallel/test-gc-http-client.js similarity index 90% rename from test/gc/test-http-client.js rename to test/parallel/test-gc-http-client.js index 8b50ad5ea4ffce..d31874fa1666c7 100644 --- a/test/gc/test-http-client.js +++ b/test/parallel/test-gc-http-client.js @@ -1,4 +1,5 @@ 'use strict'; +// Flags: --expose-gc // just a simple http server and client. const common = require('../common'); @@ -9,7 +10,6 @@ function serverHandler(req, res) { } const http = require('http'); -const weak = require(`./build/${common.buildType}/binding`); const todo = 500; let done = 0; let count = 0; @@ -40,7 +40,7 @@ function getall() { }, cb); count++; - weak(req, afterGC); + common.onGC(req, { ongc }); })(); setImmediate(getall); @@ -49,7 +49,7 @@ function getall() { for (let i = 0; i < 10; i++) getall(); -function afterGC() { +function ongc() { countGC++; } diff --git a/test/gc/test-net-timeout.js b/test/parallel/test-gc-net-timeout.js similarity index 88% rename from test/gc/test-net-timeout.js rename to test/parallel/test-gc-net-timeout.js index 05d854d18ee7fe..236980efa3d682 100644 --- a/test/gc/test-net-timeout.js +++ b/test/parallel/test-gc-net-timeout.js @@ -1,5 +1,6 @@ 'use strict'; -// just like test/gc/http-client-timeout.js, +// Flags: --expose-gc +// just like test-gc-http-client-timeout.js, // but using a net server/client instead const common = require('../common'); @@ -19,7 +20,6 @@ function serverHandler(sock) { } const net = require('net'); -const weak = require(`./build/${common.buildType}/binding`); const assert = require('assert'); const todo = 500; let done = 0; @@ -44,7 +44,7 @@ function getall() { }); count++; - weak(req, afterGC); + common.onGC(req, { ongc }); setImmediate(getall); } @@ -52,7 +52,7 @@ function getall() { for (let i = 0; i < 10; i++) getall(); -function afterGC() { +function ongc() { countGC++; } diff --git a/tools/test.py b/tools/test.py index 9a0a48043b8b2b..6e96e22192102f 100755 --- a/tools/test.py +++ b/tools/test.py @@ -1538,7 +1538,6 @@ def PrintCrashed(code): 'addons-napi', 'code-cache', 'doctool', - 'gc', 'internet', 'pummel', 'test-known-issues', diff --git a/vcbuild.bat b/vcbuild.bat index 9beb4160c70e3f..bf38ed624f6281 100644 --- a/vcbuild.bat +++ b/vcbuild.bat @@ -33,7 +33,6 @@ set lint_js= set lint_cpp= set lint_md= set lint_md_build= -set build_testgc_addon= set noetw= set noetw_msi_arg= set noperfctr= @@ -88,13 +87,12 @@ if /i "%1"=="test-addons" set test_args=%test_args% addons&set build_addons=1& if /i "%1"=="test-addons-napi" set test_args=%test_args% addons-napi&set build_addons_napi=1&goto arg-ok if /i "%1"=="test-simple" set test_args=%test_args% sequential parallel -J&goto arg-ok if /i "%1"=="test-message" set test_args=%test_args% message&goto arg-ok -if /i "%1"=="test-gc" set test_args=%test_args% gc&set build_testgc_addon=1&goto arg-ok if /i "%1"=="test-tick-processor" set test_args=%test_args% tick-processor&goto arg-ok if /i "%1"=="test-internet" set test_args=%test_args% internet&goto arg-ok if /i "%1"=="test-pummel" set test_args=%test_args% pummel&goto arg-ok if /i "%1"=="test-known-issues" set test_args=%test_args% known_issues&goto arg-ok if /i "%1"=="test-async-hooks" set test_args=%test_args% async-hooks&goto arg-ok -if /i "%1"=="test-all" set test_args=%test_args% gc internet pummel %common_test_suites%&set build_testgc_addon=1&set lint_cpp=1&set lint_js=1&goto arg-ok +if /i "%1"=="test-all" set test_args=%test_args% gc internet pummel %common_test_suites%&set lint_cpp=1&set lint_js=1&goto arg-ok if /i "%1"=="test-node-inspect" set test_node_inspect=1&goto arg-ok if /i "%1"=="test-check-deopts" set test_check_deopts=1&goto arg-ok if /i "%1"=="test-npm" set test_npm=1&goto arg-ok @@ -468,17 +466,6 @@ for %%F in (%config%\doc\api\*.md) do ( :run @rem Run tests if requested. -@rem Build test/gc add-on if required. -if "%build_testgc_addon%"=="" goto build-addons -%node_gyp_exe% rebuild --directory="%~dp0test\gc" --nodedir="%~dp0." -if errorlevel 1 goto build-testgc-addon-failed -goto build-addons - -:build-testgc-addon-failed -echo Failed to build test/gc add-on." -goto exit - -:build-addons if not defined build_addons goto build-addons-napi if not exist "%node_exe%" ( echo Failed to find node.exe @@ -561,7 +548,7 @@ goto lint-cpp :lint-cpp if not defined lint_cpp goto lint-js -call :run-lint-cpp src\*.c src\*.cc src\*.h test\addons\*.cc test\addons\*.h test\addons-napi\*.cc test\addons-napi\*.h test\cctest\*.cc test\cctest\*.h test\gc\binding.cc tools\icu\*.cc tools\icu\*.h +call :run-lint-cpp src\*.c src\*.cc src\*.h test\addons\*.cc test\addons\*.h test\addons-napi\*.cc test\addons-napi\*.h test\cctest\*.cc test\cctest\*.h tools\icu\*.cc tools\icu\*.h python tools/check-imports.py goto lint-js @@ -673,7 +660,7 @@ del .used_configure_flags goto exit :help -echo vcbuild.bat [debug/release] [msi] [doc] [test/test-ci/test-all/test-addons/test-addons-napi/test-internet/test-pummel/test-simple/test-message/test-gc/test-tick-processor/test-known-issues/test-node-inspect/test-check-deopts/test-npm/test-async-hooks/test-v8/test-v8-intl/test-v8-benchmarks/test-v8-all] [ignore-flaky] [static/dll] [noprojgen] [projgen] [small-icu/full-icu/without-intl] [nobuild] [nosnapshot] [noetw] [noperfctr] [ltcg] [nopch] [licensetf] [sign] [ia32/x86/x64] [vs2017] [download-all] [enable-vtune] [lint/lint-ci/lint-js/lint-js-ci/lint-md] [lint-md-build] [package] [build-release] [upload] [no-NODE-OPTIONS] [link-module path-to-module] [debug-http2] [debug-nghttp2] [clean] [no-cctest] [openssl-no-asm] +echo vcbuild.bat [debug/release] [msi] [doc] [test/test-ci/test-all/test-addons/test-addons-napi/test-internet/test-pummel/test-simple/test-message/test-tick-processor/test-known-issues/test-node-inspect/test-check-deopts/test-npm/test-async-hooks/test-v8/test-v8-intl/test-v8-benchmarks/test-v8-all] [ignore-flaky] [static/dll] [noprojgen] [projgen] [small-icu/full-icu/without-intl] [nobuild] [nosnapshot] [noetw] [noperfctr] [ltcg] [nopch] [licensetf] [sign] [ia32/x86/x64] [vs2017] [download-all] [enable-vtune] [lint/lint-ci/lint-js/lint-js-ci/lint-md] [lint-md-build] [package] [build-release] [upload] [no-NODE-OPTIONS] [link-module path-to-module] [debug-http2] [debug-nghttp2] [clean] [no-cctest] [openssl-no-asm] echo Examples: echo vcbuild.bat : builds release build echo vcbuild.bat debug : builds debug build