From 7df6d9ddc82cda9868e3a96a7eaf1d7d59849f30 Mon Sep 17 00:00:00 2001 From: Ujjwal Sharma Date: Wed, 14 Mar 2018 03:13:29 +0530 Subject: [PATCH] test: rename regression tests file names Rename the tests appropriately alongside mentioning the subsystem. Also, make a few basic changes to make sure the tests conform to the standard test structure. - Rename test-regress-GH-io-1068 to test-tty-stdin-end - Rename test-regress-GH-io-1811 to test-zlib-kmaxlength-rangeerror - Rename test-regress-GH-node-9326 to test-kill-segfault-freebsd - Rename test-timers-regress-GH-9765 to test-timers-setimmediate-infinite-loop - Rename test-tls-pfx-gh-5100-regr to test-tls-pfx-authorizationerror - Rename test-tls-regr-gh-5108 to test-tls-tlswrap-segfault PR-URL: https://github.com/nodejs/node/pull/19332 Fixes: https://github.com/nodejs/node/issues/19105 Reviewed-By: Gireesh Punathil Reviewed-By: James M Snell Reviewed-By: Weijia Wang Reviewed-By: Yuta Hiroto Reviewed-By: Richard Lau Reviewed-By: Luigi Pinca Reviewed-By: Shingo Inoue --- ...-9326.js => test-kill-segfault-freebsd.js} | 5 +++ test/parallel/test-regress-GH-io-1068.js | 3 -- ...test-timers-setimmediate-infinite-loop.js} | 0 .../test-tls-pfx-authorizationerror.js | 42 +++++++++++++++++++ test/parallel/test-tls-pfx-gh-5100-regr.js | 32 -------------- ...h-5108.js => test-tls-tlswrap-segfault.js} | 9 ++-- test/parallel/test-tty-stdin-end.js | 7 ++++ ....js => test-zlib-kmaxlength-rangeerror.js} | 6 ++- 8 files changed, 64 insertions(+), 40 deletions(-) rename test/parallel/{test-regress-GH-node-9326.js => test-kill-segfault-freebsd.js} (61%) delete mode 100644 test/parallel/test-regress-GH-io-1068.js rename test/parallel/{test-timers-regress-GH-9765.js => test-timers-setimmediate-infinite-loop.js} (100%) create mode 100644 test/parallel/test-tls-pfx-authorizationerror.js delete mode 100644 test/parallel/test-tls-pfx-gh-5100-regr.js rename test/parallel/{test-tls-regr-gh-5108.js => test-tls-tlswrap-segfault.js} (81%) create mode 100644 test/parallel/test-tty-stdin-end.js rename test/parallel/{test-regress-GH-io-1811.js => test-zlib-kmaxlength-rangeerror.js} (76%) diff --git a/test/parallel/test-regress-GH-node-9326.js b/test/parallel/test-kill-segfault-freebsd.js similarity index 61% rename from test/parallel/test-regress-GH-node-9326.js rename to test/parallel/test-kill-segfault-freebsd.js index 78565e3f596594..8532f11c86b804 100644 --- a/test/parallel/test-regress-GH-node-9326.js +++ b/test/parallel/test-kill-segfault-freebsd.js @@ -1,5 +1,10 @@ 'use strict'; require('../common'); + +// This test ensures Node.js doesn't crash on hitting Ctrl+C in order to +// terminate the currently running process (especially on FreeBSD). +// https://github.com/nodejs/node-v0.x-archive/issues/9326 + const assert = require('assert'); const child_process = require('child_process'); diff --git a/test/parallel/test-regress-GH-io-1068.js b/test/parallel/test-regress-GH-io-1068.js deleted file mode 100644 index a92bb3e75259f0..00000000000000 --- a/test/parallel/test-regress-GH-io-1068.js +++ /dev/null @@ -1,3 +0,0 @@ -'use strict'; -require('../common'); -process.stdin.emit('end'); diff --git a/test/parallel/test-timers-regress-GH-9765.js b/test/parallel/test-timers-setimmediate-infinite-loop.js similarity index 100% rename from test/parallel/test-timers-regress-GH-9765.js rename to test/parallel/test-timers-setimmediate-infinite-loop.js diff --git a/test/parallel/test-tls-pfx-authorizationerror.js b/test/parallel/test-tls-pfx-authorizationerror.js new file mode 100644 index 00000000000000..64b6e1485dc538 --- /dev/null +++ b/test/parallel/test-tls-pfx-authorizationerror.js @@ -0,0 +1,42 @@ +'use strict'; +const common = require('../common'); +if (!common.hasCrypto) + common.skip('node compiled without crypto.'); +const fixtures = require('../common/fixtures'); + +// This test ensures that TLS does not fail to read a self-signed certificate +// and thus throw an `authorizationError`. +// https://github.com/nodejs/node/issues/5100 + +const assert = require('assert'); +const tls = require('tls'); + +const pfx = fixtures.readKey('agent1-pfx.pem'); + +const server = tls + .createServer( + { + pfx: pfx, + passphrase: 'sample', + requestCert: true, + rejectUnauthorized: false + }, + common.mustCall(function(c) { + assert.strictEqual(c.authorizationError, null); + c.end(); + }) + ) + .listen(0, function() { + const client = tls.connect( + { + port: this.address().port, + pfx: pfx, + passphrase: 'sample', + rejectUnauthorized: false + }, + function() { + client.end(); + server.close(); + } + ); + }); diff --git a/test/parallel/test-tls-pfx-gh-5100-regr.js b/test/parallel/test-tls-pfx-gh-5100-regr.js deleted file mode 100644 index 199d4bdf22778c..00000000000000 --- a/test/parallel/test-tls-pfx-gh-5100-regr.js +++ /dev/null @@ -1,32 +0,0 @@ -'use strict'; - -const common = require('../common'); - -if (!common.hasCrypto) - common.skip('node compiled without crypto.'); - -const assert = require('assert'); -const tls = require('tls'); -const fixtures = require('../common/fixtures'); - -const pfx = fixtures.readKey('agent1-pfx.pem'); - -const server = tls.createServer({ - pfx: pfx, - passphrase: 'sample', - requestCert: true, - rejectUnauthorized: false -}, common.mustCall(function(c) { - assert.strictEqual(c.authorizationError, null); - c.end(); -})).listen(0, function() { - const client = tls.connect({ - port: this.address().port, - pfx: pfx, - passphrase: 'sample', - rejectUnauthorized: false - }, function() { - client.end(); - server.close(); - }); -}); diff --git a/test/parallel/test-tls-regr-gh-5108.js b/test/parallel/test-tls-tlswrap-segfault.js similarity index 81% rename from test/parallel/test-tls-regr-gh-5108.js rename to test/parallel/test-tls-tlswrap-segfault.js index 402a6014d1396c..eaa51ff51baa71 100644 --- a/test/parallel/test-tls-regr-gh-5108.js +++ b/test/parallel/test-tls-tlswrap-segfault.js @@ -1,19 +1,21 @@ 'use strict'; const common = require('../common'); - if (!common.hasCrypto) common.skip('missing crypto'); +const fixtures = require('../common/fixtures'); + +// This test ensures that Node.js doesn't incur a segfault while accessing +// TLSWrap fields after the parent handle was destroyed. +// https://github.com/nodejs/node/issues/5108 const assert = require('assert'); const tls = require('tls'); -const fixtures = require('../common/fixtures'); const options = { key: fixtures.readKey('agent1-key.pem'), cert: fixtures.readKey('agent1-cert.pem') }; - const server = tls.createServer(options, function(s) { s.end('hello'); }).listen(0, function() { @@ -26,7 +28,6 @@ const server = tls.createServer(options, function(s) { }); }); - function putImmediate(client) { setImmediate(function() { if (client.ssl) { diff --git a/test/parallel/test-tty-stdin-end.js b/test/parallel/test-tty-stdin-end.js new file mode 100644 index 00000000000000..c78f58446d03e9 --- /dev/null +++ b/test/parallel/test-tty-stdin-end.js @@ -0,0 +1,7 @@ +'use strict'; +require('../common'); + +// This test ensures that Node.js doesn't crash on `process.stdin.emit("end")`. +// https://github.com/nodejs/node/issues/1068 + +process.stdin.emit('end'); diff --git a/test/parallel/test-regress-GH-io-1811.js b/test/parallel/test-zlib-kmaxlength-rangeerror.js similarity index 76% rename from test/parallel/test-regress-GH-io-1811.js rename to test/parallel/test-zlib-kmaxlength-rangeerror.js index a8966da10ba1f7..e8e47865f79604 100644 --- a/test/parallel/test-regress-GH-io-1811.js +++ b/test/parallel/test-zlib-kmaxlength-rangeerror.js @@ -1,6 +1,10 @@ 'use strict'; - require('../common'); + +// This test ensures that zlib throws a RangeError if the final buffer needs to +// be larger than kMaxLength and concatenation fails. +// https://github.com/nodejs/node/pull/1811 + const assert = require('assert'); // Change kMaxLength for zlib to trigger the error without having to allocate