Skip to content

Commit 414e9d2

Browse files
TrottBridgeAR
authored andcommitted
test: remove FIB environment variable from cpu-prof.js
PR-URL: #28183 Reviewed-By: Richard Lau <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 066d814 commit 414e9d2

File tree

3 files changed

+11
-16
lines changed

3 files changed

+11
-16
lines changed

test/common/README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -438,10 +438,9 @@ The `cpu-prof` module provides utilities related to CPU profiling tests.
438438

439439
### env
440440

441-
* Default: { ...process.env, FIB, NODE_DEBUG_NATIVE: 'INSPECTOR_PROFILER' }
441+
* Default: { ...process.env, NODE_DEBUG_NATIVE: 'INSPECTOR_PROFILER' }
442442

443-
Environment variables used in profiled processes. FIB will be set to `40` on
444-
Windows and `30` elsewhere.
443+
Environment variables used in profiled processes.
445444

446445
### getCpuProfiles(dir)
447446

test/common/cpu-prof.js

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
'use strict';
44

5-
const common = require('./');
5+
require('./');
66
const fs = require('fs');
77
const path = require('path');
88
const assert = require('assert');
@@ -34,23 +34,12 @@ function verifyFrames(output, file, suffix) {
3434
assert.notDeepStrictEqual(frames, []);
3535
}
3636

37-
let FIB = 30;
38-
// This is based on emperial values - in the CI, on Windows the program
39-
// tend to finish too fast then we won't be able to see the profiled script
40-
// in the samples, so we need to bump the values a bit. On slower platforms
41-
// like the Pis it could take more time to complete, we need to use a
42-
// smaller value so the test would not time out.
43-
if (common.isWindows) {
44-
FIB = 40;
45-
}
46-
4737
// We need to set --cpu-interval to a smaller value to make sure we can
4838
// find our workload in the samples. 50us should be a small enough sampling
4939
// interval for this.
5040
const kCpuProfInterval = 50;
5141
const env = {
5242
...process.env,
53-
FIB,
5443
NODE_DEBUG_NATIVE: 'INSPECTOR_PROFILER'
5544
};
5645

test/fixtures/workload/fibonacci.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,12 @@ function fib(n) {
44
return fib(n - 1) + fib(n - 2);
55
}
66

7-
const n = parseInt(process.env.FIB) || 35;
7+
// This is based on emperial values - in the CI, on Windows the program
8+
// tend to finish too fast then we won't be able to see the profiled script
9+
// in the samples, so we need to bump the values a bit. On slower platforms
10+
// like the Pis it could take more time to complete, we need to use a
11+
// smaller value so the test would not time out.
12+
const FIB = process.platform === 'win32' ? 40 : 30;
13+
14+
const n = parseInt(process.env.FIB) || FIB;
815
process.stdout.write(`${fib(n)}\n`);

0 commit comments

Comments
 (0)