Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Fixes test-tick-processor to not hang on Windows #7628

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ rules:
indent: [2, 2, {SwitchCase: 1}]
key-spacing: [2, {mode: "minimum"}]
keyword-spacing: 2
linebreak-style: [2, "unix"]
# linebreak-style: [2, "unix"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change should be removed from the change set, no?

max-len: [2, 80, 2]
new-parens: 2
no-mixed-spaces-and-tabs: 2
Expand Down
25 changes: 17 additions & 8 deletions test/parallel/test-tick-processor.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
'use strict';
var fs = require('fs');
var path = require('path');
var assert = require('assert');
var cp = require('child_process');
var common = require('../common');

//This test is designed test correctness of the integration of the V8
//tick processor with Node.js.
//(https://developers.google.com/v8/profiler_example)
//It is designed to test that the names of profiled functions appear in
//profiler output (as an approximation to profiler correctness)

// 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
Expand All @@ -18,15 +25,15 @@ common.refreshTmpDir();
process.chdir(common.tmpDir);
// 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() {
runTest(/LazyCompile: \*profiled_function|.*% UNKNOWN/,
`function profiled_function() {
for (var i = 0; i < 1000000; i++) {
i++;
}
setImmediate(function() { f(); });
setImmediate(function() { profiled_function(); });
};
setTimeout(function() { process.exit(0); }, 2000);
f();`);
profiled_function();`);
if (common.isWindows ||
common.isSunOS ||
common.isAix ||
Expand All @@ -36,15 +43,17 @@ if (common.isWindows ||
return;
}
runTest(/RunInDebugContext/,
`function f() {
`function profiled_function() {
require(\'vm\').runInDebugContext(\'Debug\');
setImmediate(function() { f(); });
setImmediate(function() { profiled_function(); });
};
setTimeout(function() { process.exit(0); }, 2000);
f();`);
profiled_function();`);

function runTest(pattern, code) {
cp.execFileSync(process.execPath, ['-prof', '-pe', code]);
var testCodePath = path.join(common.tmpDir, 'test.js');
fs.writeFileSync(testCodePath, code);
cp.execSync(process.execPath + ' -prof ' + testCodePath);
var matches = fs.readdirSync(common.tmpDir).filter(function(file) {
return /^isolate-/.test(file);
});
Expand Down