|
| 1 | +#!/usr/bin/env bash |
| 2 | +# Mac M4 review aid for PR-N1 (no-test-doubles cleanup, scope = |
| 3 | +# verifier-protocol mirror classes). |
| 4 | +# |
| 5 | +# PR-N1 retired FakeVerifier, _LyingVerifier, _RegressingVerifier, |
| 6 | +# and _LyingFakeVerifier from the Linux test tree. Their dispatch / |
| 7 | +# state-mirror tests moved to tests/integration/test_coordinator_real.py |
| 8 | +# and tests/integration/test_generator_real.py, where they run |
| 9 | +# against the real Qwen3-0.6B SinkWindowVerifier instead of a |
| 10 | +# hand-coded mirror. This script runs that integration suite on |
| 11 | +# Apple Silicon and produces the JSON evidence reviewers commit. |
| 12 | +# |
| 13 | +# Produces 1 artifact: |
| 14 | +# |
| 15 | +# results/platform-tests/pr-n1-mac-integration-tests-<unix>.json |
| 16 | +# pytest -m integration tests/integration/ — coordinator and |
| 17 | +# generator integration tests against real Qwen3 + the existing |
| 18 | +# INV-3 byte-exact GA gate. Acceptance: all tests pass. |
| 19 | +# |
| 20 | +# Usage (from repo root, on Mac M4 / arm64): |
| 21 | +# |
| 22 | +# bash scripts/review_pr_n1_on_mac.sh |
| 23 | +# |
| 24 | +# Then commit: |
| 25 | +# |
| 26 | +# git add results/platform-tests/pr-n1-mac-* |
| 27 | +# git commit -m "Mac M4 review evidence for PR-N1" |
| 28 | +# git push |
| 29 | + |
| 30 | +set -euo pipefail |
| 31 | + |
| 32 | +ROOT="$(cd "$(dirname "$0")/.." && pwd)" |
| 33 | +cd "$ROOT" |
| 34 | + |
| 35 | +stamp="$(date +%s)" |
| 36 | +out_dir="results/platform-tests" |
| 37 | +mkdir -p "$out_dir" |
| 38 | + |
| 39 | +junit="$out_dir/pr-n1-mac-integration-tests-${stamp}.junit.xml" |
| 40 | +report="$out_dir/pr-n1-mac-integration-tests-${stamp}.json" |
| 41 | + |
| 42 | +echo "==> integration suite (PR-N1 migrated tests + INV-3 GA gate)" |
| 43 | +PYTHONPATH=.:sdks/python python3 -m pytest \ |
| 44 | + -m integration \ |
| 45 | + tests/integration/ \ |
| 46 | + --junitxml="$junit" \ |
| 47 | + -v |
| 48 | + |
| 49 | +PYTHONPATH=.:sdks/python python3 - "$junit" "$report" <<'PY' |
| 50 | +import json |
| 51 | +import platform |
| 52 | +import sys |
| 53 | +import xml.etree.ElementTree as ET |
| 54 | +
|
| 55 | +junit_path, out_path = sys.argv[1:3] |
| 56 | +jr = ET.parse(junit_path).getroot() |
| 57 | +
|
| 58 | +testsuites = list(jr.iter("testsuite")) |
| 59 | +total_tests = sum(int(ts.get("tests", "0")) for ts in testsuites) |
| 60 | +total_failures = sum(int(ts.get("failures", "0")) for ts in testsuites) |
| 61 | +total_errors = sum(int(ts.get("errors", "0")) for ts in testsuites) |
| 62 | +total_skipped = sum(int(ts.get("skipped", "0")) for ts in testsuites) |
| 63 | +
|
| 64 | +cases = [] |
| 65 | +for tc in jr.iter("testcase"): |
| 66 | + cases.append({ |
| 67 | + "classname": tc.get("classname"), |
| 68 | + "name": tc.get("name"), |
| 69 | + "time": float(tc.get("time", 0.0)), |
| 70 | + "outcome": ( |
| 71 | + "failed" if tc.find("failure") is not None |
| 72 | + else "errored" if tc.find("error") is not None |
| 73 | + else "skipped" if tc.find("skipped") is not None |
| 74 | + else "passed" |
| 75 | + ), |
| 76 | + }) |
| 77 | +
|
| 78 | +report = { |
| 79 | + "schema_version": 1, |
| 80 | + "kind": "pr_n1_mac_integration_tests", |
| 81 | + "host": { |
| 82 | + "platform": platform.platform(), |
| 83 | + "machine": platform.machine(), |
| 84 | + "python": platform.python_version(), |
| 85 | + }, |
| 86 | + "junit": { |
| 87 | + "tests": total_tests, |
| 88 | + "failures": total_failures, |
| 89 | + "errors": total_errors, |
| 90 | + "skipped": total_skipped, |
| 91 | + "cases": cases, |
| 92 | + }, |
| 93 | +} |
| 94 | +with open(out_path, "w", encoding="utf-8") as fh: |
| 95 | + json.dump(report, fh, indent=2) |
| 96 | +print(f" -> {out_path}") |
| 97 | +PY |
| 98 | + |
| 99 | +echo |
| 100 | +echo "==> Done. Commit:" |
| 101 | +echo " git add $out_dir/pr-n1-mac-*" |
| 102 | +echo " git commit -m 'Mac M4 review evidence for PR-N1'" |
| 103 | +echo " git push" |
0 commit comments