summaryrefslogtreecommitdiff
path: root/test/tick-processor
diff options
context:
space:
mode:
authorRich Trott <rtrott@gmail.com>2016-11-07 13:34:54 -0800
committerRich Trott <rtrott@gmail.com>2016-11-09 19:34:56 -0800
commiteed8b0525c4b824e6ee8ba2e2f883e91614967d9 (patch)
treecb5afa8c8664277f6b2697ca0d812cf7e56a6bec /test/tick-processor
parent103858e95f07894fa391b09c5331c7f81b123bb2 (diff)
downloadandroid-node-v8-eed8b0525c4b824e6ee8ba2e2f883e91614967d9.tar.gz
android-node-v8-eed8b0525c4b824e6ee8ba2e2f883e91614967d9.tar.bz2
android-node-v8-eed8b0525c4b824e6ee8ba2e2f883e91614967d9.zip
test: move tick-processor tests to own directory
The tick-processor tests are inherently non-deterministic. They therefore have false negatives from time to time. They also sometimes leave extra processes running. Move them to their own directory until these issues are sorted. Note that this means that the tests will not be run in CI. Like the inspector tests and other tests, they will have to be run manually when they are wanted. PR-URL: https://github.com/nodejs/node/pull/9506 Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: Matthew Loring <mattloring@google.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Diffstat (limited to 'test/tick-processor')
-rw-r--r--test/tick-processor/test-tick-processor-builtin.js27
-rw-r--r--test/tick-processor/test-tick-processor-cpp-core.js27
-rw-r--r--test/tick-processor/test-tick-processor-unknown.js32
-rw-r--r--test/tick-processor/testcfg.py6
-rw-r--r--test/tick-processor/tick-processor-base.js62
5 files changed, 154 insertions, 0 deletions
diff --git a/test/tick-processor/test-tick-processor-builtin.js b/test/tick-processor/test-tick-processor-builtin.js
new file mode 100644
index 0000000000..afe08bdb0b
--- /dev/null
+++ b/test/tick-processor/test-tick-processor-builtin.js
@@ -0,0 +1,27 @@
+'use strict';
+const common = require('../common');
+
+if (common.isWindows ||
+ common.isSunOS ||
+ common.isAix ||
+ common.isLinuxPPCBE ||
+ common.isFreeBSD) {
+ common.skip('C++ symbols are not mapped for this os.');
+ return;
+}
+
+if (!common.enoughTestCpu) {
+ common.skip('test is CPU-intensive');
+ return;
+}
+
+const base = require('./tick-processor-base.js');
+
+base.runTest({
+ pattern: /Builtin_DateNow/,
+ code: `function f() {
+ this.ts = Date.now();
+ setImmediate(function() { new f(); });
+ };
+ f();`
+});
diff --git a/test/tick-processor/test-tick-processor-cpp-core.js b/test/tick-processor/test-tick-processor-cpp-core.js
new file mode 100644
index 0000000000..72eb25e91c
--- /dev/null
+++ b/test/tick-processor/test-tick-processor-cpp-core.js
@@ -0,0 +1,27 @@
+'use strict';
+const common = require('../common');
+
+if (common.isWindows ||
+ common.isSunOS ||
+ common.isAix ||
+ common.isLinuxPPCBE ||
+ common.isFreeBSD) {
+ common.skip('C++ symbols are not mapped for this os.');
+ return;
+}
+
+if (!common.enoughTestCpu) {
+ common.skip('test is CPU-intensive');
+ return;
+}
+
+const base = require('./tick-processor-base.js');
+
+base.runTest({
+ pattern: /RunInDebugContext/,
+ code: `function f() {
+ require('vm').runInDebugContext('Debug');
+ setImmediate(function() { f(); });
+ };
+ f();`
+});
diff --git a/test/tick-processor/test-tick-processor-unknown.js b/test/tick-processor/test-tick-processor-unknown.js
new file mode 100644
index 0000000000..ab3d110ccf
--- /dev/null
+++ b/test/tick-processor/test-tick-processor-unknown.js
@@ -0,0 +1,32 @@
+'use strict';
+const common = require('../common');
+
+// 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;
+}
+
+if (!common.enoughTestCpu) {
+ common.skip('test is CPU-intensive');
+ return;
+}
+
+const base = require('./tick-processor-base.js');
+
+// Unknown checked for to prevent flakiness, if pattern is not found,
+// then a large number of unknown ticks should be present
+base.runTest({
+ pattern: /LazyCompile.*\[eval]:1|.*% UNKNOWN/,
+ code: `function f() {
+ for (var i = 0; i < 1000000; i++) {
+ i++;
+ }
+ setImmediate(function() { f(); });
+ };
+ f();`
+});
diff --git a/test/tick-processor/testcfg.py b/test/tick-processor/testcfg.py
new file mode 100644
index 0000000000..42e98355a5
--- /dev/null
+++ b/test/tick-processor/testcfg.py
@@ -0,0 +1,6 @@
+import sys, os
+sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
+import testpy
+
+def GetConfiguration(context, root):
+ return testpy.SimpleTestConfiguration(context, root, 'tick-processor')
diff --git a/test/tick-processor/tick-processor-base.js b/test/tick-processor/tick-processor-base.js
new file mode 100644
index 0000000000..aff37ba109
--- /dev/null
+++ b/test/tick-processor/tick-processor-base.js
@@ -0,0 +1,62 @@
+'use strict';
+const common = require('../common');
+const fs = require('fs');
+const cp = require('child_process');
+const path = require('path');
+
+common.refreshTmpDir();
+
+const LOG_FILE = path.join(common.tmpDir, 'tick-processor.log');
+const RETRY_TIMEOUT = 150;
+
+function runTest(test) {
+ const proc = cp.spawn(process.execPath, [
+ '--no_logfile_per_isolate',
+ '--logfile=-',
+ '--prof',
+ '-pe', test.code
+ ], {
+ stdio: [ 'ignore', 'pipe', 'inherit' ]
+ });
+
+ let ticks = '';
+ proc.stdout.on('data', (chunk) => ticks += chunk);
+
+ // Try to match after timeout
+ setTimeout(() => {
+ match(test.pattern, proc, () => ticks);
+ }, RETRY_TIMEOUT);
+}
+
+function match(pattern, parent, ticks) {
+ // Store current ticks log
+ fs.writeFileSync(LOG_FILE, ticks());
+
+ const proc = cp.spawn(process.execPath, [
+ '--prof-process',
+ '--call-graph-size=10',
+ LOG_FILE
+ ], {
+ stdio: [ 'ignore', 'pipe', 'inherit' ]
+ });
+
+ let out = '';
+ proc.stdout.on('data', (chunk) => out += chunk);
+ proc.stdout.once('end', () => {
+ proc.once('exit', () => {
+ fs.unlinkSync(LOG_FILE);
+
+ // Retry after timeout
+ if (!pattern.test(out))
+ return setTimeout(() => match(pattern, parent, ticks), RETRY_TIMEOUT);
+
+ parent.stdout.removeAllListeners();
+ parent.kill();
+ });
+
+ proc.stdout.removeAllListeners();
+ proc.kill();
+ });
+}
+
+exports.runTest = runTest;