Skip to content
Snippets Groups Projects
Commit 08698ee1 authored by Jakob Odersky's avatar Jakob Odersky Committed by Sean Owen
Browse files

[SPARK-11094] Strip extra strings from Java version in test runner

Removes any extra strings from the Java version, fixing subsequent integer parsing.
This is required since some OpenJDK versions (specifically in Debian testing), append an extra "-internal" string to the version field.

Author: Jakob Odersky <jodersky@gmail.com>

Closes #9111 from jodersky/fixtestrunner.
parent ed775042
No related branches found
No related tags found
No related merge requests found
......@@ -176,17 +176,14 @@ def determine_java_version(java_exe):
# find raw version string, eg 'java version "1.8.0_25"'
raw_version_str = next(x for x in raw_output_lines if " version " in x)
version_str = raw_version_str.split()[-1].strip('"') # eg '1.8.0_25'
version, update = version_str.split('_') # eg ['1.8.0', '25']
match = re.search('(\d+)\.(\d+)\.(\d+)_(\d+)', raw_version_str)
# map over the values and convert them to integers
version_info = [int(x) for x in version.split('.') + [update]]
return JavaVersion(major=version_info[0],
minor=version_info[1],
patch=version_info[2],
update=version_info[3])
major = int(match.group(1))
minor = int(match.group(2))
patch = int(match.group(3))
update = int(match.group(4))
return JavaVersion(major, minor, patch, update)
# -------------------------------------------------------------------------------------------------
# Functions for running the other build and test scripts
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment