summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/internal/v8_prof_processor.js1
-rw-r--r--test/tick-processor/test-tick-processor-preprocess-flag.js24
-rw-r--r--test/tick-processor/tick-processor-base.js6
3 files changed, 29 insertions, 2 deletions
diff --git a/lib/internal/v8_prof_processor.js b/lib/internal/v8_prof_processor.js
index f0bcff7482..01b81c6ba5 100644
--- a/lib/internal/v8_prof_processor.js
+++ b/lib/internal/v8_prof_processor.js
@@ -32,6 +32,7 @@ if (process.platform === 'darwin') {
tickArguments.push.apply(tickArguments, process.argv.slice(1));
script = `(function() {
arguments = ${JSON.stringify(tickArguments)};
+ function write (s) { process.stdout.write(s) }
${script}
})()`;
eval(script);
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', () => {