From 0dfa91d02ea0bc063b4907423d232fd3451241fc Mon Sep 17 00:00:00 2001 From: Ujjwal Sharma Date: Wed, 21 Mar 2018 01:02:49 +0530 Subject: [PATCH 1/6] Rename test-arm-math-exp-regress-1376.js to test-arm-math-illegal-instruction --- ...-regress-1376.js => test-arm-math-illegal-instruction.js} | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) rename test/parallel/{test-arm-math-exp-regress-1376.js => test-arm-math-illegal-instruction.js} (81%) diff --git a/test/parallel/test-arm-math-exp-regress-1376.js b/test/parallel/test-arm-math-illegal-instruction.js similarity index 81% rename from test/parallel/test-arm-math-exp-regress-1376.js rename to test/parallel/test-arm-math-illegal-instruction.js index c947208bd46650..2c4cdd263018a0 100644 --- a/test/parallel/test-arm-math-exp-regress-1376.js +++ b/test/parallel/test-arm-math-illegal-instruction.js @@ -1,8 +1,11 @@ 'use strict'; +require('../common'); + +// This test ensures Math functions don't fail with an "illegal instruction" +// error on ARM devices (primarily on the Raspberry Pi 1) // See https://github.com/nodejs/node/issues/1376 // and https://code.google.com/p/v8/issues/detail?id=4019 -require('../common'); Math.abs(-0.5); Math.acos(-0.5); Math.acosh(-0.5); From 8fa11840d4ce629e7a46541c27caaf4e336363c5 Mon Sep 17 00:00:00 2001 From: Ujjwal Sharma Date: Wed, 21 Mar 2018 01:32:33 +0530 Subject: [PATCH 2/6] Rename test-buffer-regression-649 to test-buffer-tostring-rangeerror --- ...egression-649.js => test-buffer-tostring-rangeerror.js} | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) rename test/parallel/{test-buffer-regression-649.js => test-buffer-tostring-rangeerror.js} (86%) diff --git a/test/parallel/test-buffer-regression-649.js b/test/parallel/test-buffer-tostring-rangeerror.js similarity index 86% rename from test/parallel/test-buffer-regression-649.js rename to test/parallel/test-buffer-tostring-rangeerror.js index f02e769fa21847..ccfb40bee75a40 100644 --- a/test/parallel/test-buffer-regression-649.js +++ b/test/parallel/test-buffer-tostring-rangeerror.js @@ -1,10 +1,13 @@ 'use strict'; - const common = require('../common'); + +// This test ensures that Node.js throws a RangeError when trying to convert a +// gigantic buffer into a string. +// Regression test for https://github.com/nodejs/node/issues/649. + const assert = require('assert'); const SlowBuffer = require('buffer').SlowBuffer; -// Regression test for https://github.com/nodejs/node/issues/649. const len = 1422561062959; const message = common.expectsError({ code: 'ERR_INVALID_OPT_VALUE', From e0164df5b6f7b51f8d43a01dc42b108149391ade Mon Sep 17 00:00:00 2001 From: Ujjwal Sharma Date: Thu, 22 Mar 2018 22:47:39 +0530 Subject: [PATCH 3/6] Renamed test-dgram-regress-4496 to test-dgram-typeerror-buffer --- ...gram-regress-4496.js => test-dgram-typeerror-buffer.js} | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) rename test/parallel/{test-dgram-regress-4496.js => test-dgram-typeerror-buffer.js} (89%) diff --git a/test/parallel/test-dgram-regress-4496.js b/test/parallel/test-dgram-typeerror-buffer.js similarity index 89% rename from test/parallel/test-dgram-regress-4496.js rename to test/parallel/test-dgram-typeerror-buffer.js index 72c43635e3fc77..d4f06292087b72 100644 --- a/test/parallel/test-dgram-regress-4496.js +++ b/test/parallel/test-dgram-typeerror-buffer.js @@ -20,9 +20,14 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. 'use strict'; +require('../common'); + // Remove this test once we support sending strings. -require('../common'); +// This test ensures that a TypeError is raised when the argument to `send()` +// or `sendto()` is anything but a Buffer. +// https://github.com/nodejs/node-v0.x-archive/issues/4496 + const assert = require('assert'); const dgram = require('dgram'); From f308d9a6918defded3ef5d62f444bca5e836bd02 Mon Sep 17 00:00:00 2001 From: Ujjwal Sharma Date: Fri, 23 Mar 2018 23:29:38 +0530 Subject: [PATCH 4/6] Renamed test-dgram-typeerror-buffer to test-dgram-send-invalid-msg-type --- ...-typeerror-buffer.js => test-dgram-send-invalid-msg-type.js} | 2 -- 1 file changed, 2 deletions(-) rename test/parallel/{test-dgram-typeerror-buffer.js => test-dgram-send-invalid-msg-type.js} (96%) diff --git a/test/parallel/test-dgram-typeerror-buffer.js b/test/parallel/test-dgram-send-invalid-msg-type.js similarity index 96% rename from test/parallel/test-dgram-typeerror-buffer.js rename to test/parallel/test-dgram-send-invalid-msg-type.js index d4f06292087b72..7a85455ce96464 100644 --- a/test/parallel/test-dgram-typeerror-buffer.js +++ b/test/parallel/test-dgram-send-invalid-msg-type.js @@ -22,8 +22,6 @@ 'use strict'; require('../common'); -// Remove this test once we support sending strings. - // This test ensures that a TypeError is raised when the argument to `send()` // or `sendto()` is anything but a Buffer. // https://github.com/nodejs/node-v0.x-archive/issues/4496 From 54a670871c559e52c901dc9856c5e518575c6256 Mon Sep 17 00:00:00 2001 From: Ujjwal Sharma Date: Sat, 24 Mar 2018 00:00:05 +0530 Subject: [PATCH 5/6] Renamed test-dns-regress-7070 to test-dns-resolvens-typeerror --- ...070.js => test-dns-resolvens-typeerror.js} | 33 +++++++++++-------- 1 file changed, 20 insertions(+), 13 deletions(-) rename test/parallel/{test-dns-regress-7070.js => test-dns-resolvens-typeerror.js} (71%) diff --git a/test/parallel/test-dns-regress-7070.js b/test/parallel/test-dns-resolvens-typeerror.js similarity index 71% rename from test/parallel/test-dns-regress-7070.js rename to test/parallel/test-dns-resolvens-typeerror.js index ada5bf2d91c0d6..8da7d3a489da23 100644 --- a/test/parallel/test-dns-regress-7070.js +++ b/test/parallel/test-dns-resolvens-typeerror.js @@ -21,18 +21,25 @@ 'use strict'; const common = require('../common'); -const dns = require('dns'); -// Should not raise assertion error. +// This test ensures `dns.resolveNs()` does not raise a C++-land assertion error +// and throw a JavaScript TypeError instead. // Issue https://github.com/nodejs/node-v0.x-archive/issues/7070 -common.expectsError(() => dns.resolveNs([]), // bad name - { - code: 'ERR_INVALID_ARG_TYPE', - type: TypeError, - message: /^The "name" argument must be of type string/ - }); -common.expectsError(() => dns.resolveNs(''), // bad callback - { - code: 'ERR_INVALID_CALLBACK', - type: TypeError - }); + +const dns = require('dns'); + +common.expectsError( + () => dns.resolveNs([]), // bad name + { + code: 'ERR_INVALID_ARG_TYPE', + type: TypeError, + message: /^The "name" argument must be of type string/ + } +); +common.expectsError( + () => dns.resolveNs(''), // bad callback + { + code: 'ERR_INVALID_CALLBACK', + type: TypeError + } +); From 809c8d8cef5a1898dba4ee9e72cad6c0df7a6873 Mon Sep 17 00:00:00 2001 From: Ujjwal Sharma Date: Sat, 24 Mar 2018 00:05:58 +0530 Subject: [PATCH 6/6] Renamed test-http-agent-maxsockets-regress-4050 to test-http-agent-maxsockets-respected --- ...test-http-agent-maxsockets-regress-4050.js | 41 -------------- .../test-http-agent-maxsockets-respected.js | 56 +++++++++++++++++++ 2 files changed, 56 insertions(+), 41 deletions(-) delete mode 100644 test/parallel/test-http-agent-maxsockets-regress-4050.js create mode 100644 test/parallel/test-http-agent-maxsockets-respected.js diff --git a/test/parallel/test-http-agent-maxsockets-regress-4050.js b/test/parallel/test-http-agent-maxsockets-regress-4050.js deleted file mode 100644 index eb1c95d5200694..00000000000000 --- a/test/parallel/test-http-agent-maxsockets-regress-4050.js +++ /dev/null @@ -1,41 +0,0 @@ -'use strict'; -const common = require('../common'); -const assert = require('assert'); -const http = require('http'); -const Countdown = require('../common/countdown'); - -const MAX_SOCKETS = 2; - -const agent = new http.Agent({ - keepAlive: true, - keepAliveMsecs: 1000, - maxSockets: MAX_SOCKETS, - maxFreeSockets: 2 -}); - -const server = http.createServer(common.mustCall((req, res) => { - res.end('hello world'); -}, 6)); - -const countdown = new Countdown(6, () => server.close()); - -function get(path, callback) { - return http.get({ - host: 'localhost', - port: server.address().port, - agent: agent, - path: path - }, callback); -} - -server.listen(0, common.mustCall(() => { - for (let i = 0; i < 6; i++) { - const request = get('/1', common.mustCall()); - request.on('response', common.mustCall(() => { - request.abort(); - const sockets = agent.sockets[Object.keys(agent.sockets)[0]]; - assert(sockets.length <= MAX_SOCKETS); - countdown.dec(); - })); - } -})); diff --git a/test/parallel/test-http-agent-maxsockets-respected.js b/test/parallel/test-http-agent-maxsockets-respected.js new file mode 100644 index 00000000000000..51db7e2f492362 --- /dev/null +++ b/test/parallel/test-http-agent-maxsockets-respected.js @@ -0,0 +1,56 @@ +'use strict'; +const common = require('../common'); +const Countdown = require('../common/countdown'); + +// This test ensures that the `maxSockets` value for `http.Agent` is respected. +// https://github.com/nodejs/node/issues/4050 + +const assert = require('assert'); +const http = require('http'); + +const MAX_SOCKETS = 2; + +const agent = new http.Agent({ + keepAlive: true, + keepAliveMsecs: 1000, + maxSockets: MAX_SOCKETS, + maxFreeSockets: 2 +}); + +const server = http.createServer( + common.mustCall((req, res) => { + res.end('hello world'); + }, 6) +); + +const countdown = new Countdown(6, () => server.close()); + +function get(path, callback) { + return http.get( + { + host: 'localhost', + port: server.address().port, + agent: agent, + path: path + }, + callback + ); +} + +server.listen( + 0, + common.mustCall(() => { + for (let i = 0; i < 6; i++) { + const request = get('/1', common.mustCall()); + request.on( + 'response', + common.mustCall(() => { + request.abort(); + const sockets = agent.sockets[Object.keys(agent.sockets)[0]]; + assert(sockets.length <= MAX_SOCKETS); + countdown.dec(); + }) + ); + } + }) +);