diff --git a/tests/e2e/run.sh b/tests/e2e/run.sh index 5413ac7..57bf92a 100644 --- a/tests/e2e/run.sh +++ b/tests/e2e/run.sh @@ -274,6 +274,49 @@ test -f /etc/systemd/system.conf.d/shturman-watchdog.conf || fail "нет watchd systemctl is-active --quiet shturman-savetime.timer && pass "savetime.timer активен" || echo " WARN: savetime.timer не активен" pass "watchdog-конфиг на месте" +# ---- v0.4: thermal-trip + throttling + MCU fail-safe (мок-sensor/MCU) ---- +# Каждый под-тест стартует с чистого running-power (рестарт сбрасывает MockTempSource→20, FSM→running, +# и счётчик start-limit). thermal-abort покрыт integration-тестом (P8.7) — в E2E не гоняем с grace-окном. +info "v0.4: thermal-trip → ShutdownImminent(thermal); throttling-банд; MCU fail-safe (hang → cut)" +P_RESTART() { # чистый рестарт power → running + sudo systemctl reset-failed shturman-power.service 2>/dev/null || true + sudo systemctl restart shturman-power.service + for _ in $(seq 1 10); do systemctl is-active --quiet shturman-power && break; sleep 1; done + sleep 1.5 # дать циклам (poll/heartbeat ~1с) стартовать +} + +# thermal-trip: SetTemp ≥ critical → ShutdownImminent(thermal) (монитор poll ~1с; ловим до grace-commit) +P_RESTART +mon=$(mktemp) +# shellcheck disable=SC2024 +sudo busctl --system monitor "$P_NAME" >"$mon" 2>&1 & M=$! +sleep 0.4; P_CALL SetTemp i 99; sleep 1.6 +sudo kill "$M" 2>/dev/null; wait "$M" 2>/dev/null +grep -q ShutdownImminent "$mon" || { cat "$mon"; rm -f "$mon"; fail "thermal: ShutdownImminent не наблюдаем"; } +grep -q thermal "$mon" || { cat "$mon"; rm -f "$mon"; fail "thermal: reason != thermal"; } +rm -f "$mon" +pass "thermal-trip: SetTemp≥critical → ShutdownImminent(thermal)" + +# throttling-банд (85..95) → ThermalState=throttle, БЕЗ shutdown +P_RESTART +P_CALL SetTemp i 88; sleep 2 +ts=$(busctl --system get-property "$P_NAME" "$P_PATH" "$P_IFACE" ThermalState 2>/dev/null) +echo "$ts" | grep -q throttle || { echo "ThermalState=$ts"; fail "thermal: ThermalState != throttle на 88°C"; } +busctl --system call "$P_NAME" "$P_PATH" "$P_IFACE" GetPowerState | grep -q running || fail "thermal: throttle не должен ронять" +pass "throttling-банд: ThermalState=throttle на 88°C, без shutdown" + +# MCU fail-safe: HangSoc → heartbeat пропал → MCU режет (FSM → off) детерминированно (B09) +P_RESTART +P_CALL HangSoc +ok=0 +for _ in $(seq 1 10); do + sleep 1 + busctl --system call "$P_NAME" "$P_PATH" "$P_IFACE" GetPowerState 2>/dev/null | grep -q off && { ok=1; break; } +done +[ "$ok" = 1 ] || fail "MCU fail-safe: power не off после HangSoc (B09 не сработал)" +pass "MCU fail-safe: HangSoc → MCU cut (FSM off), детерминированно" +P_RESTART # чистый running для последующих блоков + # ---- 8. base-бюджеты: journald / zram / fake-hwclock / eMMC-прокси (§9.3.7) ---- info "8. base-бюджеты (функц.)" # journald volatile: активный журнал в /run/log/journal, persistent /var/log/journal отсутствует (A10)