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

node-api: refactor to cctest v8impl::Reference #38970

Closed
wants to merge 3 commits into from

Conversation

@legendecas
Copy link
Member

@legendecas legendecas commented Jun 8, 2021

Refactor node_api.cc and js_native_api_v8.cc to expose internal representatives with node_api_internals.h and js_native_api_v8.h respectively. In that way we can test internal codebase with cctest and verify hard-to-reproduce code paths.

With the new test suite, we can verify crashes fixed by #38899 in a stable way (i.e. the test crash every time without #38899)

/cc @nodejs/node-api

@legendecas legendecas requested review from gabrielschulhof and mhdawson Jun 8, 2021
@legendecas legendecas force-pushed the legendecas:node-api/internal-test branch from e339fce to 72528c7 Jun 8, 2021
@legendecas legendecas marked this pull request as ready for review Jun 8, 2021
@legendecas legendecas force-pushed the legendecas:node-api/internal-test branch 2 times, most recently from 95b92e8 to 2e97174 Jun 8, 2021
@legendecas legendecas force-pushed the legendecas:node-api/internal-test branch from bbf5e1f to d6054a3 Jun 8, 2021
@@ -3,6 +3,7 @@

// This file needs to be compatible with C compilers.
#include <string.h> // NOLINT(modernize-deprecated-headers)
#include "gtest/gtest_prod.h"

This comment has been minimized.

@mhdawson

mhdawson Jun 11, 2021
Member

In Node-api meeting @gabrielschulhof suggested this should be in "js_native_api_v8_internals.h" instead.

@mhdawson
Copy link
Member

@mhdawson mhdawson commented Jun 16, 2021

@legendecas I think we should leave the LICENCE file in src/gtest/LICENSE in addition to the reference you added. That seems consistent with the copy in test/cctest/gtest.

Copy link
Member

@mhdawson mhdawson left a comment

LGTM

@nodejs-github-bot
Copy link

@nodejs-github-bot nodejs-github-bot commented Jun 17, 2021

CI: https://ci.nodejs.org/job/node-test-pull-request/38663/

00:07:31 not ok 714 parallel/test-worker-cleanexit-with-moduleload
00:07:31 ---
00:07:31 duration_ms: 5.795
00:07:31 severity: crashed
00:07:31 exitcode: -11
00:07:31 stack: |-

@legendecas
Copy link
Member Author

@legendecas legendecas commented Jun 17, 2021

So it seems like the label bot is not working...

@legendecas
Copy link
Member Author

@legendecas legendecas commented Jun 23, 2021

@gabrielschulhof hey👋 , it will be great if you can take a look at this. thanks!

Copy link
Contributor

@gabrielschulhof gabrielschulhof left a comment

LGTM, but did you check that this crashes when the fixes we made earlier are absent?

@legendecas
Copy link
Member Author

@legendecas legendecas commented Jul 5, 2021

@gabrielschulhof yeah, I did run the test against the build without the fix patch it does crash every time.

@legendecas
Copy link
Member Author

@legendecas legendecas commented Jul 5, 2021

Landed in 392213a

@legendecas legendecas closed this Jul 5, 2021
@legendecas legendecas deleted the legendecas:node-api/internal-test branch Jul 5, 2021
legendecas added a commit that referenced this pull request Jul 5, 2021
PR-URL: #38970
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Gabriel Schulhof <gabrielschulhof@gmail.com>
ejose19 added a commit to ejose19/node that referenced this pull request Jul 5, 2021
PR-URL: nodejs#38970
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Gabriel Schulhof <gabrielschulhof@gmail.com>
targos added a commit that referenced this pull request Jul 11, 2021
PR-URL: #38970
Reviewed-By: Michael Dawson <midawson@redhat.com>
Reviewed-By: Gabriel Schulhof <gabrielschulhof@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants