Skip to content

Commit 8bd74c4

Browse files
refackMylesBorins
authored andcommitted
tools,test: use Execute instead of check_output
subprocess.check_output is a python2.7 only feature. Using Execute allows keeping python2.6 compatibility PR-URL: #17381 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Myles Borins <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Gibson Fahnestock <[email protected]>
1 parent 2a4f4f8 commit 8bd74c4

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

tools/test.py

+7-10
Original file line numberDiff line numberDiff line change
@@ -1562,18 +1562,15 @@ def ArgsToTestPaths(test_root, args, suites):
15621562
return paths
15631563

15641564

1565-
def get_env_type(vm, options_type):
1565+
def get_env_type(vm, options_type, context):
15661566
if options_type is not None:
15671567
env_type = options_type
15681568
else:
1569-
if "fips" in subprocess.check_output([vm, "-p",
1570-
"process.versions.openssl"]):
1571-
env_type = "fips"
1572-
# NOTE(nikhil): "simple" is the default value for var 'env_type' and should
1573-
# be set last if no if/elif matches. If you plan to add more values, use
1574-
# 'elif' above.
1575-
else:
1576-
env_type = "simple"
1569+
# 'simple' is the default value for 'env_type'.
1570+
env_type = 'simple'
1571+
ssl_ver = Execute([vm, '-p', 'process.versions.openssl'], context).stdout
1572+
if 'fips' in ssl_ver:
1573+
env_type = 'fips'
15771574
return env_type
15781575

15791576

@@ -1659,7 +1656,7 @@ def Main():
16591656
'mode': mode,
16601657
'system': utils.GuessOS(),
16611658
'arch': vmArch,
1662-
'type': get_env_type(vm, options.type),
1659+
'type': get_env_type(vm, options.type, context),
16631660
}
16641661
test_list = root.ListTests([], path, context, arch, mode)
16651662
unclassified_tests += test_list

0 commit comments

Comments
 (0)