mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
5f3fb1c0a1
This test is already partially disabled for several platforms with the comment that the required info is not provided at the C++ level. I'm adding AIX as and PPC BE linux as they currently fall into the same category. We are working to see if we can change that in v8 but it will be non-trivial if is possible at all so I don't want to leave the CI with failing tests until that point. PR-URL: https://github.com/nodejs/node/pull/3491 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
54 lines
1.6 KiB
JavaScript
54 lines
1.6 KiB
JavaScript
'use strict';
|
|
var fs = require('fs');
|
|
var assert = require('assert');
|
|
var path = require('path');
|
|
var cp = require('child_process');
|
|
var common = require('../common');
|
|
|
|
common.refreshTmpDir();
|
|
process.chdir(common.tmpDir);
|
|
var processor =
|
|
path.join(common.testDir, '..', 'tools', 'v8-prof', 'tick-processor.js');
|
|
// Unknown checked for to prevent flakiness, if pattern is not found,
|
|
// then a large number of unknown ticks should be present
|
|
runTest(/LazyCompile.*\[eval\]:1|.*% UNKNOWN/,
|
|
`function f() {
|
|
for (var i = 0; i < 1000000; i++) {
|
|
i++;
|
|
}
|
|
setImmediate(function() { f(); });
|
|
};
|
|
setTimeout(function() { process.exit(0); }, 2000);
|
|
f();`);
|
|
if (common.isWindows ||
|
|
common.isSunOS ||
|
|
common.isAix ||
|
|
common.isLinuxPPCBE ||
|
|
common.isFreeBSD) {
|
|
console.log('1..0 # Skipped: C++ symbols are not mapped for this os.');
|
|
return;
|
|
}
|
|
runTest(/RunInDebugContext/,
|
|
`function f() {
|
|
require(\'vm\').runInDebugContext(\'Debug\');
|
|
setImmediate(function() { f(); });
|
|
};
|
|
setTimeout(function() { process.exit(0); }, 2000);
|
|
f();`);
|
|
|
|
function runTest(pattern, code) {
|
|
cp.execFileSync(process.execPath, ['-prof', '-pe', code]);
|
|
var matches = fs.readdirSync(common.tmpDir).filter(function(file) {
|
|
return /^isolate-/.test(file);
|
|
});
|
|
if (matches.length != 1) {
|
|
assert.fail(null, null, 'There should be a single log file.');
|
|
}
|
|
var log = matches[0];
|
|
var out = cp.execSync(process.execPath + ' ' + processor +
|
|
' --call-graph-size=10 ' + log,
|
|
{encoding: 'utf8'});
|
|
assert(out.match(pattern));
|
|
fs.unlinkSync(log);
|
|
}
|