Flush queued IDE writes and restart validation after host revision changes

This commit is contained in:
2026-11-13 20:53:22 +01:00
parent 8be0aec287
commit 1856f69637
11 changed files with 284 additions and 2 deletions
+17 -2
View File
@@ -11,6 +11,7 @@ import signal
import subprocess
import sys
import time
import tempfile
import zipfile
from native_crashes import NativeCrashGuard, descendant_workers, await_worker_exit
@@ -19,16 +20,26 @@ p = argparse.ArgumentParser(description=__doc__)
p.add_argument("--java-home", type=Path, required=True)
p.add_argument("--target-java-home", type=Path, required=True)
p.add_argument("--idea-home", type=Path, required=True)
p.add_argument("--mode", choices=["all", "classpath", "modulepath"], default="all")
p.add_argument("--repeat", type=int, default=1, help="Consecutive independent runs per mode")
args = p.parse_args()
if args.repeat < 1:
p.error("--repeat must be positive")
output = ROOT / "target/ide-workflow"
output.mkdir(parents=True, exist_ok=True)
for mode in ("classpath", "modulepath"):
batch = Path(tempfile.mkdtemp(prefix="runs-", dir=output))
print("Host evidence: " + str(batch), flush=True)
modes = ("classpath", "modulepath") if args.mode == "all" else (args.mode,)
for run_number, mode in ((n, mode) for n in range(1, args.repeat + 1) for mode in modes):
crashes = NativeCrashGuard(ROOT)
launch = subprocess.run([sys.executable, ROOT / "scripts/run-fixture-host.py", "intellij",
"--check", "--mode", mode, "--java-home", args.java_home,
"--target-java-home", args.target_java_home, "--idea-home", args.idea_home],
cwd=ROOT, text=True, capture_output=True, check=True, timeout=60)
evidence = batch / f"{mode}-run-{run_number}"
evidence.mkdir(exist_ok=True)
(output / (mode + "-launch.log")).write_text(launch.stdout + launch.stderr)
(evidence / "launch.log").write_text(launch.stdout + launch.stderr)
base = Path(re.search(r"Disposable host: (.+)", launch.stdout)[1])
pid = int(re.search(r"Host PID: (\d+)", launch.stdout)[1])
try:
@@ -60,7 +71,11 @@ for mode in ("classpath", "modulepath"):
"result": (base / "SUCCESS.txt").read_text()}
(output / (mode + ".json")).write_text(json.dumps(proof, indent=2) + "\n")
shutil.copyfile(base / "intellij.png", output / (mode + ".png"))
(evidence / "proof.json").write_text(json.dumps(proof, indent=2) + "\n")
finally:
for name in ("SUCCESS.txt", "FAILURE.txt", "ui-state.txt", "launcher.log"):
if (base / name).exists():
shutil.copyfile(base / name, evidence / name)
workers = descendant_workers(pid)
try:
os.kill(pid, signal.SIGTERM)
@@ -68,4 +83,4 @@ for mode in ("classpath", "modulepath"):
pass
await_worker_exit(workers)
crashes.check()
print("PASS registered IntelliJ " + mode + " editor, exclusive JavaFX 26 natives and worker shutdown", flush=True)
print("PASS registered IntelliJ " + mode + f" run {run_number}: editor, exclusive JavaFX 26 natives and worker shutdown", flush=True)
+29
View File
@@ -0,0 +1,29 @@
#!/usr/bin/env python3
"""Force a host revision to overtake in-flight target validation in the shared Kit."""
import argparse
import os
from pathlib import Path
import subprocess
import sys
import tempfile
ROOT = Path(__file__).resolve().parent.parent
p = argparse.ArgumentParser(description=__doc__)
p.add_argument('--java-home', type=Path, required=True)
p.add_argument('--target-java-home', type=Path, required=True)
args = p.parse_args()
classpath = os.pathsep.join([
str(ROOT / 'designer-standalone/target/test-classes'),
str(ROOT / 'designer-standalone/target/classes'),
(ROOT / 'designer-standalone/target/smoke-classpath.txt').read_text().strip()])
with tempfile.TemporaryDirectory(prefix='designer-render-race-') as tmp:
fixture = Path(tmp) / 'project'
subprocess.run([sys.executable, ROOT / 'scripts/prepare-fixture-host.py',
'--destination', fixture, '--mode', 'modulepath',
'--target-java-home', args.target_java_home], check=True)
subprocess.run([args.java_home / 'bin/java', '--enable-native-access=ALL-UNNAMED',
'-Ddesigner.check.racesOnly=true', '-cp', classpath,
'de.neitzel.fxdesigner.standalone.KitWorkflowSmoke',
fixture / '.neitzel-fx-designer/host.properties',
fixture / 'app/src/main/resources/fixture/components/Person.fxml',
Path(tmp) / 'unused.png'], check=True, timeout=90, cwd=ROOT)