Skip to content

Commit

Permalink
Optimization of CPAchecker's tool-info module
Browse files Browse the repository at this point in the history
We do not need to scan through the src directory of CPAchecker
if we are not going to use the information anyway.
So check this first.
  • Loading branch information
PhilippWendler committed Jun 27, 2024
1 parent ead3fba commit 2c4643f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions benchexec/tools/cpachecker.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,17 @@ def executable(self, tool_locator):
# If this is a source checkout of CPAchecker, we heuristically check that
# sources are not newer than binaries (cpachecker.jar or files in bin/).
try:
if os.path.isdir(src_dir):
has_jar = os.path.isfile(jar_file)
has_cls = os.path.isdir(cls_dir)

if os.path.isdir(src_dir) and (has_jar or has_cls):
src_mtime = self._find_newest_mtime(src_dir)

if os.path.isfile(jar_file):
if has_jar:
if src_mtime > os.stat(jar_file).st_mtime:
sys.exit("CPAchecker JAR is not uptodate, run 'ant jar'!")

elif os.path.isdir(cls_dir):
elif has_cls:
if src_mtime > self._find_newest_mtime(cls_dir):
sys.exit("CPAchecker build is not uptodate, run 'ant'!")
except OSError as e:
Expand Down

0 comments on commit 2c4643f

Please sign in to comment.