test,doc: enable running embedtest for Windows

PR-URL: https://github.com/nodejs/node/pull/52646
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
Vladimir Morozov 2024-05-23 11:33:40 -07:00 committed by GitHub
parent c137d6eb31
commit 98a1ecfc7b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 14 additions and 7 deletions

View File

@ -90,7 +90,7 @@ to as `node::Environment`. Each `node::Environment` is associated with:
* A number of `v8::Context`s, but exactly one main `v8::Context`.
* One `node::IsolateData` instance that contains information that could be
shared by multiple `node::Environment`s that use the same `v8::Isolate`.
Currently, no testing if performed for this scenario.
Currently, no testing is performed for this scenario.
In order to set up a `v8::Isolate`, an `v8::ArrayBuffer::Allocator` needs
to be provided. One possible choice is the default Node.js allocator, which

View File

@ -1248,6 +1248,7 @@
'include_dirs': [
'src',
'tools',
'tools/msvs/genfiles',
'deps/v8/include',
'deps/cares/include',

View File

@ -1,9 +1,9 @@
#ifdef NDEBUG
#undef NDEBUG
#endif
#include "node.h"
#include "uv.h"
#include <assert.h>
#include "executable_wrapper.h"
#include "node.h"
#include <algorithm>
@ -27,8 +27,10 @@ static int RunNodeInstance(MultiIsolatePlatform* platform,
const std::vector<std::string>& args,
const std::vector<std::string>& exec_args);
int main(int argc, char** argv) {
argv = uv_setup_args(argc, argv);
NODE_MAIN(int argc, node::argv_type raw_argv[]) {
char** argv = nullptr;
node::FixupMain(argc, raw_argv, &argv);
std::vector<std::string> args(argv, argv + argc);
std::shared_ptr<node::InitializationResult> result =
node::InitializeOncePerProcess(
@ -106,7 +108,7 @@ int RunNodeInstance(MultiIsolatePlatform* platform,
}
if (!snapshot_blob_path.empty() && !is_building_snapshot) {
FILE* fp = fopen(snapshot_blob_path.c_str(), "r");
FILE* fp = fopen(snapshot_blob_path.c_str(), "rb");
assert(fp != nullptr);
if (snapshot_as_file) {
snapshot = node::EmbedderSnapshotData::FromFile(fp);
@ -204,7 +206,7 @@ int RunNodeInstance(MultiIsolatePlatform* platform,
snapshot = setup->CreateSnapshot();
assert(snapshot);
FILE* fp = fopen(snapshot_blob_path.c_str(), "w");
FILE* fp = fopen(snapshot_blob_path.c_str(), "wb");
assert(fp != nullptr);
if (snapshot_as_file) {
snapshot->ToFile(fp);

View File

@ -333,6 +333,7 @@ if "%target%"=="Build" (
if defined cctest set target="Build"
)
if "%target%"=="node" if exist "%config%\cctest.exe" del "%config%\cctest.exe"
if "%target%"=="node" if exist "%config%\embedtest.exe" del "%config%\embedtest.exe"
if defined msbuild_args set "extra_msbuild_args=%extra_msbuild_args% %msbuild_args%"
@rem Setup env variables to use multiprocessor build
set UseMultiToolTask=True
@ -675,6 +676,9 @@ if not exist "%config%\cctest.exe" echo cctest.exe not found. Run "vcbuild test"
echo running 'cctest %cctest_args%'
"%config%\cctest" %cctest_args%
if %errorlevel% neq 0 set exit_code=%errorlevel%
echo running '%node_exe% test\embedding\test-embedding.js'
"%node_exe%" test\embedding\test-embedding.js
if %errorlevel% neq 0 set exit_code=%errorlevel%
:run-test-py
echo running 'python tools\test.py %test_args%'
python tools\test.py %test_args%