From ac7d3fa0d93001d8143f66bf793e66afbf2f76ff Mon Sep 17 00:00:00 2001 From: Shigeki Ohtsu Date: Sat, 18 Jul 2015 11:59:55 +0900 Subject: [PATCH] test: add -no_rand_screen to s_client opts on Win RAND_screen() causes stability issues in invoking openssl-cli s_client on win2008r2 in CI. Disable to use it by adding -no_rand_screen options to all tls tests that use common.opensslCli. Fixes: https://github.com/nodejs/io.js/issues/2150 PR-URL: https://github.com/nodejs/io.js/pull/2209 Reviewed-By: Rod Vagg Reviewed-By: Joao Reis Reviewed-By: Jeremiah Senkpiel --- test/parallel/test-https-foafssl.js | 4 ++++ test/parallel/test-tls-alert.js | 5 +++++ test/parallel/test-tls-dhe.js | 5 +++++ test/parallel/test-tls-ecdh-disable.js | 4 ++++ test/parallel/test-tls-ecdh.js | 4 ++++ test/parallel/test-tls-no-sslv3.js | 5 +++++ test/parallel/test-tls-securepair-server.js | 10 +++++++-- test/parallel/test-tls-session-cache.js | 25 +++++++++++++-------- test/parallel/test-tls-set-ciphers.js | 4 ++++ 9 files changed, 55 insertions(+), 11 deletions(-) diff --git a/test/parallel/test-https-foafssl.js b/test/parallel/test-https-foafssl.js index 7a3ceb9404f37e..5b1d04dd41d000 100644 --- a/test/parallel/test-https-foafssl.js +++ b/test/parallel/test-https-foafssl.js @@ -53,6 +53,10 @@ server.listen(common.PORT, function() { '-cert', join(common.fixturesDir, 'foafssl.crt'), '-key', join(common.fixturesDir, 'foafssl.key')]; + // for the performance and stability issue in s_client on Windows + if (process.platform === 'win32') + args.push('-no_rand_screen'); + var client = spawn(common.opensslCli, args); client.stdout.on('data', function(data) { diff --git a/test/parallel/test-tls-alert.js b/test/parallel/test-tls-alert.js index 10b43312507ff5..2f2e62c564b2ca 100644 --- a/test/parallel/test-tls-alert.js +++ b/test/parallel/test-tls-alert.js @@ -33,6 +33,11 @@ var server = tls.Server({ }, null).listen(common.PORT, function() { var args = ['s_client', '-quiet', '-tls1_1', '-connect', '127.0.0.1:' + common.PORT]; + + // for the performance and stability issue in s_client on Windows + if (process.platform === 'win32') + args.push('-no_rand_screen'); + var client = spawn(common.opensslCli, args); var out = ''; client.stderr.setEncoding('utf8'); diff --git a/test/parallel/test-tls-dhe.js b/test/parallel/test-tls-dhe.js index 7dab1faa4196a1..f6a2f1649b4ae2 100644 --- a/test/parallel/test-tls-dhe.js +++ b/test/parallel/test-tls-dhe.js @@ -43,6 +43,11 @@ function test(keylen, expectedCipher, cb) { server.listen(common.PORT, '127.0.0.1', function() { var args = ['s_client', '-connect', '127.0.0.1:' + common.PORT, '-cipher', ciphers]; + + // for the performance and stability issue in s_client on Windows + if (process.platform === 'win32') + args.push('-no_rand_screen'); + var client = spawn(common.opensslCli, args); var out = ''; client.stdout.setEncoding('utf8'); diff --git a/test/parallel/test-tls-ecdh-disable.js b/test/parallel/test-tls-ecdh-disable.js index 454e177ed74632..0dea4cac9ff09c 100644 --- a/test/parallel/test-tls-ecdh-disable.js +++ b/test/parallel/test-tls-ecdh-disable.js @@ -33,6 +33,10 @@ server.listen(common.PORT, '127.0.0.1', function() { var cmd = '"' + common.opensslCli + '" s_client -cipher ' + options.ciphers + ' -connect 127.0.0.1:' + common.PORT; + // for the performance and stability issue in s_client on Windows + if (process.platform === 'win32') + cmd += ' -no_rand_screen'; + exec(cmd, function(err, stdout, stderr) { // Old versions of openssl will still exit with 0 so we // can't just check if err is not null. diff --git a/test/parallel/test-tls-ecdh.js b/test/parallel/test-tls-ecdh.js index 2ffa970f383756..d728de63ee72b8 100644 --- a/test/parallel/test-tls-ecdh.js +++ b/test/parallel/test-tls-ecdh.js @@ -36,6 +36,10 @@ server.listen(common.PORT, '127.0.0.1', function() { var cmd = '"' + common.opensslCli + '" s_client -cipher ' + options.ciphers + ' -connect 127.0.0.1:' + common.PORT; + // for the performance and stability issue in s_client on Windows + if (process.platform === 'win32') + cmd += ' -no_rand_screen'; + exec(cmd, function(err, stdout, stderr) { if (err) throw err; response = stdout; diff --git a/test/parallel/test-tls-no-sslv3.js b/test/parallel/test-tls-no-sslv3.js index 2671bbcad580d5..e4a4df1481c5e0 100644 --- a/test/parallel/test-tls-no-sslv3.js +++ b/test/parallel/test-tls-no-sslv3.js @@ -29,6 +29,11 @@ server.listen(common.PORT, '127.0.0.1', function() { '-no_tls1_1', '-no_tls1_2', '-connect', address]; + + // for the performance and stability issue in s_client on Windows + if (process.platform === 'win32') + args.push('-no_rand_screen'); + var client = spawn(common.opensslCli, args, { stdio: 'inherit' }); client.once('exit', common.mustCall(function(exitCode) { assert.equal(exitCode, 1); diff --git a/test/parallel/test-tls-securepair-server.js b/test/parallel/test-tls-securepair-server.js index 80541620789a32..56feb54e013828 100644 --- a/test/parallel/test-tls-securepair-server.js +++ b/test/parallel/test-tls-securepair-server.js @@ -93,8 +93,14 @@ var opensslExitCode = -1; server.listen(common.PORT, function() { // To test use: openssl s_client -connect localhost:8000 - var client = spawn(common.opensslCli, ['s_client', '-connect', '127.0.0.1:' + - common.PORT]); + + var args = ['s_client', '-connect', '127.0.0.1:' + common.PORT]; + + // for the performance and stability issue in s_client on Windows + if (process.platform === 'win32') + args.push('-no_rand_screen'); + + var client = spawn(common.opensslCli, args); var out = ''; diff --git a/test/parallel/test-tls-session-cache.js b/test/parallel/test-tls-session-cache.js index d38fed6a99106e..d1715d6d7d5a57 100644 --- a/test/parallel/test-tls-session-cache.js +++ b/test/parallel/test-tls-session-cache.js @@ -70,16 +70,23 @@ function doTest(testOptions, callback) { callback(null, session.data); }, 100); }); + + var args = [ + 's_client', + '-tls1', + '-connect', 'localhost:' + common.PORT, + '-servername', 'ohgod', + '-key', join(common.fixturesDir, 'agent.key'), + '-cert', join(common.fixturesDir, 'agent.crt'), + '-reconnect' + ].concat(testOptions.tickets ? [] : '-no_ticket'); + + // for the performance and stability issue in s_client on Windows + if (process.platform === 'win32') + args.push('-no_rand_screen'); + server.listen(common.PORT, function() { - var client = spawn(common.opensslCli, [ - 's_client', - '-tls1', - '-connect', 'localhost:' + common.PORT, - '-servername', 'ohgod', - '-key', join(common.fixturesDir, 'agent.key'), - '-cert', join(common.fixturesDir, 'agent.crt'), - '-reconnect' - ].concat(testOptions.tickets ? [] : '-no_ticket'), { + var client = spawn(common.opensslCli, args, { stdio: [ 0, 1, 'pipe' ] }); var err = ''; diff --git a/test/parallel/test-tls-set-ciphers.js b/test/parallel/test-tls-set-ciphers.js index 666ef1fa80796b..7be1db0bc4a3a9 100644 --- a/test/parallel/test-tls-set-ciphers.js +++ b/test/parallel/test-tls-set-ciphers.js @@ -40,6 +40,10 @@ server.listen(common.PORT, '127.0.0.1', function() { var cmd = '"' + common.opensslCli + '" s_client -cipher ' + options.ciphers + ' -connect 127.0.0.1:' + common.PORT; + // for the performance and stability issue in s_client on Windows + if (process.platform === 'win32') + cmd += ' -no_rand_screen'; + exec(cmd, function(err, stdout, stderr) { if (err) throw err; response = stdout;