From 096ba3704919495444b6d2d24393c1e2cac695b8 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sun, 18 Sep 2016 18:24:44 -0700 Subject: [PATCH] test: skip cpu-intensive tests on slow hosts The `test-tick-processor-*` tests are now passing everywhere except for the single-processor 700MHz Raspberry Pi 1 devices. The tests are CPU-intensive. Skip the tests if there is only one CPU and it runs at a speed not more than 700 MHz. --- test/common.js | 4 ++++ test/parallel/parallel.status | 4 ---- test/parallel/test-tick-processor-builtin.js | 19 +++++++------------ test/parallel/test-tick-processor-cpp-core.js | 19 +++++++------------ test/parallel/test-tick-processor-unknown.js | 5 +++++ 5 files changed, 23 insertions(+), 28 deletions(-) diff --git a/test/common.js b/test/common.js index 5a9369f196db38..7acee8ab26850f 100644 --- a/test/common.js +++ b/test/common.js @@ -31,6 +31,10 @@ exports.isLinux = process.platform === 'linux'; exports.isOSX = process.platform === 'darwin'; exports.enoughTestMem = os.totalmem() > 0x40000000; /* 1 Gb */ + +const cpus = os.cpus(); +exports.enoughTestCpu = cpus.length > 1 || cpus[0].speed > 999; + exports.rootDir = exports.isWindows ? 'c:\\' : '/'; function rimrafSync(p) { diff --git a/test/parallel/parallel.status b/test/parallel/parallel.status index 8c3239909b255c..9a5a1bee095979 100644 --- a/test/parallel/parallel.status +++ b/test/parallel/parallel.status @@ -9,14 +9,10 @@ prefix parallel [$system==win32] [$system==linux] -test-tick-processor : PASS,FLAKY [$system==macos] [$arch==arm || $arch==arm64] -test-tick-processor-builtin : PASS,FLAKY -test-tick-processor-cpp-core : PASS,FLAKY -test-tick-processor-unknown : PASS,FLAKY [$system==solaris] # Also applies to SmartOS diff --git a/test/parallel/test-tick-processor-builtin.js b/test/parallel/test-tick-processor-builtin.js index 9097a832fff60f..8e6a5313deafaa 100644 --- a/test/parallel/test-tick-processor-builtin.js +++ b/test/parallel/test-tick-processor-builtin.js @@ -2,18 +2,6 @@ const common = require('../common'); const path = require('path'); -// TODO(mhdawson) Currently the test-tick-processor functionality in V8 -// depends on addresses being smaller than a full 64 bits. Aix supports -// the full 64 bits and the result is that it does not process the -// addresses correctly and runs out of memory -// Disabling until we get a fix upstreamed into V8 -if (common.isAix) { - common.skip('Aix address range too big for scripts.'); - return; -} - -const base = require(path.join(common.fixturesDir, 'tick-processor-base.js')); - if (common.isWindows || common.isSunOS || common.isAix || @@ -23,6 +11,13 @@ if (common.isWindows || return; } +if (!common.enoughTestCpu) { + common.skip('test is CPU-intensive'); + return; +} + +const base = require(path.join(common.fixturesDir, 'tick-processor-base.js')); + base.runTest({ pattern: /Builtin_DateNow/, code: `function f() { diff --git a/test/parallel/test-tick-processor-cpp-core.js b/test/parallel/test-tick-processor-cpp-core.js index 10e3fd35fd60c9..6223808da0c4d9 100644 --- a/test/parallel/test-tick-processor-cpp-core.js +++ b/test/parallel/test-tick-processor-cpp-core.js @@ -2,18 +2,6 @@ const common = require('../common'); const path = require('path'); -// TODO(mhdawson) Currently the test-tick-processor functionality in V8 -// depends on addresses being smaller than a full 64 bits. Aix supports -// the full 64 bits and the result is that it does not process the -// addresses correctly and runs out of memory -// Disabling until we get a fix upstreamed into V8 -if (common.isAix) { - common.skip('Aix address range too big for scripts.'); - return; -} - -const base = require(path.join(common.fixturesDir, 'tick-processor-base.js')); - if (common.isWindows || common.isSunOS || common.isAix || @@ -23,6 +11,13 @@ if (common.isWindows || return; } +if (!common.enoughTestCpu) { + common.skip('test is CPU-intensive'); + return; +} + +const base = require(path.join(common.fixturesDir, 'tick-processor-base.js')); + base.runTest({ pattern: /RunInDebugContext/, code: `function f() { diff --git a/test/parallel/test-tick-processor-unknown.js b/test/parallel/test-tick-processor-unknown.js index 15fc2d283f4063..d1d1f4e63258f4 100644 --- a/test/parallel/test-tick-processor-unknown.js +++ b/test/parallel/test-tick-processor-unknown.js @@ -12,6 +12,11 @@ if (common.isAix) { return; } +if (!common.enoughTestCpu) { + common.skip('test is CPU-intensive'); + return; +} + const base = require(path.join(common.fixturesDir, 'tick-processor-base.js')); // Unknown checked for to prevent flakiness, if pattern is not found,