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 <rod@vagg.org>
Reviewed-By: Joao Reis <reis@janeasystems.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
This commit is contained in:
Shigeki Ohtsu 2015-07-18 11:59:55 +09:00
parent f90f1e75bb
commit ac7d3fa0d9
9 changed files with 55 additions and 11 deletions

View File

@ -53,6 +53,10 @@ server.listen(common.PORT, function() {
'-cert', join(common.fixturesDir, 'foafssl.crt'), '-cert', join(common.fixturesDir, 'foafssl.crt'),
'-key', join(common.fixturesDir, 'foafssl.key')]; '-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); var client = spawn(common.opensslCli, args);
client.stdout.on('data', function(data) { client.stdout.on('data', function(data) {

View File

@ -33,6 +33,11 @@ var server = tls.Server({
}, null).listen(common.PORT, function() { }, null).listen(common.PORT, function() {
var args = ['s_client', '-quiet', '-tls1_1', var args = ['s_client', '-quiet', '-tls1_1',
'-connect', '127.0.0.1:' + common.PORT]; '-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 client = spawn(common.opensslCli, args);
var out = ''; var out = '';
client.stderr.setEncoding('utf8'); client.stderr.setEncoding('utf8');

View File

@ -43,6 +43,11 @@ function test(keylen, expectedCipher, cb) {
server.listen(common.PORT, '127.0.0.1', function() { server.listen(common.PORT, '127.0.0.1', function() {
var args = ['s_client', '-connect', '127.0.0.1:' + common.PORT, var args = ['s_client', '-connect', '127.0.0.1:' + common.PORT,
'-cipher', ciphers]; '-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 client = spawn(common.opensslCli, args);
var out = ''; var out = '';
client.stdout.setEncoding('utf8'); client.stdout.setEncoding('utf8');

View File

@ -33,6 +33,10 @@ server.listen(common.PORT, '127.0.0.1', function() {
var cmd = '"' + common.opensslCli + '" s_client -cipher ' + options.ciphers + var cmd = '"' + common.opensslCli + '" s_client -cipher ' + options.ciphers +
' -connect 127.0.0.1:' + common.PORT; ' -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) { exec(cmd, function(err, stdout, stderr) {
// Old versions of openssl will still exit with 0 so we // Old versions of openssl will still exit with 0 so we
// can't just check if err is not null. // can't just check if err is not null.

View File

@ -36,6 +36,10 @@ server.listen(common.PORT, '127.0.0.1', function() {
var cmd = '"' + common.opensslCli + '" s_client -cipher ' + options.ciphers + var cmd = '"' + common.opensslCli + '" s_client -cipher ' + options.ciphers +
' -connect 127.0.0.1:' + common.PORT; ' -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) { exec(cmd, function(err, stdout, stderr) {
if (err) throw err; if (err) throw err;
response = stdout; response = stdout;

View File

@ -29,6 +29,11 @@ server.listen(common.PORT, '127.0.0.1', function() {
'-no_tls1_1', '-no_tls1_1',
'-no_tls1_2', '-no_tls1_2',
'-connect', address]; '-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' }); var client = spawn(common.opensslCli, args, { stdio: 'inherit' });
client.once('exit', common.mustCall(function(exitCode) { client.once('exit', common.mustCall(function(exitCode) {
assert.equal(exitCode, 1); assert.equal(exitCode, 1);

View File

@ -93,8 +93,14 @@ var opensslExitCode = -1;
server.listen(common.PORT, function() { server.listen(common.PORT, function() {
// To test use: openssl s_client -connect localhost:8000 // 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 = ''; var out = '';

View File

@ -70,8 +70,8 @@ function doTest(testOptions, callback) {
callback(null, session.data); callback(null, session.data);
}, 100); }, 100);
}); });
server.listen(common.PORT, function() {
var client = spawn(common.opensslCli, [ var args = [
's_client', 's_client',
'-tls1', '-tls1',
'-connect', 'localhost:' + common.PORT, '-connect', 'localhost:' + common.PORT,
@ -79,7 +79,14 @@ function doTest(testOptions, callback) {
'-key', join(common.fixturesDir, 'agent.key'), '-key', join(common.fixturesDir, 'agent.key'),
'-cert', join(common.fixturesDir, 'agent.crt'), '-cert', join(common.fixturesDir, 'agent.crt'),
'-reconnect' '-reconnect'
].concat(testOptions.tickets ? [] : '-no_ticket'), { ].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, args, {
stdio: [ 0, 1, 'pipe' ] stdio: [ 0, 1, 'pipe' ]
}); });
var err = ''; var err = '';

View File

@ -40,6 +40,10 @@ server.listen(common.PORT, '127.0.0.1', function() {
var cmd = '"' + common.opensslCli + '" s_client -cipher ' + options.ciphers + var cmd = '"' + common.opensslCli + '" s_client -cipher ' + options.ciphers +
' -connect 127.0.0.1:' + common.PORT; ' -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) { exec(cmd, function(err, stdout, stderr) {
if (err) throw err; if (err) throw err;
response = stdout; response = stdout;