From 84741fdc8145b4ae1616a312c6bbb7c4c5742d6d Mon Sep 17 00:00:00 2001 From: zhangzifa Date: Thu, 19 Oct 2017 17:06:34 +0800 Subject: [PATCH] test: update test-timers-block-eventloop.js When CPU is busy, the above sequential case fails occasionally, expand the timeout value to fix it. PR-URL: https://github.com/nodejs/node/pull/16314 Fixes: https://github.com/nodejs/node/issues/16310 Reviewed-By: Gireesh Punathil Reviewed-By: Gibson Fahnestock Reviewed-By: James M Snell Reviewed-By: Refael Ackermann --- test/sequential/test-timers-block-eventloop.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/test/sequential/test-timers-block-eventloop.js b/test/sequential/test-timers-block-eventloop.js index 210cf0d80a1127..78ecc9e31746f5 100644 --- a/test/sequential/test-timers-block-eventloop.js +++ b/test/sequential/test-timers-block-eventloop.js @@ -2,21 +2,23 @@ const common = require('../common'); const fs = require('fs'); +const platformTimeout = common.platformTimeout; const t1 = setInterval(() => { - common.busyLoop(12); -}, 10); + common.busyLoop(platformTimeout(12)); +}, platformTimeout(10)); const t2 = setInterval(() => { - common.busyLoop(15); -}, 10); + common.busyLoop(platformTimeout(15)); +}, platformTimeout(10)); -const t3 = setTimeout(common.mustNotCall('eventloop blocked!'), 100); +const t3 = + setTimeout(common.mustNotCall('eventloop blocked!'), platformTimeout(200)); setTimeout(function() { - fs.stat('./nonexistent.txt', (err, stats) => { + fs.stat('/dev/nonexistent', (err, stats) => { clearInterval(t1); clearInterval(t2); clearTimeout(t3); }); -}, 50); +}, platformTimeout(50));