Просмотр исходного кода

fix(test): harden timing matrix and fuzz coverage

root 3 месяцев назад
Родитель
Сommit
89dbbad0db
2 измененных файлов с 22 добавлено и 6 удалено
  1. 12 2
      tools/run_fuzz_15m.sh
  2. 10 4
      tools/sdk_wheel_matrix.sh

+ 12 - 2
tools/run_fuzz_15m.sh

@@ -7,7 +7,13 @@ ROOT="$(cd "$(dirname "$0")/.." && pwd)"
 cd "$ROOT"
 export PATH="/data/prod2u/opt/go1.25.13/bin:/opt/python-3.12/bin:/usr/bin:/bin:${PATH}"
 export GOTOOLCHAIN="${GOTOOLCHAIN:-local}"
-export GOROOT="${GOROOT:-/data/prod2u/opt/go1.25.13}"
+if [[ -n "${GOROOT:-}" && ! -d "${GOROOT}" ]]; then
+  unset GOROOT
+fi
+if [[ -z "${GOROOT:-}" && -d /data/prod2u/opt/go1.25.13 ]]; then
+  export GOROOT=/data/prod2u/opt/go1.25.13
+fi
+PYTHON="${PYTHON:-python3}"
 SEC="${HTH_FUZZ_SECONDS:-900}"
 fail=0
 run_one() {
@@ -25,11 +31,15 @@ run_one fuzz-6400-decode go test ./internal/protocol6400 -fuzz='^FuzzDecode$' -f
 run_one fuzz-6400-parser go test ./internal/protocol6400 -fuzz='^FuzzStreamParser$' -fuzztime="${SEC}s"
 run_one fuzz-profile go test ./internal/profile -fuzz='^FuzzLoadStrict$' -fuzztime="${SEC}s"
 run_one fuzz-config go test ./internal/config -fuzz='^FuzzLoadYAML$' -fuzztime="${SEC}s"
+run_one fuzz-config-sockets go test ./internal/config -fuzz='^FuzzSocketPaths$' -fuzztime="${SEC}s"
 run_one fuzz-assemble go test ./internal/safety -fuzz='^FuzzAssemble$' -fuzztime="${SEC}s"
 run_one fuzz-assemble-proto go test ./internal/safety -fuzz='^FuzzAssembleProto$' -fuzztime="${SEC}s"
 run_one fuzz-telemetry go test ./internal/telemetry -fuzz='^FuzzResumeIDs$' -fuzztime="${SEC}s"
+run_one fuzz-telemetry-subscribe go test ./internal/telemetry -fuzz='^FuzzSubscribeResume$' -fuzztime="${SEC}s"
 run_one fuzz-action-record go test ./internal/device -fuzz='^FuzzActionRecordConversion$' -fuzztime="${SEC}s"
 run_one fuzz-capture go test ./internal/capture -fuzz='^FuzzReadRecords$' -fuzztime="${SEC}s"
+run_one fuzz-capture-manifest go test ./internal/capture -fuzz='^FuzzReadManifest$' -fuzztime="${SEC}s"
 run_one fuzz-replay go test ./internal/backend -fuzz='^FuzzReplayOpen$' -fuzztime="${SEC}s"
-run_one fuzz-sdk-descriptor env HTH_FUZZ_SECONDS="${SEC}" python3.12 -m pytest -q sdk/python/tests/test_descriptor_fuzz.py
+run_one fuzz-thermal-replay go test ./internal/thermalbackend -fuzz='^FuzzThermalReplayOpen$' -fuzztime="${SEC}s"
+run_one fuzz-sdk-descriptor env HTH_FUZZ_SECONDS="${SEC}" "${PYTHON}" -m pytest -q sdk/python/tests/test_descriptor_fuzz.py
 exit "${fail}"

+ 10 - 4
tools/sdk_wheel_matrix.sh

@@ -256,7 +256,10 @@ async def main():
         await asyncio.sleep(0.25)
         async with await client.acquire_lease("prod2u-0", "timing", timedelta(seconds=20), auto_renew=True) as lease:
             rejected = False
-            for _ in range(25):
+            attempts = 0
+            deadline = time.monotonic() + 12.0
+            while time.monotonic() < deadline:
+                attempts += 1
                 snap = await client.get_snapshot("prod2u-0")
                 b = _fill(prod2u.builder("prod2u-0", capabilities=caps).based_on(snap.snapshot_seq, snap.control_revision), caps, snap)
                 batch = b.valid_for(timedelta(seconds=2)).build()
@@ -270,11 +273,14 @@ async def main():
                         break
                     raise
                 dt = time.monotonic() - t0
-                if (not res.accepted) and dt < 0.8:
+                reason = str(getattr(res, "reject_reason", ""))
+                if (not res.accepted) and dt < 0.8 and "EXPIRED_DEADLINE" in reason:
                     rejected = True
                     break
-                await asyncio.sleep(0.05)
-            assert rejected, "2s deadline must be rejected during 5s GET_TEMPERATURE"
+                await asyncio.sleep(0.1)
+            assert rejected, (
+                f"2s deadline must be rejected during 5s GET_TEMPERATURE; attempts={attempts}"
+            )
             ok = 0
             for i in range(3):
                 snap = await client.get_snapshot("prod2u-0")