run_fuzz_15m.sh 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #!/usr/bin/env bash
  2. # 15-minute fuzz for each required target. Exit 0 only if every target PASS.
  3. # -fuzz names are anchored; Go treats -fuzz as a regexp (FuzzAssemble also
  4. # matches FuzzAssembleProto).
  5. set -euo pipefail
  6. ROOT="$(cd "$(dirname "$0")/.." && pwd)"
  7. cd "$ROOT"
  8. export PATH="/data/prod2u/opt/go1.25.13/bin:/opt/python-3.12/bin:/usr/bin:/bin:${PATH}"
  9. export GOTOOLCHAIN="${GOTOOLCHAIN:-local}"
  10. if [[ -n "${GOROOT:-}" && ! -d "${GOROOT}" ]]; then
  11. unset GOROOT
  12. fi
  13. if [[ -z "${GOROOT:-}" && -d /data/prod2u/opt/go1.25.13 ]]; then
  14. export GOROOT=/data/prod2u/opt/go1.25.13
  15. fi
  16. PYTHON="${PYTHON:-python3}"
  17. SEC="${HTH_FUZZ_SECONDS:-900}"
  18. fail=0
  19. run_one() {
  20. local name="$1"
  21. shift
  22. echo "=== ${name} fuzztime=${SEC}s ==="
  23. if ! "$@"; then
  24. echo "FAIL ${name}"
  25. fail=1
  26. fi
  27. }
  28. run_one fuzz-parser go test ./internal/protocol -fuzz='^FuzzParser$' -fuzztime="${SEC}s"
  29. run_one fuzz-residual go test ./internal/protocol -fuzz='^FuzzResidualUntrusted$' -fuzztime="${SEC}s"
  30. run_one fuzz-6400-decode go test ./internal/protocol6400 -fuzz='^FuzzDecode$' -fuzztime="${SEC}s"
  31. run_one fuzz-6400-parser go test ./internal/protocol6400 -fuzz='^FuzzStreamParser$' -fuzztime="${SEC}s"
  32. run_one fuzz-profile go test ./internal/profile -fuzz='^FuzzLoadStrict$' -fuzztime="${SEC}s"
  33. run_one fuzz-config go test ./internal/config -fuzz='^FuzzLoadYAML$' -fuzztime="${SEC}s"
  34. run_one fuzz-config-sockets go test ./internal/config -fuzz='^FuzzSocketPaths$' -fuzztime="${SEC}s"
  35. run_one fuzz-assemble go test ./internal/safety -fuzz='^FuzzAssemble$' -fuzztime="${SEC}s"
  36. run_one fuzz-assemble-proto go test ./internal/safety -fuzz='^FuzzAssembleProto$' -fuzztime="${SEC}s"
  37. run_one fuzz-telemetry go test ./internal/telemetry -fuzz='^FuzzResumeIDs$' -fuzztime="${SEC}s"
  38. run_one fuzz-telemetry-subscribe go test ./internal/telemetry -fuzz='^FuzzSubscribeResume$' -fuzztime="${SEC}s"
  39. run_one fuzz-action-record go test ./internal/device -fuzz='^FuzzActionRecordConversion$' -fuzztime="${SEC}s"
  40. run_one fuzz-capture go test ./internal/capture -fuzz='^FuzzReadRecords$' -fuzztime="${SEC}s"
  41. run_one fuzz-capture-manifest go test ./internal/capture -fuzz='^FuzzReadManifest$' -fuzztime="${SEC}s"
  42. run_one fuzz-replay go test ./internal/backend -fuzz='^FuzzReplayOpen$' -fuzztime="${SEC}s"
  43. run_one fuzz-thermal-replay go test ./internal/thermalbackend -fuzz='^FuzzThermalReplayOpen$' -fuzztime="${SEC}s"
  44. run_one fuzz-sdk-descriptor env HTH_FUZZ_SECONDS="${SEC}" "${PYTHON}" -m pytest -q sdk/python/tests/test_descriptor_fuzz.py
  45. exit "${fail}"