test: Make N-API weak-ref GC tests asynchronous#13121
Conversation
There was a problem hiding this comment.
Would it be better to make it an array of objects instead of doing the string check for the title ?
ex
{ title: 'External value without a finalizer', steps: [() => {...}, () => {...}, etc ]}
There was a problem hiding this comment.
That would work too, but would be more complicated to do the nested iteration recursively. I didn't see a need to over-design this just for these few tests. I can do it if you want. :)
There was a problem hiding this comment.
I was thinking it would actually be easier/less code, but if you don't think that's the case I don't want to hold up getting this landed. I may take a look/PR later on when I have time if what I was thinking can simply, if not then I'll leave it be.
- Make GC tests (arraybuffer, buffer) async, to account for different GC behavior with different versions of V8 and ChakraCore, similar to nodejs/node#13121 - In test/index.js, use the --napi-modules and --expose-gc command-line flags automatically
- Make GC tests (arraybuffer, buffer, external) async, to account for different GC behavior with different versions of V8 and ChakraCore, similar to nodejs/node#13121 - In test/index.js, use the --napi-modules and --expose-gc command-line flags automatically
- Make GC tests (arraybuffer, buffer, external) async, to account for different GC behavior with different versions of V8 and ChakraCore, similar to nodejs/node#13121 - In test/index.js, use the --napi-modules and --expose-gc command-line flags automatically. - Add missing entry for object tests in index.js. - Remove check for writable attribute on accessor property descriptors; it should not be there according to the JS spec. - Remove the explicit dependency on node-gyp in package.json. (NPM carries its own copy of node-gyp.)
There was a problem hiding this comment.
Couldn't you replace the try...catch, throw, and console.error() call with a call to assert.doesNotThrow()?
There was a problem hiding this comment.
That could work, except assert.doesNotThrow() loses the stack trace of the original exception; it only displays the message. So I prefer not to use it except when checking for a very specific exceptional condition. In this case, the original exception stack trace is likely to point to a line number of another assertion in the file, so that's very helpful information.
- Make GC tests (arraybuffer, buffer, external) async, to account for different GC behavior with different versions of V8 and ChakraCore, similar to nodejs/node#13121 - In test/index.js, use the --napi-modules and --expose-gc command-line flags automatically. - Add missing entry for object tests in index.js. - Remove check for writable attribute on accessor property descriptors; it should not be there according to the JS spec. - Remove the explicit dependency on node-gyp in package.json. (NPM carries its own copy of node-gyp.)
- Make GC tests (arraybuffer, buffer, external) async, to account for different GC behavior with different versions of V8 and ChakraCore, similar to nodejs/node#13121 - In test/index.js, use the --napi-modules and --expose-gc command-line flags automatically. - Add missing entry for object tests in index.js. - Remove check for writable attribute on accessor property descriptors; it should not be there according to the JS spec. - Remove the explicit dependency on node-gyp in package.json. (NPM carries its own copy of node-gyp.) - Fix improper rethrow of an Error caught by reference that caused a double napi_ref delete, which failed in release builds of Node-ChakraCore.
One of the N-API weak-reference test cases already had to be made asynchronous to handle different behavior in a newer V8 version: nodejs#12864 When porting N-API to Node-ChakraCore, we found more of the test cases needed similar treatment: nodejs/node-chakracore#246 So to make thes tests more robust (and avoid having differences in the test code for Node-ChakraCore), I am refactoring the tests in this file to insert a `setImmedate()` callback before every call to `gc()` and assertions about the effects of the GC. PR-URL: nodejs#13121 Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
6334a1b to
bb91879
Compare
|
Landed as bb91879 |
One of the N-API weak-reference test cases already had to be made asynchronous to handle different behavior in a newer V8 version: #12864 When porting N-API to Node-ChakraCore, we found more of the test cases needed similar treatment: nodejs/node-chakracore#246 So to make thes tests more robust (and avoid having differences in the test code for Node-ChakraCore), I am refactoring the tests in this file to insert a `setImmedate()` callback before every call to `gc()` and assertions about the effects of the GC. PR-URL: #13121 Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Fixed by upstream PR nodejs/node#13121 Resolves nodejs#246
Fixed by upstream PR nodejs/node#13121 Resolves nodejs#246 PR-URL: nodejs#301 Reviewed-By: Kunal Pathak <kunal.pathak@microsoft.com> Reviewed-By: Jason Ginchereau <jasongin@microsoft.com>
Fixed by upstream PR nodejs/node#13121 Resolves nodejs#246 PR-URL: nodejs#301 Reviewed-By: Kunal Pathak <kunal.pathak@microsoft.com> Reviewed-By: Jason Ginchereau <jasongin@microsoft.com>
One of the N-API weak-reference test cases already had to be made asynchronous to handle different behavior in a newer V8 version: nodejs#12864 When porting N-API to Node-ChakraCore, we found more of the test cases needed similar treatment: nodejs/node-chakracore#246 So to make thes tests more robust (and avoid having differences in the test code for Node-ChakraCore), I am refactoring the tests in this file to insert a `setImmedate()` callback before every call to `gc()` and assertions about the effects of the GC. PR-URL: nodejs#13121 Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
One of the N-API weak-reference test cases already had to be made asynchronous to handle different behavior in a newer V8 version: #12864 When porting N-API to Node-ChakraCore, we found more of the test cases needed similar treatment: nodejs/node-chakracore#246 So to make thes tests more robust (and avoid having differences in the test code for Node-ChakraCore), I am refactoring the tests in this file to insert a `setImmedate()` callback before every call to `gc()` and assertions about the effects of the GC. Backport-PR-URL: #19447 PR-URL: #13121 Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
- Make GC tests (arraybuffer, buffer, external) async, to account for different GC behavior with different versions of V8 and ChakraCore, similar to nodejs/node#13121 - In test/index.js, use the --napi-modules and --expose-gc command-line flags automatically. - Add missing entry for object tests in index.js. - Remove check for writable attribute on accessor property descriptors; it should not be there according to the JS spec. - Remove the explicit dependency on node-gyp in package.json. (NPM carries its own copy of node-gyp.) - Fix improper rethrow of an Error caught by reference that caused a double napi_ref delete, which failed in release builds of Node-ChakraCore.
- Make GC tests (arraybuffer, buffer, external) async, to account for different GC behavior with different versions of V8 and ChakraCore, similar to nodejs/node#13121 - In test/index.js, use the --napi-modules and --expose-gc command-line flags automatically. - Add missing entry for object tests in index.js. - Remove check for writable attribute on accessor property descriptors; it should not be there according to the JS spec. - Remove the explicit dependency on node-gyp in package.json. (NPM carries its own copy of node-gyp.) - Fix improper rethrow of an Error caught by reference that caused a double napi_ref delete, which failed in release builds of Node-ChakraCore.
- Make GC tests (arraybuffer, buffer, external) async, to account for different GC behavior with different versions of V8 and ChakraCore, similar to nodejs/node#13121 - In test/index.js, use the --napi-modules and --expose-gc command-line flags automatically. - Add missing entry for object tests in index.js. - Remove check for writable attribute on accessor property descriptors; it should not be there according to the JS spec. - Remove the explicit dependency on node-gyp in package.json. (NPM carries its own copy of node-gyp.) - Fix improper rethrow of an Error caught by reference that caused a double napi_ref delete, which failed in release builds of Node-ChakraCore.
- Make GC tests (arraybuffer, buffer, external) async, to account for different GC behavior with different versions of V8 and ChakraCore, similar to nodejs/node#13121 - In test/index.js, use the --napi-modules and --expose-gc command-line flags automatically. - Add missing entry for object tests in index.js. - Remove check for writable attribute on accessor property descriptors; it should not be there according to the JS spec. - Remove the explicit dependency on node-gyp in package.json. (NPM carries its own copy of node-gyp.) - Fix improper rethrow of an Error caught by reference that caused a double napi_ref delete, which failed in release builds of Node-ChakraCore.
One of the N-API weak-reference test cases already had to be made asynchronous to handle different behavior in a newer V8 version. (0a734fe) When porting N-API to Node-ChakraCore, we found more of the test cases needed similar treatment. (nodejs/node-chakracore#246) So to make thes tests more robust (and avoid having differences in the test code for Node-ChakraCore), I am refactoring the tests in this file to insert a
setImmedate()callback before every call togc()and assertions about the effects of the GC.Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)
test