diff --git a/benchexec/tools/ultimate.py b/benchexec/tools/ultimate.py index 236699a99..c78d8e908 100644 --- a/benchexec/tools/ultimate.py +++ b/benchexec/tools/ultimate.py @@ -10,6 +10,7 @@ import glob import logging import os +from pathlib import Path import re import shlex import shutil @@ -30,6 +31,7 @@ _LAUNCHER_JARS = [ "plugins/org.eclipse.equinox.launcher_1.5.800.v20200727-1323.jar", "plugins/org.eclipse.equinox.launcher_1.3.100.v20150511-1540.jar", + "plugins/org.eclipse.equinox.launcher_1.6.800.v20240513-1750.jar", ] @@ -71,15 +73,13 @@ def project_url(self): def executable(self, tool_locator): exe = tool_locator.find_executable("Ultimate.py") - dir_name = os.path.dirname(exe) - logging.debug("Looking in %s for Ultimate and plugins/", dir_name) - for _, dir_names, file_names in os.walk(dir_name): - if "Ultimate" in file_names and "plugins" in dir_names: - return exe - break + dir_name = Path(os.path.dirname(exe)) + logging.debug("Checking if %s contains a launcher jar", dir_name) + if any([(dir_name / rel_launcher).exists() for rel_launcher in _LAUNCHER_JARS]): + return exe msg = ( f"ERROR: Did find a Ultimate.py in {os.path.dirname(exe)} " - f"but no 'Ultimate' or no 'plugins' directory besides it" + f"but no launcher .jar besides it" ) raise ToolNotFoundException(msg) @@ -466,6 +466,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 + # . candidates = [ "java", "/usr/bin/java", @@ -474,11 +476,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