mirror of
https://github.com/nodejs/node.git
synced 2025-05-06 16:46:56 +00:00

The tests still fail after being split into multiple files, (2 out of 30 runs in roughly 48 hours) and the causes are missing target frames in the samples. This patch moves them to sequential to observe if the flakiness can be fixed when the tests are run on a system with less load. If the flake ever shows up again even after the tests are moved to sequential, we should consider make the test conditions more lenient - that is, we would only assert that there are *some* frames in the generated CPU profile but do not look for the target function there. PR-URL: https://github.com/nodejs/node/pull/28210 Refs: https://github.com/nodejs/node/issues/27611 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com>
80 lines
1.9 KiB
JavaScript
80 lines
1.9 KiB
JavaScript
'use strict';
|
|
|
|
// This tests that invalid --cpu-prof options are rejected.
|
|
|
|
const common = require('../common');
|
|
const fixtures = require('../common/fixtures');
|
|
common.skipIfInspectorDisabled();
|
|
|
|
const assert = require('assert');
|
|
const { spawnSync } = require('child_process');
|
|
|
|
const tmpdir = require('../common/tmpdir');
|
|
const {
|
|
kCpuProfInterval,
|
|
env
|
|
} = require('../common/cpu-prof');
|
|
|
|
// --cpu-prof-name without --cpu-prof
|
|
{
|
|
tmpdir.refresh();
|
|
const output = spawnSync(process.execPath, [
|
|
'--cpu-prof-name',
|
|
'test.cpuprofile',
|
|
fixtures.path('workload', 'fibonacci.js'),
|
|
], {
|
|
cwd: tmpdir.path,
|
|
env
|
|
});
|
|
const stderr = output.stderr.toString().trim();
|
|
if (output.status !== 9) {
|
|
console.log(stderr);
|
|
}
|
|
assert.strictEqual(output.status, 9);
|
|
assert.strictEqual(
|
|
stderr,
|
|
`${process.execPath}: --cpu-prof-name must be used with --cpu-prof`);
|
|
}
|
|
|
|
// --cpu-prof-dir without --cpu-prof
|
|
{
|
|
tmpdir.refresh();
|
|
const output = spawnSync(process.execPath, [
|
|
'--cpu-prof-dir',
|
|
'prof',
|
|
fixtures.path('workload', 'fibonacci.js'),
|
|
], {
|
|
cwd: tmpdir.path,
|
|
env
|
|
});
|
|
const stderr = output.stderr.toString().trim();
|
|
if (output.status !== 9) {
|
|
console.log(stderr);
|
|
}
|
|
assert.strictEqual(output.status, 9);
|
|
assert.strictEqual(
|
|
stderr,
|
|
`${process.execPath}: --cpu-prof-dir must be used with --cpu-prof`);
|
|
}
|
|
|
|
// --cpu-prof-interval without --cpu-prof
|
|
{
|
|
tmpdir.refresh();
|
|
const output = spawnSync(process.execPath, [
|
|
'--cpu-prof-interval',
|
|
kCpuProfInterval,
|
|
fixtures.path('workload', 'fibonacci.js'),
|
|
], {
|
|
cwd: tmpdir.path,
|
|
env
|
|
});
|
|
const stderr = output.stderr.toString().trim();
|
|
if (output.status !== 9) {
|
|
console.log(stderr);
|
|
}
|
|
assert.strictEqual(output.status, 9);
|
|
assert.strictEqual(
|
|
stderr,
|
|
`${process.execPath}: --cpu-prof-interval must be used with --cpu-prof`);
|
|
}
|