|
16 | 16 | # `go install` — the version must be pinned and reproducible. |
17 | 17 | # |
18 | 18 | # Env: |
19 | | -# VEXE path to the V compiler (default: ./v then ./vnew) |
20 | | -# H2SPEC_BIN path to the h2spec binary (default: h2spec on PATH) |
21 | | -# H2SPEC_PORT port for the target server (default: 18443) |
22 | | -# VFLAGS_CC extra V flags, e.g. '-cc gcc' (mbedtls needs a real C compiler) |
| 19 | +# VEXE path to the V compiler (default: ./v then ./vnew) |
| 20 | +# H2SPEC_BIN path to the h2spec binary (default: h2spec on PATH) |
| 21 | +# H2SPEC_PORT port for the target server (default: 18443) |
| 22 | +# H2SPEC_TIMEOUT h2spec per-case timeout, seconds (default: 5). Several h2spec |
| 23 | +# cases wait for the server's GOAWAY/close and FLAKE at h2spec's |
| 24 | +# 2s default under load; 5s is comfortably stable here. Raise it |
| 25 | +# if a timing case still flakes on a slow runner. |
| 26 | +# VFLAGS_CC extra V flags, e.g. '-cc gcc' (mbedtls needs a real C compiler) |
23 | 27 |
|
24 | 28 | set -uo pipefail |
| 29 | +orig_pwd="$(pwd)" # the caller's cwd, captured BEFORE we cd into the script dir |
25 | 30 | cd "$(dirname "$0")" |
26 | 31 | here="$(pwd)" |
27 | 32 | repo_root="$(cd ../../../.. && pwd)" |
28 | 33 |
|
| 34 | +# resolve a caller-supplied path argument: an absolute path or a bare command name |
| 35 | +# (PATH lookup, e.g. "h2spec") is used as-is; a relative path is resolved against |
| 36 | +# the caller's original cwd, since we cd'd into the script dir above. Without this, |
| 37 | +# a documented value like `VEXE=./vnew` (relative to the repo root) would wrongly |
| 38 | +# resolve to vlib/net/http/h2spec/vnew and the build would fail. (Codex P1/P3.) |
| 39 | +resolve_path() { |
| 40 | + case "$1" in |
| 41 | + /*) printf '%s' "$1" ;; # absolute path |
| 42 | + */*) printf '%s' "$orig_pwd/$1" ;; # relative path containing a slash |
| 43 | + *) printf '%s' "$1" ;; # bare name -> PATH lookup |
| 44 | + esac |
| 45 | +} |
| 46 | + |
29 | 47 | VEXE="${VEXE:-}" |
30 | 48 | if [ -z "$VEXE" ]; then |
31 | 49 | if [ -x "$repo_root/v" ]; then VEXE="$repo_root/v"; elif [ -x "$repo_root/vnew" ]; then VEXE="$repo_root/vnew"; else VEXE="v"; fi |
| 50 | +else |
| 51 | + VEXE="$(resolve_path "$VEXE")" |
32 | 52 | fi |
33 | | -H2SPEC_BIN="${H2SPEC_BIN:-h2spec}" |
| 53 | +H2SPEC_BIN="$(resolve_path "${H2SPEC_BIN:-h2spec}")" |
34 | 54 | PORT="${H2SPEC_PORT:-18443}" |
| 55 | +TIMEOUT="${H2SPEC_TIMEOUT:-5}" |
35 | 56 | SERVER_BIN="$here/h2spec_server.bin" |
36 | 57 | EXPECTED="$here/h2spec_expected_failures.txt" |
37 | 58 |
|
@@ -64,7 +85,7 @@ echo "==> running h2spec (TLS, insecure cert OK)" |
64 | 85 | # contract, unlike the pretty console output. A failing case has a <failure> |
65 | 86 | # (or <error>) child; we use "classname :: name" as the stable case ID. |
66 | 87 | report_xml="$here/h2spec_report.xml" |
67 | | -"$H2SPEC_BIN" -t -k -h 127.0.0.1 -p "$PORT" --junit-report "$report_xml" 2>&1 | tail -40 || true |
| 88 | +"$H2SPEC_BIN" -t -k -h 127.0.0.1 -p "$PORT" --timeout "$TIMEOUT" --junit-report "$report_xml" 2>&1 | tail -40 || true |
68 | 89 | if [ ! -s "$report_xml" ]; then |
69 | 90 | echo "ERROR: h2spec produced no JUnit report ($report_xml); check the flags/version." >&2 |
70 | 91 | exit 2 |
@@ -92,9 +113,13 @@ if [ -n "$new_failures" ]; then |
92 | 113 | rc=1 |
93 | 114 | fi |
94 | 115 | if [ -n "$now_passing" ]; then |
95 | | - echo "::warning:: these recorded failures now PASS — remove them from h2spec_expected_failures.txt:" >&2 |
| 116 | + # Fail too (not just warn): a recorded failure that now passes must be removed |
| 117 | + # from the baseline, otherwise the gate keeps allowing that case and a later |
| 118 | + # PR can reintroduce the failure unnoticed. (Codex P2.) The 37 baseline cases |
| 119 | + # are deterministic at H2SPEC_TIMEOUT=5, so this does not flap. |
| 120 | + echo "::error:: these recorded failures now PASS — remove them from h2spec_expected_failures.txt to keep the gate honest:" >&2 |
96 | 121 | echo "$now_passing" >&2 |
97 | | - # Treat as a (soft) failure so the baseline is tightened; flip to rc=1 once green. |
| 122 | + rc=1 |
98 | 123 | fi |
99 | 124 | [ "$rc" -eq 0 ] && echo "==> h2spec: no regressions vs baseline" |
100 | 125 | exit "$rc" |
0 commit comments