agent-formal-verify 0.4.8 → 0.4.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,172 +1,9 @@
1
1
  #!/bin/bash
2
2
  # Copyright (c) 2026 Michael Denyer
3
3
  # SPDX-License-Identifier: GPL-3.0-only
4
- # Model-checks TLA+ specs with TLC over a matrix of constants read from a
5
- # matrix file, and prints one PASS or FAIL line per run with its distinct
6
- # state count, then a SUMMARY line with the totals. A failing run prints TLC's
7
- # error and its error trace reduced to the variables each step changed
8
- # (tlc-trace.py).
9
- #
10
- # Matrix file, one directive per line (# starts a comment):
11
- # spec <path.tla> the spec for the runs below, relative to the file;
12
- # TLC checks the formula it names Spec
13
- # check <cfg line> an INVARIANTS or PROPERTIES line, kept until the next spec
14
- # reach <Operator> | <label-substring> a witness in the first matching run
15
- # run <label> | <Name=Value ...> one TLC run with those CONSTANTS
16
- #
4
+ # Model-checks TLA+ specs with TLC over a matrix of constants. tlc.py holds the
5
+ # runner and documents the matrix file and its environment settings.
17
6
  # Usage: tlc-matrix.sh <matrix-file> [label-substring]
18
- # TLC_JAR=<path> use this existing tla2tools.jar
19
- # TLC_CACHE=<dir> where the pinned jar lives (default ~/.cache/tla)
20
- # JAVA=<path> the java binary (default: java on PATH)
21
- # TLC_WORKERS=<n> TLC worker threads (default auto)
22
- set -uo pipefail
23
- HERE=$(cd "$(dirname "$0")" && pwd)
24
- # shellcheck source=skills/formal-verify/scripts/tlc-tools.sh
25
- source "$HERE/tlc-tools.sh"
26
- TLC_WORKERS=${TLC_WORKERS:-auto}
27
-
28
7
  [ "$#" -ge 1 ] && [ "$#" -le 2 ] || { echo "usage: tlc-matrix.sh <matrix-file> [label-substring]"; exit 2; }
