test: spawn new processes in vm-cached-data#6280
test: spawn new processes in vm-cached-data#6280indutny wants to merge 3 commits intonodejs:masterfrom
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 |
test/parallel/test-vm-cached-data.js
Outdated
| assert(!script.cachedDataProduced || script.cachedData instanceof Buffer); | ||
|
|
||
| if (script.cachedDataProduced) | ||
| script.cachedData.toString('base64'); |
There was a problem hiding this comment.
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.
It is JS, the last statement will be printed when using -p argv.
There was a problem hiding this comment.
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.
|
LGTM but with a strong suggestion to change the test. |
test/parallel/test-vm-cached-data.js
Outdated
| assert.equal(out.status, 0, out.stderr + ''); | ||
|
|
||
| return script.cachedData; | ||
| return new Buffer(out.stdout.toString(), 'base64'); |
There was a problem hiding this comment.
Buffer.from(out.stdout.toString(), 'base64')
|
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.
Just for my understanding, process.argv[1] === undefined here, right?
There was a problem hiding this comment.
It is not, see source on line 32.
There was a problem hiding this comment.
$ node -e 'console.log(process.argv[1])' hello
hello
There was a problem hiding this comment.
Bet you didn't know about this 😉
There was a problem hiding this comment.
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 <jochen@chromium.org> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
|
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 <info@bnoordhuis.nl> Reviewed-By: targos - Michaël Zasso <mic.besace@gmail.com> Reviewed-By: cjihrig - Colin Ihrig <cjihrig@gmail.com>
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 <jochen@chromium.org> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
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 <info@bnoordhuis.nl> Reviewed-By: targos - Michaël Zasso <mic.besace@gmail.com> Reviewed-By: cjihrig - Colin Ihrig <cjihrig@gmail.com>
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 <jochen@chromium.org> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
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 <info@bnoordhuis.nl> Reviewed-By: targos - Michaël Zasso <mic.besace@gmail.com> Reviewed-By: cjihrig - Colin Ihrig <cjihrig@gmail.com>
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 <info@bnoordhuis.nl> Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com> Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
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 <info@bnoordhuis.nl> Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com> Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
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