Repository navigation
Await writer acknowledgement before reporting send success #2746
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,8 +10,10 @@ | |
| from __future__ import annotations | ||
|
|
||
| import argparse | ||
| import os | ||
| import pathlib | ||
| import re | ||
| import shutil | ||
| import subprocess | ||
| import tempfile | ||
| from typing import Sequence | ||
|
|
@@ -72,6 +74,36 @@ def parse_invariants(body_lines: Sequence[str]) -> list[str]: | |
| return invariants | ||
|
|
||
|
|
||
| def find_java() -> str: | ||
| """Find a Java runtime, matching the repo's justfile fallback behavior.""" | ||
| java_home = os.environ.get("JAVA_HOME") | ||
| candidates = [ | ||
| os.environ.get("JAVA_BIN"), | ||
| os.path.join(java_home, "bin", "java") if java_home else None, | ||
| "/opt/homebrew/opt/openjdk/bin/java", | ||
| "/usr/local/opt/openjdk/bin/java", | ||
| "java", | ||
| ] | ||
| for candidate in candidates: | ||
| if not candidate: | ||
| continue | ||
| java_bin = shutil.which(candidate) if os.path.basename(candidate) == candidate else candidate | ||
| if not java_bin: | ||
| continue | ||
| if not os.path.exists(java_bin): | ||
| continue | ||
| proc = subprocess.run( | ||
| [java_bin, "-version"], | ||
| stdout=subprocess.DEVNULL, | ||
| stderr=subprocess.DEVNULL, | ||
| ) | ||
|
Comment on lines
+95
to
+99
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Useful? React with 👍 / 👎. |
||
| if proc.returncode == 0: | ||
| return java_bin | ||
| raise RuntimeError( | ||
| "Java runtime not found. Install OpenJDK (e.g. 'brew install openjdk') or set JAVA_BIN." | ||
| ) | ||
|
macroscopeapp[bot] marked this conversation as resolved.
|
||
|
|
||
|
|
||
| def run_one(jar: pathlib.Path, tla_file: pathlib.Path, cfg_lines: Sequence[str], invariant: str) -> None: | ||
| before, _body, after = split_cfg_sections(cfg_lines) | ||
| rendered = before + ["INVARIANTS", f" {invariant}"] + after | ||
|
|
@@ -81,8 +113,9 @@ def run_one(jar: pathlib.Path, tla_file: pathlib.Path, cfg_lines: Sequence[str], | |
| tmp_cfg = pathlib.Path(fh.name) | ||
|
|
||
| try: | ||
| java_bin = find_java() | ||
| cmd = [ | ||
| "java", | ||
| java_bin, | ||
| "-cp", | ||
| str(jar), | ||
| "tlc2.TLC", | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
find_java()now probes hardcoded absolute paths by callingsubprocess.rundirectly, but when/opt/homebrew/opt/openjdk/bin/java(or/usr/local/opt/openjdk/bin/java) is absent—as on most Linux CI hosts—subprocess.runraisesFileNotFoundErrorand aborts immediately instead of falling through tojavaonPATH. This makesscripts/verify_tla_coverage.pyfail even when Java is installed, unlike thejustfilefallback loop that checks candidate executables before invoking them.Useful? React with 👍 / 👎.