Skip to content

Commit

Permalink
test: skip test that use --tls-v1.x flags
Browse files Browse the repository at this point in the history
Currently, configuring --without-ssl will cause the following test to
fail:

=== release test-https-agent-additional-options ===
Path: parallel/test-https-agent-additional-options
out/Release/node: bad option: --tls-v1.1
Command: out/Release/node --tls-v1.1
  /node/test/parallel/test-https-agent-additional-options.js

=== release test-https-agent-session-eviction ===
Path: parallel/test-https-agent-session-eviction
out/Release/node: bad option: --tls-v1.0

Command: out/Release/node --tls-v1.0
  /node/test/parallel/test-https-agent-session-eviction.js

This commit adds a check for the --tls-v.x flags and skips them if node
was built without crypto support.

PR-URL: #24376
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
Reviewed-By: Franziska Hinkelmann <[email protected]>
Reviewed-By: Rod Vagg <[email protected]>
  • Loading branch information
danbev authored and codebytere committed Jan 29, 2019
1 parent be14283 commit d2d6287
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
18 changes: 11 additions & 7 deletions test/testpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def GetCommand(self):
source = open(self.file).read()
flags_match = FLAGS_PATTERN.search(source)
if flags_match:
flag = flags_match.group(1).strip().split()
flags = flags_match.group(1).strip().split()
# The following block reads config.gypi to extract the v8_enable_inspector
# value. This is done to check if the inspector is disabled in which case
# the '--inspect' flag cannot be passed to the node process as it will
Expand All @@ -71,13 +71,17 @@ def GetCommand(self):
# inspector related tests). Also, if there is no ssl support the options
# '--use-bundled-ca' and '--use-openssl-ca' will also cause a similar
# failure so such tests are also skipped.
if ('--inspect' in flag[0] or \
'--use-bundled-ca' in flag[0] or \
'--use-openssl-ca' in flag[0]) and \
self.context.v8_enable_inspector == 0:
print('Skipping as node was configured --without-ssl')
if (any(flag.startswith('--inspect') for flag in flags) and
not self.context.v8_enable_inspector):
print('Skipping as node was compiled without inspector support')
elif (('--use-bundled-ca' in flags or
'--use-openssl-ca' in flags or
'--tls-v1.0' in flags or
'--tls-v1.1' in flags) and
not self.context.node_has_crypto):
print('Skipping as node was compiled without crypto support')
else:
result += flag
result += flags
files_match = FILES_PATTERN.search(source);
additional_files = []
if files_match:
Expand Down
12 changes: 9 additions & 3 deletions tools/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -907,6 +907,7 @@ def __init__(self, workspace, buildspace, verbose, vm, args, expect_fail,
self.repeat = repeat
self.abort_on_timeout = abort_on_timeout
self.v8_enable_inspector = True
self.node_has_crypto = True

def GetVm(self, arch, mode):
if arch == 'none':
Expand Down Expand Up @@ -1632,9 +1633,14 @@ def Main():

# We want to skip the inspector tests if node was built without the inspector.
has_inspector = Execute([vm,
"-p", "process.config.variables.v8_enable_inspector"], context)
if has_inspector.stdout.rstrip() == "0":
context.v8_enable_inspector = False
'-p', 'process.config.variables.v8_enable_inspector'], context)
if has_inspector.stdout.rstrip() == '0':
context.v8_enable_inspector = False

has_crypto = Execute([vm,
'-p', 'process.versions.openssl'], context)
if has_crypto.stdout.rstrip() == 'undefined':
context.node_has_crypto = False

if options.cat:
visited = set()
Expand Down

0 comments on commit d2d6287

Please sign in to comment.