29
- matrix=$1
30
- [ -f "$matrix" ] || { echo "FAIL $matrix does not exist"; exit 1; }
31
- only=${2:-}
32
- MATRIX_DIR=$(cd "$(dirname "$matrix")" && pwd)
33
-
34
- require_tlc_runtime || exit $?
35
- tlc_jar_ready || exit $?
36
-
37
- OUT=$(mktemp -d)
38
- trap 'rm -rf "$OUT"' EXIT
39
- fail=0
40
- run=0
41
- passed=0
42
- total=0
43
- spec=""
44
- checks=""
45
- reaches=()
46
- runs=()
47
- reach_count=0
48
- reach_passed=0
49
-
50
- check_run() {
51
- local label=$1 consts=$2 operator=${3:-} name dir pairs c states wrapper invariant status trace
52
- local workers=$TLC_WORKERS extra=()
53
- [ -n "$spec" ] || { echo "FAIL run '$label' before any spec line"; fail=1; return; }
54
- case $label in *"$only"*) ;; *) return ;; esac
55
- if [ -n "$operator" ]; then reach_count=$((reach_count + 1)); else run=$((run + 1)); fi
56
- name=$(basename "$spec" .tla)
57
- [ -f "$MATRIX_DIR/$spec" ] || { echo "FAIL $name $label: spec $spec not found"; fail=1; return; }
58
- # A directory per run, so a run sees only the modules beside its own spec.
59
- dir=$(mktemp -d "$OUT/run.XXXXXX")
60
- cp "$MATRIX_DIR/$(dirname "$spec")"/*.tla "$dir/"
61
- wrapper=$name
62
- if [ -n "$operator" ]; then
63
- # Neither generated identifier may shadow an imported declaration or module.
64
- while :; do
65
- wrapper=Reach$(python3 -c 'import uuid; print(uuid.uuid4().hex)')
66
- invariant=${wrapper}Negated
67
- grep -Ewq "$wrapper|$invariant" "$dir/"*.tla || break
68
- done
69
- printf '%s\n' "---- MODULE $wrapper ----" "EXTENDS $name" "$invariant == ~$operator" "====" > "$dir/$wrapper.tla"
70
- workers=1
71
- extra=(-deadlock)
72
- fi
73
- read -ra pairs <<< "$consts"
74
- {
75
- echo "CONSTANTS"
76
- # bash 3.2 treats an empty array as unset under set -u.
77
- for c in ${pairs[@]+"${pairs[@]}"}; do echo " ${c%%=*} = ${c#*=}"; done
78
- echo "SPECIFICATION Spec"
79
- if [ -n "$operator" ]; then echo "INVARIANT $invariant"; else printf '%s\n' "$checks"; fi
80
- } > "$dir/MC.cfg"
81
- status=0
82
- "$JAVA" -XX:+UseParallelGC -cp "$TLC_JAR" tlc2.TLC -workers "$workers" ${extra[@]+"${extra[@]}"} -cleanup -metadir "$dir/states" \
83
- -config "$dir/MC.cfg" "$dir/$wrapper.tla" > "$dir/tlc.log" 2>&1 || status=$?
84
- if [ -n "$operator" ]; then
85
- if [ "$status" -eq 12 ] && grep -Fxq "Error: Invariant $invariant is violated by the initial state:" "$dir/tlc.log"; then
86
- trace=1
87
- elif [ "$status" -eq 12 ] && grep -Fxq "Error: Invariant $invariant is violated." "$dir/tlc.log"; then
88
- trace=$(grep -c '^State [0-9][0-9]*:' "$dir/tlc.log")
89
- else
90
- trace=0
91
- fi
92
- if [ "$trace" -gt 0 ]; then
93
- echo "PASS $name reach $operator $label: shortest trace $trace states ($((trace - 1)) transitions)"
94
- reach_passed=$((reach_passed + 1))
95
- elif [ "$status" -eq 0 ] && grep -q "No error has been found" "$dir/tlc.log"; then
96
- echo "FAIL $name reach $operator $label: the model never reaches this state"
97
- fail=1
98
- else
99
- echo "FAIL $name reach $operator $label: TLC did not complete the reach check"
100
- cat "$dir/tlc.log"
101
- fail=1
102
- fi
103
- elif [ "$status" -eq 0 ] && grep -q "No error has been found" "$dir/tlc.log"; then
104
- # Progress lines carry interim counts; the last match is the final one.
105
- states=$(grep -o '[0-9,]* distinct states found' "$dir/tlc.log" | tail -1)
106
- echo "PASS $name $label $states"
107
- passed=$((passed + 1))
108
- states=${states%% *}
109
- states=${states//,/}
110
- total=$((total + ${states:-0}))
111
- else
112
- echo "FAIL $name $label: $(grep -m1 "^Error:" "$dir/tlc.log")"
113
- grep "^Error:" "$dir/tlc.log" | sed -n '2,5p'
114
- python3 "$HERE/tlc-trace.py" "$dir/tlc.log" || grep -v '^[[:space:]]*$' "$dir/tlc.log" | tail -40
115
- fail=1
116
- fi
117
- }
118
-
119
- check_reaches() {
120
- local reach entry operator match label found
121
- for reach in ${reaches[@]+"${reaches[@]}"}; do
122
- operator=${reach%%|*}; match=${reach#*|}; found=0
123
- for entry in ${runs[@]+"${runs[@]}"}; do
124
- label=${entry%%|*}
125
- case $label in
126
- *"$match"*) check_run "$label" "${entry#*|}" "$operator"; found=1; break ;;
127
- esac
128
- done
129
- if [ "$found" -eq 0 ]; then
130
- echo "FAIL $(basename "$spec" .tla) reach $operator: no run matching '$match'"
131
- reach_count=$((reach_count + 1))
132
- fail=1
133
- fi
134
- done
135
- }
136
-
137
- while IFS= read -r line || [ -n "$line" ]; do
138
- line=${line%%#*}
139
- [[ $line =~ [^[:space:]] ]] || continue
140
- read -r kw rest <<< "$line"
141
- case $kw in
142
- spec) check_reaches; spec=$rest; checks=""; reaches=(); runs=() ;;
143
- check)
144
- [ -n "$spec" ] || { echo "FAIL check '$rest' before any spec line"; fail=1; continue; }
145
- read -r kind names <<< "$rest"
146
- case $kind in
147
- INVARIANT|INVARIANTS|PROPERTY|PROPERTIES)
148
- [ -n "$names" ] || { echo "FAIL malformed check '$rest'"; fail=1; continue; } ;;
149
- *) echo "FAIL malformed check '$rest'"; fail=1; continue ;;
150
- esac
151
- checks="$checks${checks:+$'\n'}$rest" ;;
152
- reach)
153
- [ -n "$spec" ] || { echo "FAIL reach '$rest' before any spec line"; fail=1; continue; }
154
- if [[ $rest =~ ^([a-zA-Z_][a-zA-Z_0-9]*)[[:space:]]*\|[[:space:]]*(.*[^[:space:]])[[:space:]]*$ ]]; then
155
- reaches+=("${BASH_REMATCH[1]}|${BASH_REMATCH[2]}")
156
- else
157
- echo "FAIL malformed reach '$rest': expected reach <Operator> | <label-substring>"
158
- fail=1
159
- fi ;;
160
- run)
161
- [[ $rest == *"|"* ]] || { echo "FAIL run '$rest' has no | before its constants"; fail=1; continue; }
162
- label=${rest%%|*}; label=${label% }; runs+=("$label|${rest#*|}"); check_run "$label" "${rest#*|}" ;;
163
- *) echo "FAIL unknown directive: $line"; fail=1 ;;
164
- esac
165
- done < "$matrix"
166
- check_reaches
167
-
168
- [ "$run" -gt 0 ] || { echo "FAIL no run ${only:+matching '$only' }in $matrix"; exit 1; }
169
- summary="SUMMARY $passed of $run runs passed"
170
- [ "$reach_count" -eq 0 ] || summary="$summary, $reach_passed of $reach_count reach checks passed"
171
- echo "$summary, $total distinct states in total"
172
- exit $fail
8
+ command -v python3 > /dev/null || { echo "UNAVAILABLE python3 is not on PATH; install Python 3"; exit 3; }
9
+ exec python3 "$(dirname "$0")/tlc.py" "$@"
@@ -0,0 +1,328 @@
1
+ #!/usr/bin/env python3
2
+ # Copyright (c) 2026 Michael Denyer
3
+ # SPDX-License-Identifier: GPL-3.0-only
4
+ """Model-check TLA+ specs with TLC over a matrix of constants read from a matrix file.
5
+
6
+ Prints one PASS or FAIL line per run with its distinct state count, then a
7
+ SUMMARY line with the totals. A failing run prints TLC's error and its error
8
+ trace reduced to the variables each step changed (tlc-trace.py).
9
+
10
+ Matrix file, one directive per line (# starts a comment):
11
+ spec <path.tla> the spec for the runs below, relative to the file;
12
+ TLC checks the formula it names Spec
13
+ check <cfg line> an INVARIANTS or PROPERTIES line, kept until the next spec
14
+ reach <Operator> | <label-substring> a witness in the first matching run
15
+ run <label> | <Name=Value ...> one TLC run with those CONSTANTS
16
+
17
+ A malformed directive prints a FAIL line and the runner goes on to the next.
18
+
19
+ Usage: tlc-matrix.sh <matrix-file> [label-substring]
20
+ TLC_JAR=<path> use this existing tla2tools.jar
21
+ TLC_CACHE=<dir> where the pinned jar lives (default ~/.cache/tla)
22
+ JAVA=<path> the java binary (default: java on PATH)
23
+ TLC_WORKERS=<n> TLC worker threads (default auto)
24
+ """
25
+ from __future__ import annotations
26
+
27
+ import os
28
+ import re
29
+ import subprocess
30
+ import sys
31
+ import tempfile
32
+ import uuid
33
+ from dataclasses import dataclass
34
+ from enum import Enum
35
+ from pathlib import Path
36
+
37
+ HERE = Path(__file__).resolve().parent
38
+ CHECK_KINDS = ("INVARIANT", "INVARIANTS", "PROPERTY", "PROPERTIES")
39
+ REACH = re.compile(r"([a-zA-Z_][a-zA-Z_0-9]*)\s*\|\s*(.*\S)\s*")
40
+
41
+
42
+ def read_raw(path):
43
+ """Return a file's text as bash reads it: line ends untouched, a byte that is not UTF-8 replaced."""
44
+ with open(path, encoding="utf-8", errors="replace", newline="") as stream:
45
+ return stream.read()
46
+
47
+
48
+ @dataclass(frozen=True)
49
+ class Spec:
50
+ path: str
51
+
52
+
53
+ @dataclass(frozen=True)
54
+ class Check:
55
+ line: str
56
+ kind: str
57
+ names: tuple
58
+
59
+
60
+ @dataclass(frozen=True)
61
+ class Reach:
62
+ operator: str
63
+ match: str
64
+
65
+
66
+ @dataclass(frozen=True)
67
+ class Run:
68
+ label: str
69
+ constants: str
70
+
71
+
72
+ @dataclass(frozen=True)
73
+ class Malformed:
74
+ message: str
75
+
76
+
77
+ def directives(lines):
78
+ """Yield each directive of a matrix in file order, with a Malformed in place of a line it rejects."""
79
+ seen_spec = False
80
+ for raw in lines:
81
+ line = raw.split("#", 1)[0]
82
+ if not line.strip():
83
+ continue
84
+ keyword, rest = (line.split(None, 1) + [""])[:2]
85
+ rest = rest.strip()
86
+ if keyword == "spec":
87
+ seen_spec = bool(rest)
88
+ yield Spec(rest)
89
+ elif keyword == "check":
90
+ kind, names = (rest.split(None, 1) + ["", ""])[:2]
91
+ if not seen_spec:
92
+ yield Malformed(f"check '{rest}' before any spec line")
93
+ elif kind not in CHECK_KINDS or not names.strip():
94
+ yield Malformed(f"malformed check '{rest}'")
95
+ else:
96
+ yield Check(rest, kind, tuple(names.split()))
97
+ elif keyword == "reach":
98
+ match = REACH.fullmatch(rest)
99
+ if not seen_spec:
100
+ yield Malformed(f"reach '{rest}' before any spec line")
101
+ elif not match:
102
+ yield Malformed(f"malformed reach '{rest}': expected reach <Operator> | <label-substring>")
103
+ else:
104
+ yield Reach(match[1], match[2])
105
+ elif keyword == "run":
106
+ label, bar, constants = rest.partition("|")
107
+ if not bar:
108
+ yield Malformed(f"run '{rest}' has no | before its constants")
109
+ elif not seen_spec:
110
+ yield Malformed(f"run '{label.removesuffix(' ')}' before any spec line")
111
+ else:
112
+ yield Run(label.removesuffix(" "), constants)
113
+ else:
114
+ yield Malformed(f"unknown directive: {line}")
115
+
116
+
117
+ class Unavailable(Exception):
118
+ pass
119
+
120
+
121
+ class Tlc:
122
+ """The pinned TLC, checked once; tlc-tools.sh owns the pin and the readiness checks."""
123
+
124
+ def __init__(self):
125
+ done = subprocess.run(
126
+ ["bash", "-c", 'source "$1/tlc-tools.sh" && require_tlc_runtime && tlc_jar_ready && printf "%s\\n%s\\n" "$JAVA" "$TLC_JAR"',
127
+ "bash", str(HERE)], capture_output=True, text=True, check=False)
128
+ if done.returncode:
129
+ raise Unavailable(done.stdout.rstrip("\n"))
130
+ self.java, self.jar = done.stdout.splitlines()[-2:]
131
+ self.workers = os.environ.get("TLC_WORKERS") or "auto"
132
+
133
+ def run(self, directory, module, config, reach):
134
+ """Run TLC on module in directory with config; return its exit status and log."""
135
+ log = directory / "tlc.log"
136
+ (directory / "MC.cfg").write_text(config, encoding="utf-8")
137
+ command = [self.java, "-XX:+UseParallelGC", "-cp", self.jar, "tlc2.TLC", "-workers", "1" if reach else self.workers,
138
+ *(["-deadlock"] if reach else []), "-cleanup", "-metadir", str(directory / "states"),
139
+ "-config", str(directory / "MC.cfg"), str(directory / f"{module}.tla")]
140
+ with log.open("w", encoding="utf-8") as stream:
141
+ status = subprocess.run(command, stdout=stream, stderr=subprocess.STDOUT, check=False).returncode
142
+ return status, read_raw(log)
143
+
144
+
145
+ class Outcome(Enum):
146
+ PASS = "pass"
147
+ FAIL = "fail"
148
+ MISSING = "missing"
149
+ WITNESS = "witness"
150
+ UNREACHED = "unreached"
151
+ INCOMPLETE = "incomplete"
152
+ NO_RUN = "no run"
153
+ MALFORMED = "malformed"
154
+
155
+
156
+ @dataclass(frozen=True)
157
+ class Result:
158
+ """One line of the runner's report and the output printed under it."""
159
+ outcome: Outcome
160
+ name: str = ""
161
+ label: str = ""
162
+ operator: str = ""
163
+ detail: str = ""
164
+ lines: tuple = ()
165
+
166
+
167
+ @dataclass(frozen=True)
168
+ class Task:
169
+ spec: str
170
+ run: Run
171
+ checks: tuple = ()
172
+ reach: Reach | None = None
173
+
174
+
175
+ def execution_plan(directives):
176
+ """Snapshot each run's effective checks and resolve each reach to its first matching run."""
177
+ spec, checks, reaches, runs = "", [], [], []
178
+
179
+ def reach_tasks():
180
+ for reach in reaches:
181
+ run = next((run for run in runs if reach.match in run.label), None)
182
+ if run is None:
183
+ yield Result(Outcome.NO_RUN, Path(spec).name.removesuffix(".tla"), operator=reach.operator, detail=reach.match)
184
+ else:
185
+ yield Task(spec, run, reach=reach)
186
+
187
+ for directive in directives:
188
+ if isinstance(directive, Spec):
189
+ yield from reach_tasks()
190
+ spec, checks, reaches, runs = directive.path, [], [], []
191
+ elif isinstance(directive, Check):
192
+ checks.append(directive)
193
+ elif isinstance(directive, Reach):
194
+ reaches.append(directive)
195
+ elif isinstance(directive, Run):
196
+ runs.append(directive)
197
+ yield Task(spec, directive, tuple(checks))
198
+ else:
199
+ yield Result(Outcome.MALFORMED, detail=directive.message)
200
+ yield from reach_tasks()
201
+
202
+
203
+ def render(result):
204
+ """Return the lines the matrix runner prints for one result."""
205
+ name, label, operator = result.name, result.label, result.operator
206
+ head = {
207
+ Outcome.PASS: f"PASS {name} {label} {result.detail}",
208
+ Outcome.FAIL: f"FAIL {name} {label}: {result.detail}",
209
+ Outcome.MISSING: f"FAIL {name} {label}: spec {result.detail} not found",
210
+ Outcome.WITNESS: f"PASS {name} reach {operator} {label}: shortest trace {result.detail}",
211
+ Outcome.UNREACHED: f"FAIL {name} reach {operator} {label}: the model never reaches this state",
212
+ Outcome.INCOMPLETE: f"FAIL {name} reach {operator} {label}: TLC did not complete the reach check",
213
+ Outcome.NO_RUN: f"FAIL {name} reach {operator}: no run matching '{result.detail}'",
214
+ Outcome.MALFORMED: f"FAIL {result.detail}",
215
+ }[result.outcome]
216
+ return [head, *result.lines]
217
+
218
+
219
+ def reduced_trace(log_path, log):
220
+ done = subprocess.run([sys.executable, str(HERE / "tlc-trace.py"), str(log_path)], capture_output=True, text=True, check=False)
221
+ sys.stderr.write(done.stderr)
222
+ lines = done.stdout.removesuffix("\n").split("\n") if done.stdout else []
223
+ if done.returncode:
224
+ lines += [line for line in log.split("\n") if line.strip()][-40:]
225
+ return lines
226
+
227
+
228
+ class Runner:
229
+ """Runs a matrix's directives in order, as tlc-matrix.sh reads them, and reports each result to emit."""
230
+
231
+ def __init__(self, tlc, matrix_dir, only, emit, work):
232
+ self.tlc, self.matrix_dir, self.only, self.emit, self.work = tlc, matrix_dir, only, emit, work
233
+ self.runs_total = self.passed = self.states = self.reach_total = self.reached = 0
234
+ self.failed = False
235
+
236
+ def report(self, result):
237
+ self.failed |= result.outcome not in (Outcome.PASS, Outcome.WITNESS)
238
+ self.emit(result)
239
+
240
+ def check(self, task):
241
+ if isinstance(task, Result):
242
+ self.reach_total += task.outcome is Outcome.NO_RUN
243
+ self.report(task)
244
+ return
245
+ spec, run = task.spec, task.run
246
+ operator = task.reach.operator if task.reach else ""
247
+ if self.only not in run.label:
248
+ return
249
+ if operator:
250
+ self.reach_total += 1
251
+ else:
252
+ self.runs_total += 1
253
+ name = Path(spec).name.removesuffix(".tla")
254
+ if not (self.matrix_dir / spec).is_file():
255
+ self.report(Result(Outcome.MISSING, name, run.label, detail=spec))
256
+ return
257
+ directory = Path(tempfile.mkdtemp(prefix="run.", dir=self.work))
258
+ for module in (self.matrix_dir / spec).parent.glob("*.tla"):
259
+ (directory / module.name).write_bytes(module.read_bytes())
260
+ constants = "".join(f" {pair.split('=')[0]} = {pair.split('=', 1)[-1]}\n" for pair in run.constants.split())
261
+ config = f"CONSTANTS\n{constants}SPECIFICATION Spec\n"
262
+ if not operator:
263
+ status, log = self.tlc.run(directory, name, config + "\n".join(check.line for check in task.checks) + "\n", reach=False)
264
+ self.report(self.ordinary(name, run, status, log, directory / "tlc.log"))
265
+ return
266
+ wrapper = f"Reach{uuid.uuid4().hex}"
267
+ invariant = f"{wrapper}Negated"
268
+ (directory / f"{wrapper}.tla").write_text(f"---- MODULE {wrapper} ----\nEXTENDS {name}\n{invariant} == ~{operator}\n====\n", encoding="utf-8")
269
+ status, log = self.tlc.run(directory, wrapper, config + f"INVARIANT {invariant}\n", reach=True)
270
+ self.report(self.witness(name, run, operator, invariant, status, log))
271
+
272
+ def ordinary(self, name, run, status, log, log_path):
273
+ if status == 0 and "No error has been found" in log:
274
+ found = re.findall(r"[0-9,]* distinct states found", log)
275
+ states = found[-1] if found else ""
276
+ self.passed += 1
277
+ count = states.partition(" ")[0].replace(",", "")
278
+ self.states += int(count or 0)
279
+ return Result(Outcome.PASS, name, run.label, detail=states)
280
+ errors = [line for line in log.split("\n") if line.startswith("Error:")]
281
+ return Result(Outcome.FAIL, name, run.label, detail=errors[0] if errors else "",
282
+ lines=(*errors[1:5], *reduced_trace(log_path, log)))
283
+
284
+ def witness(self, name, run, operator, invariant, status, log):
285
+ lines = log.split("\n")
286
+ length = 0
287
+ if status == 12 and f"Error: Invariant {invariant} is violated by the initial state:" in lines:
288
+ length = 1
289
+ elif status == 12 and f"Error: Invariant {invariant} is violated." in lines:
290
+ length = sum(1 for line in lines if re.match(r"State [0-9]+:", line))
291
+ if length:
292
+ self.reached += 1
293
+ return Result(Outcome.WITNESS, name, run.label, operator, f"{length} states ({length - 1} transitions)")
294
+ if status == 0 and "No error has been found" in log:
295
+ return Result(Outcome.UNREACHED, name, run.label, operator)
296
+ return Result(Outcome.INCOMPLETE, name, run.label, operator, lines=tuple(log.removesuffix("\n").split("\n")) if log else ())
297
+
298
+
299
+ def main():
300
+ if not 2 <= len(sys.argv) <= 3:
301
+ print("usage: tlc-matrix.sh <matrix-file> [label-substring]")
302
+ return 2
303
+ matrix, only = sys.argv[1], sys.argv[2] if len(sys.argv) == 3 else ""
304
+ if not Path(matrix).is_file():
305
+ print(f"FAIL {matrix} does not exist")
306
+ return 1
307
+ try:
308
+ tlc = Tlc()
309
+ except Unavailable as error:
310
+ print(error)
311
+ return 3
312
+ with tempfile.TemporaryDirectory() as work:
313
+ runner = Runner(tlc, Path(matrix).resolve().parent, only, lambda result: print("\n".join(render(result)), flush=True), Path(work))
314
+ for task in execution_plan(directives(read_raw(matrix).split("\n"))):
315
+ runner.check(task)
316
+ if runner.runs_total == 0:
317
+ matching = f"matching '{only}' " if only else ""
318
+ print(f"FAIL no run {matching}in {matrix}")
319
+ return 1
320
+ summary = f"SUMMARY {runner.passed} of {runner.runs_total} runs passed"
321
+ if runner.reach_total:
322
+ summary += f", {runner.reached} of {runner.reach_total} reach checks passed"
323
+ print(f"{summary}, {runner.states} distinct states in total")
324
+ return int(runner.failed)
325
+
326
+
327
+ if __name__ == "__main__":
328
+ sys.exit(main())