Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: make cctest fixture use node::NewIsolate #21419

Closed
wants to merge 2 commits into from

Conversation

danbev
Copy link
Contributor

@danbev danbev commented Jun 20, 2018

This commit updates the gtest fixture to use node::NewIsolate instead of
creating a new V8 Isolate using v8::Isolate::New.

The motivation for this is that without calling node::NewIsolate the
various callbacks set on the isolate, for example AddMessageListener,
SetFatalErrorHandler etc, would not get set. I don't think this is the
expected behaviour and I ran into this when writing a new cctest.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

@nodejs-github-bot nodejs-github-bot added the test Issues and PRs related to the tests. label Jun 20, 2018
@danbev
Copy link
Contributor Author

danbev commented Jun 20, 2018

@danbev
Copy link
Contributor Author

danbev commented Jun 20, 2018

node-test-commit-aix failure looks unrelated

console output:

03:24:59 Node.js major version: -1
03:24:59 Node.js version: null
03:24:59 Running nodes
03:24:59 Triggering node-test-commit-aix » aix61-ppc64
03:55:03 Completed node-test-commit-aix » aix61-ppc64 FAILURE
03:55:03 All downstream projects complete!
03:55:03 Notifying upstream projects of job completion
03:55:03 Finished: FAILURE

@@ -85,7 +86,9 @@ class NodeTestFixture : public ::testing::Test {
}

virtual void SetUp() {
isolate_ = v8::Isolate::New(params);
allocator.reset(node::CreateArrayBufferAllocator());
allocator.get_deleter() = &node::FreeArrayBufferAllocator;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks mildly questionable. Why not e.g.:

allocator = ArrayBufferUniquePtr(node::CreateArrayBufferAllocator(), &node::FreeArrayBufferAllocator);

(Might need a std::move().)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used reset mainly to follow the pattern of the other unique_ptr's in that file but this would be much cleaner. I'll update shortly. Thanks

@danbev
Copy link
Contributor Author

danbev commented Jun 25, 2018

This commit updates the gtest fixture to use node::NewIsolate instead of
creating a new V8 Isolate using v8::Isolate::New.

The motivation for this is that without calling node::NewIsolate the
various callbacks set on the isolate, for example AddMessageListener,
SetFatalErrorHandler etc, would not get set. I don't think this is the
expected behaviour and I ran into this when writing a new cctest.
@danbev danbev force-pushed the cctest-fixture-newisolate branch from 934e969 to 1edab2d Compare June 26, 2018 06:17
@danbev
Copy link
Contributor Author

danbev commented Jun 26, 2018

@danbev
Copy link
Contributor Author

danbev commented Jun 27, 2018

Landed in d6f7a32, and 8326bea.

@danbev danbev closed this Jun 27, 2018
@danbev danbev deleted the cctest-fixture-newisolate branch June 27, 2018 03:28
danbev added a commit that referenced this pull request Jun 27, 2018
This commit updates the gtest fixture to use node::NewIsolate instead of
creating a new V8 Isolate using v8::Isolate::New.

The motivation for this is that without calling node::NewIsolate the
various callbacks set on the isolate, for example AddMessageListener,
SetFatalErrorHandler etc, would not get set. I don't think this is the
expected behaviour and I ran into this when writing a new cctest.

PR-URL: #21419
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
danbev added a commit that referenced this pull request Jun 27, 2018
PR-URL: #21419
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
targos pushed a commit that referenced this pull request Jun 28, 2018
This commit updates the gtest fixture to use node::NewIsolate instead of
creating a new V8 Isolate using v8::Isolate::New.

The motivation for this is that without calling node::NewIsolate the
various callbacks set on the isolate, for example AddMessageListener,
SetFatalErrorHandler etc, would not get set. I don't think this is the
expected behaviour and I ran into this when writing a new cctest.

PR-URL: #21419
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
targos pushed a commit that referenced this pull request Jun 28, 2018
PR-URL: #21419
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
@targos targos mentioned this pull request Jul 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants