Repository: spark
Updated Branches:
  refs/heads/branch-1.5 7aaf485f3 -> 9903e0509


[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 <joder...@gmail.com>

Closes #9111 from jodersky/fixtestrunner.

(cherry picked from commit 08698ee1d6f29b2c999416f18a074d5193cdacd5)
Signed-off-by: Sean Owen <so...@cloudera.com>


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/9903e050
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/9903e050
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/9903e050

Branch: refs/heads/branch-1.5
Commit: 9903e0509f063cf9e43755788b475d3935576f72
Parents: 7aaf485
Author: Jakob Odersky <joder...@gmail.com>
Authored: Fri Oct 16 14:26:34 2015 +0100
Committer: Sean Owen <so...@cloudera.com>
Committed: Fri Oct 16 14:26:46 2015 +0100

----------------------------------------------------------------------
 dev/run-tests.py | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/9903e050/dev/run-tests.py
----------------------------------------------------------------------
diff --git a/dev/run-tests.py b/dev/run-tests.py
index f689425..8bed2b3 100755
--- a/dev/run-tests.py
+++ b/dev/run-tests.py
@@ -167,17 +167,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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org
For additional commands, e-mail: commits-h...@spark.apache.org

Reply via email to