| 260 | |
| 261 | |
| 262 | def resolve_store_db_path(tracedecay_bin, fixture, env): |
| 263 | result = run( |
| 264 | [tracedecay_bin, "status", "--runtime", "--json"], |
| 265 | cwd=fixture, |
| 266 | env=env, |
| 267 | timeout=120, |
| 268 | check=False, |
| 269 | ) |
| 270 | if result.returncode != 0: |
| 271 | sys.exit( |
| 272 | "failed to resolve TraceDecay store path with status --runtime --json\n" |
| 273 | f"{result.stdout}" |
| 274 | ) |
| 275 | try: |
| 276 | payload = json.loads(result.stdout) |
| 277 | except json.JSONDecodeError as exc: |
| 278 | sys.exit(f"invalid status --runtime --json output while resolving store path: {exc}") |
| 279 | |
| 280 | db_path = payload.get("database", {}).get("db_path") or payload.get("db_path") |
| 281 | if not db_path: |
| 282 | sys.exit("status --runtime --json did not report database.db_path") |
| 283 | return Path(db_path) |
| 284 | |
| 285 | |
| 286 | def build_fixture(scenario, tracedecay_bin, env): |