Skip to content

Commit 7049d7b

Browse files
committed
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: #1366 Fixes: #1343 Reviewed-By: Ben Noordhuis <[email protected]>
1 parent d2b62a4 commit 7049d7b

12 files changed

+34
-16
lines changed

test/common.js

+10
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,16 @@ exports.spawnPwd = function(options) {
179179
}
180180
};
181181

182+
exports.platformTimeout = function(ms) {
183+
if (process.arch !== 'arm')
184+
return ms;
185+
186+
if (process.config.variables.arm_version === '6')
187+
return 6 * ms; // ARMv6
188+
189+
return 2 * ms; // ARMv7 and up.
190+
};
191+
182192
var knownGlobals = [setTimeout,
183193
setInterval,
184194
setImmediate,

test/parallel/test-child-process-fork-net2.js

+7-4
Original file line numberDiff line numberDiff line change
@@ -128,13 +128,13 @@ if (process.argv[2] === 'child') {
128128

129129
server.listen(common.PORT, '127.0.0.1');
130130

131-
var timeElasped = 0;
131+
var timeElapsed = 0;
132132
var closeServer = function() {
133133
console.error('[m] closeServer');
134134
var startTime = Date.now();
135135
server.on('close', function() {
136136
console.error('[m] emit(close)');
137-
timeElasped = Date.now() - startTime;
137+
timeElapsed = Date.now() - startTime;
138138
});
139139

140140
console.error('[m] calling server.close');
@@ -149,11 +149,14 @@ if (process.argv[2] === 'child') {
149149
}, 200);
150150
};
151151

152+
var min = 190;
153+
var max = common.platformTimeout(1500);
152154
process.on('exit', function() {
153155
assert.equal(disconnected, count);
154156
assert.equal(connected, count);
155157
assert.ok(closeEmitted);
156-
assert.ok(timeElasped >= 190 && timeElasped <= 1000,
157-
'timeElasped was not between 190 and 1000 ms');
158+
assert.ok(timeElapsed >= min && timeElapsed <= max,
159+
`timeElapsed was not between ${min} and ${max} ms:` +
160+
`${timeElapsed}`);
158161
});
159162
}

test/parallel/test-debug-signal-cluster.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ function onNoMoreLines() {
5151

5252
setTimeout(function testTimedOut() {
5353
assert(false, 'test timed out.');
54-
}, 6000).unref();
54+
}, common.platformTimeout(3000)).unref();
5555

5656
process.on('exit', function onExit() {
5757
// Kill processes in reverse order to avoid timing problems on Windows where

test/parallel/test-fs-empty-readStream.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ fs.open(emptyFile, 'r', function (error, fd) {
2222

2323
setTimeout(function () {
2424
assert.equal(readEmit, true);
25-
}, 50);
25+
}, common.platformTimeout(50));
2626
});
2727

2828
fs.open(emptyFile, 'r', function (error, fd) {
@@ -43,5 +43,5 @@ fs.open(emptyFile, 'r', function (error, fd) {
4343

4444
setTimeout(function () {
4545
assert.equal(readEmit, false);
46-
}, 50);
46+
}, common.platformTimeout(50));
4747
});

test/parallel/test-http-end-throw-socket-handling.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ server.listen(common.PORT, function() {
3232
setTimeout(function() {
3333
process.removeListener('uncaughtException', catcher);
3434
throw new Error('Taking too long!');
35-
}, 1000).unref();
35+
}, common.platformTimeout(1000)).unref();
3636

3737
process.on('uncaughtException', catcher);
3838
var errors = 0;

test/parallel/test-repl-timeout-throw.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ child.stdout.once('data', function() {
4444
' });\n' +
4545
'});"";\n');
4646

47-
setTimeout(child.stdin.end.bind(child.stdin), 200);
47+
setTimeout(child.stdin.end.bind(child.stdin), common.platformTimeout(200));
4848
}
4949
});
5050

test/parallel/test-tls-fast-writing.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ var gotDrain = false;
2222
var timer = setTimeout(function() {
2323
console.log('not ok - timed out');
2424
process.exit(1);
25-
}, 500);
25+
}, common.platformTimeout(500));
2626

2727
function onconnection(conn) {
2828
conn.on('data', function(c) {

test/parallel/test-tls-wrap-timeout.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ var server = tls.createServer(options, function(c) {
2727

2828
server.listen(common.PORT, function() {
2929
var socket = net.connect(common.PORT, function() {
30-
socket.setTimeout(240, assert.fail);
30+
socket.setTimeout(common.platformTimeout(240), function() {
31+
throw new Error('timeout');
32+
});
3133

3234
var tsocket = tls.connect({
3335
socket: socket,

test/sequential/test-force-repl.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ var cp = spawn(process.execPath, ['-i']);
77
var gotToEnd = false;
88
var timeoutId = setTimeout(function() {
99
throw new Error('timeout!');
10-
}, 1000); // give node + the repl 1 second to boot up
10+
}, common.platformTimeout(1000)); // give node + the repl 1 second to boot up
1111

1212
cp.stdout.setEncoding('utf8');
1313

test/sequential/test-net-GH-5504.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ function parent() {
7272
setTimeout(function() {
7373
throw new Error('hang');
7474
});
75-
}, 4000).unref();
75+
}, common.platformTimeout(2000)).unref();
7676

7777
var s = spawn(node, [__filename, 'server'], opt);
7878
var c;

tools/test.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -729,8 +729,9 @@ def GetTestStatus(self, context, sections, defs):
729729
'debug' : ['--enable-slow-asserts', '--debug-code', '--verify-heap'],
730730
'release' : []}
731731
TIMEOUT_SCALEFACTOR = {
732-
'arm' : { 'debug' : 8, 'release' : 2 }, # The ARM buildbots are slow.
733-
'ia32' : { 'debug' : 4, 'release' : 1 } }
732+
'armv6' : { 'debug' : 12, 'release' : 3 }, # The ARM buildbots are slow.
733+
'arm' : { 'debug' : 8, 'release' : 2 },
734+
'ia32' : { 'debug' : 4, 'release' : 1 } }
734735

735736

736737
class Context(object):

tools/utils.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,9 @@ def GuessOS():
7373
def GuessArchitecture():
7474
id = platform.machine()
7575
id = id.lower() # Windows 7 capitalizes 'AMD64'.
76-
if id.startswith('arm') or id == 'aarch64':
76+
if id.startswith('armv6'): # Can return 'armv6l'.
77+
return 'armv6'
78+
elif id.startswith('arm') or id == 'aarch64':
7779
return 'arm'
7880
elif (not id) or (not re.match('(x|i[3-6])86$', id) is None):
7981
return 'ia32'

0 commit comments

Comments
 (0)