-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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: spawn new processes in vm-cached-data #6280
test: spawn new processes in vm-cached-data #6280
Conversation
V8 may start caching scripts from the first run soon. Preventively execute scripts in another process to ensure no test failures due to an update in the future. See: nodejs#6258
57da6a7
to
7c07bd8
Compare
cc @jeisinger |
cool, LGTM |
assert(!script.cachedDataProduced || script.cachedData instanceof Buffer); | ||
|
||
if (script.cachedDataProduced) | ||
script.cachedData.toString('base64'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The return value isn't used. I think you intended to console.log
or process.stdout.write
it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is JS, the last statement will be printed when using -p
argv.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, very subtle. I guess it's not wrong but it's not very obviously correct, either. I'd use -e
and explicitly print it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ack, I agree.
LGTM but with a strong suggestion to change the test. |
|
||
return script.cachedData; | ||
return new Buffer(out.stdout.toString(), 'base64'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Buffer.from(out.stdout.toString(), 'base64')
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ack.
LGTM with a nit if CI is green |
|
||
let data; | ||
for (var i = 0; i < ${count}; i++) { | ||
var script = new vm.Script(process.argv[1], { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just for my understanding, process.argv[1] === undefined
here, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not, see source
on line 32.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$ node -e 'console.log(process.argv[1])' hello
hello
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bet you didn't know about this 😉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I missed the third argument. Never mind.
Landed in e1cf634, thank you everyone! |
V8 may start caching scripts from the first run soon. Preventively execute scripts in another process to ensure no test failures due to an update in the future. See: #6258 PR-URL: #6280 Reviewed-By: Jochen Eisinger <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: James M Snell <[email protected]>
Marking it don't land in v4 simply because the future update to v8 does not apply |
marking dont-land-on-v5.x for the same reason. edit: if we want to backport we can use the commit above. I'll likely delete that branch in the next week if we do not opt for landing it |
V8 may cache compiled scripts, and it is not safe to assume that the V8 flags can be changed after an isolate has been created. In this particular case, since we are using the same script multiple times, the test would fail if V8 cached the result of the compilation. Ref: nodejs#6280 Fixes: nodejs#6258
V8 may cache compiled scripts, and it is not safe to assume that the V8 flags can be changed after an isolate has been created. In this particular case, since we are using the same script multiple times, the test would fail if V8 cached the result of the compilation. Ref: #6280 Fixes: #6258 PR-URL: #6316 Reviewed-By: bnoordhuis - Ben Noordhuis <[email protected]> Reviewed-By: targos - Michaël Zasso <[email protected]> Reviewed-By: cjihrig - Colin Ihrig <[email protected]>
V8 may start caching scripts from the first run soon. Preventively execute scripts in another process to ensure no test failures due to an update in the future. See: nodejs#6258 PR-URL: nodejs#6280 Reviewed-By: Jochen Eisinger <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: James M Snell <[email protected]>
V8 may cache compiled scripts, and it is not safe to assume that the V8 flags can be changed after an isolate has been created. In this particular case, since we are using the same script multiple times, the test would fail if V8 cached the result of the compilation. Ref: nodejs#6280 Fixes: nodejs#6258 PR-URL: nodejs#6316 Reviewed-By: bnoordhuis - Ben Noordhuis <[email protected]> Reviewed-By: targos - Michaël Zasso <[email protected]> Reviewed-By: cjihrig - Colin Ihrig <[email protected]>
V8 may start caching scripts from the first run soon. Preventively execute scripts in another process to ensure no test failures due to an update in the future. See: #6258 PR-URL: #6280 Reviewed-By: Jochen Eisinger <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: James M Snell <[email protected]>
V8 may cache compiled scripts, and it is not safe to assume that the V8 flags can be changed after an isolate has been created. In this particular case, since we are using the same script multiple times, the test would fail if V8 cached the result of the compilation. Ref: #6280 Fixes: #6258 PR-URL: #6316 Reviewed-By: bnoordhuis - Ben Noordhuis <[email protected]> Reviewed-By: targos - Michaël Zasso <[email protected]> Reviewed-By: cjihrig - Colin Ihrig <[email protected]>
While `let` no longer needs to run in `strict mode` in v8 5.x it throws in v8 4. This modification will make the test-vm-cached-data work in older version of node. Refs: nodejs#6280 PR-URL: nodejs#6317 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Fedor Indutny <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
While `let` no longer needs to run in `strict mode` in v8 5.x it throws in v8 4. This modification will make the test-vm-cached-data work in older version of node. Refs: #6280 PR-URL: #6317 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Fedor Indutny <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
Checklist
Affected core subsystem(s)
test
Description of change
V8 may start caching scripts from the first run soon. Preventively
execute scripts in another process to ensure no test failures due to
an update in the future.
See: #6258