test: increase timeouts on ARM

This commit introduces platform-specific test timeouts for the ARM
architectures. ARMv6 is notoriously slow so gets very large timeouts on
both the timeout value for each test, as well as certain problematic
individual tests. ARMv7 and ARMv8 also get slightly increased headroom.

PR-URL: https://github.com/iojs/io.js/pull/1366
Fixes: https://github.com/iojs/io.js/issues/1343
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
This commit is contained in:
Roman Reiss 2015-04-07 20:41:07 +02:00
parent d2b62a4973
commit 7049d7b474
12 changed files with 34 additions and 16 deletions

View File

@ -179,6 +179,16 @@ exports.spawnPwd = function(options) {
} }
}; };
exports.platformTimeout = function(ms) {
if (process.arch !== 'arm')
return ms;
if (process.config.variables.arm_version === '6')
return 6 * ms; // ARMv6
return 2 * ms; // ARMv7 and up.
};
var knownGlobals = [setTimeout, var knownGlobals = [setTimeout,
setInterval, setInterval,
setImmediate, setImmediate,

View File

@ -128,13 +128,13 @@ if (process.argv[2] === 'child') {
server.listen(common.PORT, '127.0.0.1'); server.listen(common.PORT, '127.0.0.1');
var timeElasped = 0; var timeElapsed = 0;
var closeServer = function() { var closeServer = function() {
console.error('[m] closeServer'); console.error('[m] closeServer');
var startTime = Date.now(); var startTime = Date.now();
server.on('close', function() { server.on('close', function() {
console.error('[m] emit(close)'); console.error('[m] emit(close)');
timeElasped = Date.now() - startTime; timeElapsed = Date.now() - startTime;
}); });
console.error('[m] calling server.close'); console.error('[m] calling server.close');
@ -149,11 +149,14 @@ if (process.argv[2] === 'child') {
}, 200); }, 200);
}; };
var min = 190;
var max = common.platformTimeout(1500);
process.on('exit', function() { process.on('exit', function() {
assert.equal(disconnected, count); assert.equal(disconnected, count);
assert.equal(connected, count); assert.equal(connected, count);
assert.ok(closeEmitted); assert.ok(closeEmitted);
assert.ok(timeElasped >= 190 && timeElasped <= 1000, assert.ok(timeElapsed >= min && timeElapsed <= max,
'timeElasped was not between 190 and 1000 ms'); `timeElapsed was not between ${min} and ${max} ms:` +
`${timeElapsed}`);
}); });
} }

View File

@ -51,7 +51,7 @@ function onNoMoreLines() {
setTimeout(function testTimedOut() { setTimeout(function testTimedOut() {
assert(false, 'test timed out.'); assert(false, 'test timed out.');
}, 6000).unref(); }, common.platformTimeout(3000)).unref();
process.on('exit', function onExit() { process.on('exit', function onExit() {
// Kill processes in reverse order to avoid timing problems on Windows where // Kill processes in reverse order to avoid timing problems on Windows where

View File

@ -22,7 +22,7 @@ fs.open(emptyFile, 'r', function (error, fd) {
setTimeout(function () { setTimeout(function () {
assert.equal(readEmit, true); assert.equal(readEmit, true);
}, 50); }, common.platformTimeout(50));
}); });
fs.open(emptyFile, 'r', function (error, fd) { fs.open(emptyFile, 'r', function (error, fd) {
@ -43,5 +43,5 @@ fs.open(emptyFile, 'r', function (error, fd) {
setTimeout(function () { setTimeout(function () {
assert.equal(readEmit, false); assert.equal(readEmit, false);
}, 50); }, common.platformTimeout(50));
}); });

View File

@ -32,7 +32,7 @@ server.listen(common.PORT, function() {
setTimeout(function() { setTimeout(function() {
process.removeListener('uncaughtException', catcher); process.removeListener('uncaughtException', catcher);
throw new Error('Taking too long!'); throw new Error('Taking too long!');
}, 1000).unref(); }, common.platformTimeout(1000)).unref();
process.on('uncaughtException', catcher); process.on('uncaughtException', catcher);
var errors = 0; var errors = 0;

View File

@ -44,7 +44,7 @@ child.stdout.once('data', function() {
' });\n' + ' });\n' +
'});"";\n'); '});"";\n');
setTimeout(child.stdin.end.bind(child.stdin), 200); setTimeout(child.stdin.end.bind(child.stdin), common.platformTimeout(200));
} }
}); });

View File

@ -22,7 +22,7 @@ var gotDrain = false;
var timer = setTimeout(function() { var timer = setTimeout(function() {
console.log('not ok - timed out'); console.log('not ok - timed out');
process.exit(1); process.exit(1);
}, 500); }, common.platformTimeout(500));
function onconnection(conn) { function onconnection(conn) {
conn.on('data', function(c) { conn.on('data', function(c) {

View File

@ -27,7 +27,9 @@ var server = tls.createServer(options, function(c) {
server.listen(common.PORT, function() { server.listen(common.PORT, function() {
var socket = net.connect(common.PORT, function() { var socket = net.connect(common.PORT, function() {
socket.setTimeout(240, assert.fail); socket.setTimeout(common.platformTimeout(240), function() {
throw new Error('timeout');
});
var tsocket = tls.connect({ var tsocket = tls.connect({
socket: socket, socket: socket,

View File

@ -7,7 +7,7 @@ var cp = spawn(process.execPath, ['-i']);
var gotToEnd = false; var gotToEnd = false;
var timeoutId = setTimeout(function() { var timeoutId = setTimeout(function() {
throw new Error('timeout!'); throw new Error('timeout!');
}, 1000); // give node + the repl 1 second to boot up }, common.platformTimeout(1000)); // give node + the repl 1 second to boot up
cp.stdout.setEncoding('utf8'); cp.stdout.setEncoding('utf8');

View File

@ -72,7 +72,7 @@ function parent() {
setTimeout(function() { setTimeout(function() {
throw new Error('hang'); throw new Error('hang');
}); });
}, 4000).unref(); }, common.platformTimeout(2000)).unref();
var s = spawn(node, [__filename, 'server'], opt); var s = spawn(node, [__filename, 'server'], opt);
var c; var c;

View File

@ -729,7 +729,8 @@ FLAGS = {
'debug' : ['--enable-slow-asserts', '--debug-code', '--verify-heap'], 'debug' : ['--enable-slow-asserts', '--debug-code', '--verify-heap'],
'release' : []} 'release' : []}
TIMEOUT_SCALEFACTOR = { TIMEOUT_SCALEFACTOR = {
'arm' : { 'debug' : 8, 'release' : 2 }, # The ARM buildbots are slow. 'armv6' : { 'debug' : 12, 'release' : 3 }, # The ARM buildbots are slow.
'arm' : { 'debug' : 8, 'release' : 2 },
'ia32' : { 'debug' : 4, 'release' : 1 } } 'ia32' : { 'debug' : 4, 'release' : 1 } }

View File

@ -73,7 +73,9 @@ def GuessOS():
def GuessArchitecture(): def GuessArchitecture():
id = platform.machine() id = platform.machine()
id = id.lower() # Windows 7 capitalizes 'AMD64'. id = id.lower() # Windows 7 capitalizes 'AMD64'.
if id.startswith('arm') or id == 'aarch64': if id.startswith('armv6'): # Can return 'armv6l'.
return 'armv6'
elif id.startswith('arm') or id == 'aarch64':
return 'arm' return 'arm'
elif (not id) or (not re.match('(x|i[3-6])86$', id) is None): elif (not id) or (not re.match('(x|i[3-6])86$', id) is None):
return 'ia32' return 'ia32'