Skip to content

Commit

Permalink
Ultimate: fix search for available java
Browse files Browse the repository at this point in the history
The previous search failed to use the java version on the PATH,
as glob.glob("java") always returned the empty list.
The new version coincides more closely with the implementation
in the Ultimate.py wrapper script, and thus should ensure that
the same java version is used from the tool info module and by
Ultimate itself.

Also not explicitly that the two implementations should match.
  • Loading branch information
maul-esel committed Nov 7, 2024
1 parent 9b89d6d commit a4f6c4d
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions benchexec/tools/ultimate.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,8 @@ def get_value_from_output(self, output, identifier):
return None

def get_java_installations(self):
# The code in this method is (and should remain) consistent with the method `get_java` in
# <https://github.com/ultimate-pa/ultimate/blob/dev/releaseScripts/default/adds/Ultimate.py>.
candidates = [
"java",
"/usr/bin/java",
Expand All @@ -475,11 +477,16 @@ def get_java_installations(self):
"/usr/lib/jvm/java-*-openjdk-amd64/bin/java",
]

candidates = [c for entry in candidates for c in glob.glob(entry)]
candidates_extended = []
for c in candidates:
if "*" in c:
candidates_extended += glob.glob(c)
else:
candidates_extended += [c]
pattern = r'"(\d+\.\d+).*"'

rtr = {}
for c in candidates:
for c in candidates_extended:
candidate = shutil.which(c)
if not candidate:
continue
Expand Down

0 comments on commit a4f6c4d

Please sign in to comment.