summaryrefslogtreecommitdiff
path: root/test/tick-processor
diff options
context:
space:
mode:
authordavidmarkclements <huperekchuno@googlemail.com>2017-08-21 19:01:06 +0100
committerJames M Snell <jasnell@gmail.com>2017-08-23 08:19:14 -0700
commit7c948ce233c2401ca36ab66195fc0599011141ee (patch)
tree69cb83465d396e29f564a7d5be7e21f9297451ea /test/tick-processor
parent6c382dea6bb88330cb2a66a097a49401da85f878 (diff)
downloadandroid-node-v8-7c948ce233c2401ca36ab66195fc0599011141ee.tar.gz
android-node-v8-7c948ce233c2401ca36ab66195fc0599011141ee.tar.bz2
android-node-v8-7c948ce233c2401ca36ab66195fc0599011141ee.zip
fix --prof-process --preprocess flag
This is a one-line fix to prevent the --preprocess option (used with --prof-process to output JSON) to cause an isolate log file profiling process to crash. PR-URL: https://github.com/nodejs/node/pull/14966 Reviewed-By: Luca Maraschi <luca.maraschi@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test/tick-processor')
-rw-r--r--test/tick-processor/test-tick-processor-preprocess-flag.js24
-rw-r--r--test/tick-processor/tick-processor-base.js6
2 files changed, 28 insertions, 2 deletions
diff --git a/test/tick-processor/test-tick-processor-preprocess-flag.js b/test/tick-processor/test-tick-processor-preprocess-flag.js
new file mode 100644
index 0000000000..52d642a3ae
--- /dev/null
+++ b/test/tick-processor/test-tick-processor-preprocess-flag.js
@@ -0,0 +1,24 @@
+'use strict';
+const common = require('../common');
+
+if (!common.enoughTestCpu)
+ common.skip('test is CPU-intensive');
+
+if (common.isWindows ||
+ common.isSunOS ||
+ common.isAIX ||
+ common.isLinuxPPCBE ||
+ common.isFreeBSD)
+ common.skip('C++ symbols are not mapped for this os.');
+
+const base = require('./tick-processor-base.js');
+
+base.runTest({
+ pattern: /^{/,
+ code: `function f() {
+ require('vm').runInDebugContext('Debug');
+ setImmediate(function() { f(); });
+ };
+ f();`,
+ profProcessFlags: ['--preprocess']
+});
diff --git a/test/tick-processor/tick-processor-base.js b/test/tick-processor/tick-processor-base.js
index aff37ba109..3017dc6bb4 100644
--- a/test/tick-processor/tick-processor-base.js
+++ b/test/tick-processor/tick-processor-base.js
@@ -24,23 +24,25 @@ function runTest(test) {
// Try to match after timeout
setTimeout(() => {
- match(test.pattern, proc, () => ticks);
+ match(test.pattern, proc, () => ticks, test.profProcessFlags);
}, RETRY_TIMEOUT);
}
-function match(pattern, parent, ticks) {
+function match(pattern, parent, ticks, flags = []) {
// Store current ticks log
fs.writeFileSync(LOG_FILE, ticks());
const proc = cp.spawn(process.execPath, [
'--prof-process',
'--call-graph-size=10',
+ ...flags,
LOG_FILE
], {
stdio: [ 'ignore', 'pipe', 'inherit' ]
});
let out = '';
+
proc.stdout.on('data', (chunk) => out += chunk);
proc.stdout.once('end', () => {
proc.once('exit', () => {