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

Make tests usable with debug release #3280

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
26 changes: 16 additions & 10 deletions test/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,21 +246,27 @@ exports.spawnPwd = function(options) {
};

exports.platformTimeout = function(ms) {
if (process.config.target_defaults.default_configuration === 'Debug')
ms = 2 * ms;
var newTimeout = ms;

if (process.arch !== 'arm')
return ms;
if (process.arch === 'arm') {
const armv = process.config.variables.arm_version;

const armv = process.config.variables.arm_version;
if (armv === '6') // ARMv6
newTimeout *= 7;

if (armv === '6')
return 7 * ms; // ARMv6
if (armv === '7') // ARMv7
newTimeout *= 2;
}

if (process.features.debug) {
newTimeout *= 5;
}

if (armv === '7')
return 2 * ms; // ARMv7
if (process.env.TEST_TIMEOUT_MULTIPLIER !== undefined) {
newTimeout = ms * process.env.TEST_TIMEOUT_MULTIPLIER;
}

return ms; // ARMv8+
return newTimeout;
};

var knownGlobals = [setTimeout,
Expand Down
8 changes: 4 additions & 4 deletions test/parallel/test-cluster-debug-port.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const assert = require('assert');
const cluster = require('cluster');

if (cluster.isMaster) {
assert.strictEqual(process.execArgv.length, 0, 'run test with no args');
assert.strictEqual(process.argv.length, 2, 'run test with no args');
Copy link
Member

Choose a reason for hiding this comment

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

Maybe keep the assert but change execArgv to regular argv?


function checkExitCode(code, signal) {
assert.strictEqual(code, 0);
Expand All @@ -28,11 +28,11 @@ if (cluster.isMaster) {
portSet: process.debugPort + 2
}).on('exit', checkExitCode);
} else {
const hasDebugArg = process.execArgv.some(function(arg) {
return /debug/.test(arg);
const hasDebugPortArg = process.execArgv.some(function(arg) {
return /debug-port/.test(arg);
});

assert.strictEqual(hasDebugArg, process.env.portSet !== undefined);
assert.strictEqual(hasDebugPortArg, process.env.portSet !== undefined);
assert.strictEqual(process.debugPort, +process.env.portSet || 5858);
process.exit();
}
2 changes: 1 addition & 1 deletion test/parallel/test-repl.js
Original file line number Diff line number Diff line change
Expand Up @@ -427,4 +427,4 @@ unix_test();

timer = setTimeout(function() {
assert.fail(null, null, 'Timeout');
}, 5000);
}, common.platformTimeout(5000));
1 change: 1 addition & 0 deletions test/testpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ def GetName(self):

def GetCommand(self):
result = [self.config.context.GetVm(self.arch, self.mode)]
result += self.config.context.GetVmFlags(self, self.mode)
source = open(self.file).read()
flags_match = FLAGS_PATTERN.search(source)
if flags_match:
Expand Down