summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorRich Trott <rtrott@gmail.com>2019-06-11 16:08:53 -0700
committerRich Trott <rtrott@gmail.com>2019-06-13 23:01:42 -0700
commitd4c7487840c8b2b6852951d3e0623ed16206e2e6 (patch)
tree6729260505c83b62bbe2948735c28a7be91b1002 /test
parent4928c2f3b121b54169fd5d51872c673df9c27cae (diff)
downloadandroid-node-v8-d4c7487840c8b2b6852951d3e0623ed16206e2e6.tar.gz
android-node-v8-d4c7487840c8b2b6852951d3e0623ed16206e2e6.tar.bz2
android-node-v8-d4c7487840c8b2b6852951d3e0623ed16206e2e6.zip
test: remove FIB environment variable from cpu-prof.js
PR-URL: https://github.com/nodejs/node/pull/28183 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test')
-rw-r--r--test/common/README.md5
-rw-r--r--test/common/cpu-prof.js13
-rw-r--r--test/fixtures/workload/fibonacci.js9
3 files changed, 11 insertions, 16 deletions
diff --git a/test/common/README.md b/test/common/README.md
index 1f47baf7a8..2b8f852a3b 100644
--- a/test/common/README.md
+++ b/test/common/README.md
@@ -438,10 +438,9 @@ The `cpu-prof` module provides utilities related to CPU profiling tests.
### env
-* Default: { ...process.env, FIB, NODE_DEBUG_NATIVE: 'INSPECTOR_PROFILER' }
+* Default: { ...process.env, NODE_DEBUG_NATIVE: 'INSPECTOR_PROFILER' }
-Environment variables used in profiled processes. FIB will be set to `40` on
-Windows and `30` elsewhere.
+Environment variables used in profiled processes.
### getCpuProfiles(dir)
diff --git a/test/common/cpu-prof.js b/test/common/cpu-prof.js
index 8e8bd42275..ae81eefd45 100644
--- a/test/common/cpu-prof.js
+++ b/test/common/cpu-prof.js
@@ -2,7 +2,7 @@
'use strict';
-const common = require('./');
+require('./');
const fs = require('fs');
const path = require('path');
const assert = require('assert');
@@ -34,23 +34,12 @@ function verifyFrames(output, file, suffix) {
assert.notDeepStrictEqual(frames, []);
}
-let FIB = 30;
-// This is based on emperial values - in the CI, on Windows the program
-// tend to finish too fast then we won't be able to see the profiled script
-// in the samples, so we need to bump the values a bit. On slower platforms
-// like the Pis it could take more time to complete, we need to use a
-// smaller value so the test would not time out.
-if (common.isWindows) {
- FIB = 40;
-}
-
// We need to set --cpu-interval to a smaller value to make sure we can
// find our workload in the samples. 50us should be a small enough sampling
// interval for this.
const kCpuProfInterval = 50;
const env = {
...process.env,
- FIB,
NODE_DEBUG_NATIVE: 'INSPECTOR_PROFILER'
};
diff --git a/test/fixtures/workload/fibonacci.js b/test/fixtures/workload/fibonacci.js
index 899006daa5..0326914d04 100644
--- a/test/fixtures/workload/fibonacci.js
+++ b/test/fixtures/workload/fibonacci.js
@@ -4,5 +4,12 @@ function fib(n) {
return fib(n - 1) + fib(n - 2);
}
-const n = parseInt(process.env.FIB) || 35;
+// This is based on emperial values - in the CI, on Windows the program
+// tend to finish too fast then we won't be able to see the profiled script
+// in the samples, so we need to bump the values a bit. On slower platforms
+// like the Pis it could take more time to complete, we need to use a
+// smaller value so the test would not time out.
+const FIB = process.platform === 'win32' ? 40 : 30;
+
+const n = parseInt(process.env.FIB) || FIB;
process.stdout.write(`${fib(n)}\n`);