mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
1acf0339dd
The test relied on V8 not optimizing functions that use `set.has()`. Force V8 to not optimize it now that TurboFan knows about this method. PR-URL: https://github.com/nodejs/node/pull/44741 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
39 lines
1.0 KiB
JavaScript
39 lines
1.0 KiB
JavaScript
'use strict';
|
|
|
|
// Check that spawn child doesn't create duplicated entries
|
|
const common = require('../common');
|
|
|
|
if (common.isPi) {
|
|
common.skip('Too slow for Raspberry Pi devices');
|
|
}
|
|
|
|
const kRepetitions = 2;
|
|
const assert = require('assert');
|
|
const fixtures = require('../common/fixtures');
|
|
const { promisify, debuglog } = require('util');
|
|
const debug = debuglog('test');
|
|
|
|
const { execFile } = require('child_process');
|
|
const execFilePromise = promisify(execFile);
|
|
const targetScript = fixtures.path('guess-hash-seed.js');
|
|
|
|
const requiredCallback = common.mustCall((results) => {
|
|
const seeds = results.map((val) => val.stdout.trim());
|
|
debug(`Seeds: ${seeds}`);
|
|
assert.strictEqual(new Set(seeds).size, seeds.length);
|
|
assert.strictEqual(seeds.length, kRepetitions);
|
|
});
|
|
|
|
function generateSeed() {
|
|
return execFilePromise(process.execPath, [
|
|
// Needed for %NeverOptimizeFunction.
|
|
'--allow-natives-syntax',
|
|
targetScript,
|
|
]);
|
|
}
|
|
|
|
const subprocesses = [...new Array(kRepetitions)].map(generateSeed);
|
|
|
|
Promise.all(subprocesses)
|
|
.then(requiredCallback);
|