Python 3 compatibility fix for running Java tests using run_tests.py (flutter/engine#27970)

(Note that LUCI is currently still running this script using Python 2)
This commit is contained in:
Jason Simmons 2021-08-11 11:00:57 -07:00 committed by GitHub
parent 6d12ad484a
commit 5126dfe55e

View File

@ -321,6 +321,7 @@ def AssertExpectedJavaVersion():
EXPECTED_VERSION = '1.8'
# `java -version` is output to stderr. https://bugs.java.com/bugdatabase/view_bug.do?bug_id=4380614
version_output = subprocess.check_output(['java', '-version'], stderr=subprocess.STDOUT)
version_output = version_output.decode('utf-8')
match = bool(re.compile('version "%s' % EXPECTED_VERSION).search(version_output))
message = "JUnit tests need to be run with Java %s. Check the `java -version` on your PATH." % EXPECTED_VERSION
assert match, message