Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
split
  • Loading branch information
indutny committed Sep 15, 2016
commit 6142cc4fdd53ed7f3b28b2d761cc7e1cbbf2691e
56 changes: 56 additions & 0 deletions test/fixtures/tick-processor-base.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
'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 = 750;

function runTest(test) {
const proc = cp.spawn(process.execPath, [
'--no_logfile_per_isolate',
'--logfile=-',
'--prof',
'-pe', test.code
], {
stdio: [ null, '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: [ null, 'pipe', 'inherit' ]
});

let out = '';
proc.stdout.on('data', chunk => out += chunk);
proc.stdout.on('end', () => {
// Retry after timeout
if (!pattern.test(out))
return setTimeout(() => match(pattern, parent, ticks), RETRY_TIMEOUT);

parent.kill('SIGTERM');

fs.unlinkSync(LOG_FILE);
});
}

exports.runTest = runTest;
35 changes: 35 additions & 0 deletions test/parallel/test-tick-processor-builtin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
'use strict';
const common = require('../common');
const fs = require('fs');
const cp = require('child_process');
const path = require('path');

// 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;
}

const base = require(path.join(common.fixturesDir, 'tick-processor-base.js'));

if (common.isWindows ||
common.isSunOS ||
common.isAix ||
common.isLinuxPPCBE ||
common.isFreeBSD) {
common.skip('C++ symbols are not mapped for this os.');
return;
}

base.runTest({
pattern: /Builtin_DateNow/,
code: `function f() {
this.ts = Date.now();
setImmediate(function() { new f(); });
};
f();`
});
35 changes: 35 additions & 0 deletions test/parallel/test-tick-processor-cpp-core.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
'use strict';
const common = require('../common');
const fs = require('fs');
const cp = require('child_process');
const path = require('path');

// 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;
}

const base = require(path.join(common.fixturesDir, 'tick-processor-base.js'));

if (common.isWindows ||
common.isSunOS ||
common.isAix ||
common.isLinuxPPCBE ||
common.isFreeBSD) {
common.skip('C++ symbols are not mapped for this os.');
return;
}

base.runTest({
pattern: /RunInDebugContext/,
code: `function f() {
require(\'vm\').runInDebugContext(\'Debug\');
setImmediate(function() { f(); });
};
f();`
});
30 changes: 30 additions & 0 deletions test/parallel/test-tick-processor-unknown.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
'use strict';
const common = require('../common');
const fs = require('fs');
const cp = require('child_process');
const path = require('path');

// 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;
}

const base = require(path.join(common.fixturesDir, '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();`
});
109 changes: 0 additions & 109 deletions test/parallel/test-tick-processor.js

This file was deleted.