summaryrefslogtreecommitdiff
path: root/test/parallel/test-tls-no-sslv3.js
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2015-12-08 23:46:07 +0100
committerBen Noordhuis <info@bnoordhuis.nl>2015-12-09 20:16:09 +0100
commit1e89830a11f3ec80b8955e7e2067302bc98a612a (patch)
tree06effcb407041ab6a251dc28c510431e93d71afb /test/parallel/test-tls-no-sslv3.js
parentda5cdc2207128e85e978203cdf19dc8d692ca5e1 (diff)
downloadandroid-node-v8-1e89830a11f3ec80b8955e7e2067302bc98a612a.tar.gz
android-node-v8-1e89830a11f3ec80b8955e7e2067302bc98a612a.tar.bz2
android-node-v8-1e89830a11f3ec80b8955e7e2067302bc98a612a.zip
test: don't assume openssl s_client supports -ssl3
Scan the child process's stderr for an 'unknown flag' error message and mark the test as skipped if found. Fixes: https://github.com/nodejs/node/issues/3927 PR-URL: https://github.com/nodejs/node/pull/4204 Reviewed-By: Rich Trott <rtrott@gmail.com>
Diffstat (limited to 'test/parallel/test-tls-no-sslv3.js')
-rw-r--r--test/parallel/test-tls-no-sslv3.js22
1 files changed, 18 insertions, 4 deletions
diff --git a/test/parallel/test-tls-no-sslv3.js b/test/parallel/test-tls-no-sslv3.js
index ce5a9d395d..442fc3b91c 100644
--- a/test/parallel/test-tls-no-sslv3.js
+++ b/test/parallel/test-tls-no-sslv3.js
@@ -19,6 +19,8 @@ if (common.opensslCli === false) {
var cert = fs.readFileSync(common.fixturesDir + '/test_cert.pem');
var key = fs.readFileSync(common.fixturesDir + '/test_key.pem');
var server = tls.createServer({ cert: cert, key: key }, common.fail);
+var errors = [];
+var stderr = '';
server.listen(common.PORT, '127.0.0.1', function() {
var address = this.address().address + ':' + this.address().port;
@@ -34,13 +36,25 @@ server.listen(common.PORT, '127.0.0.1', function() {
if (common.isWindows)
args.push('-no_rand_screen');
- var client = spawn(common.opensslCli, args, { stdio: 'inherit' });
+ var client = spawn(common.opensslCli, args, { stdio: 'pipe' });
+ client.stdout.pipe(process.stdout);
+ client.stderr.pipe(process.stderr);
+ client.stderr.setEncoding('utf8');
+ client.stderr.on('data', data => stderr += data);
+
client.once('exit', common.mustCall(function(exitCode) {
assert.equal(exitCode, 1);
server.close();
}));
});
-server.once('clientError', common.mustCall(function(err, conn) {
- assert(/:wrong version number/.test(err.message));
-}));
+server.on('clientError', err => errors.push(err));
+
+process.on('exit', function() {
+ if (/unknown option -ssl3/.test(stderr)) {
+ console.log('1..0 # Skipped: `openssl s_client -ssl3` not supported.');
+ } else {
+ assert.equal(errors.length, 1);
+ assert(/:wrong version number/.test(errors[0].message));
+ }
+});