diff --git a/justfile b/justfile index 7719121..048fc5d 100644 --- a/justfile +++ b/justfile @@ -107,3 +107,8 @@ e2e: shell-frame path="target/shell-frame.png": cargo run -q -p shturman-shell -- --screenshot {{path}} @echo "кадр записан: {{path}}" + +# инспекция splash-кадра (Stage 0): headless software-render → PNG +splash-frame path="target/splash-frame.png": + cargo run -q -p shturman-splash -- --screenshot {{path}} + @echo "splash записан: {{path}}" diff --git a/lima/shturman.yaml b/lima/shturman.yaml index 868c4fd..ea2ee37 100644 --- a/lima/shturman.yaml +++ b/lima/shturman.yaml @@ -47,8 +47,9 @@ provision: mkfs.ext4 -q -L shturman-data /var/lib/shturman/data.img fi - # systemd-юниты + конфиги из репозитория + # systemd-юниты + конфиги из репозитория (зонтик + 3 фазовых таргета; *.service ловит splash/warmup) install -m644 /shturman/systemd/shturman.target /etc/systemd/system/ + install -m644 /shturman/systemd/shturman-stage0.target /shturman/systemd/shturman-stage1.target /shturman/systemd/shturman-stage2.target /etc/systemd/system/ install -m644 /shturman/systemd/data.mount /etc/systemd/system/ install -m644 /shturman/systemd/shturman-*.service /etc/systemd/system/ install -d /etc/dbus-1/system.d @@ -58,6 +59,10 @@ provision: install -m644 /shturman/systemd/zram-generator.conf /etc/systemd/zram-generator.conf install -d /etc/systemd/oomd.conf.d install -m644 /shturman/systemd/oomd-shturman.conf /etc/systemd/oomd.conf.d/shturman.conf + # /run/shturman (кадры/маркеры, volatile) — tmpfiles на boot + install -d /etc/tmpfiles.d + install -m644 /shturman/systemd/tmpfiles-shturman.conf /etc/tmpfiles.d/shturman.conf + systemd-tmpfiles --create /etc/tmpfiles.d/shturman.conf || true # fake-hwclock → /data (не на rootfs; A07/A11). Сервис в Lima masked (Lima сам синхронит время) — # на HW он размаскирован и читает FILE из /etc/default/fake-hwclock через EnvironmentFile. diff --git a/tests/e2e/run.sh b/tests/e2e/run.sh index 2484923..eda06ad 100644 --- a/tests/e2e/run.sh +++ b/tests/e2e/run.sh @@ -69,22 +69,28 @@ fi # ============================ PRE фаза ============================ info "сборка (release, VM-локальный target=$CARGO_TARGET_DIR)" cargo build --release --workspace || fail "сборка" -for b in firstboot settings power shell; do +for b in firstboot settings power shell splash; do sudo install -m755 "$CARGO_TARGET_DIR/release/shturman-$b" /usr/local/bin/ || fail "install shturman-$b" done pass "бинари установлены в /usr/local/bin" info "раскладка systemd-юнитов + dbus policy (из репо — подхватить правки)" -sudo install -m644 systemd/shturman.target systemd/data.mount /etc/systemd/system/ +sudo install -m644 systemd/shturman.target systemd/data.mount \ + systemd/shturman-stage0.target systemd/shturman-stage1.target systemd/shturman-stage2.target \ + /etc/systemd/system/ sudo install -m644 systemd/shturman-firstboot.service systemd/shturman-machineid.service \ systemd/shturman-power.service systemd/shturman-settings.service \ - systemd/shturman-shell.service /etc/systemd/system/ + systemd/shturman-shell.service systemd/shturman-splash.service \ + systemd/shturman-stage2-warmup.service /etc/systemd/system/ sudo install -d /etc/dbus-1/system.d sudo install -m644 systemd/dbus/ru.shturman.conf /etc/dbus-1/system.d/ sudo install -d /etc/systemd/journald.conf.d /etc/systemd/oomd.conf.d sudo install -m644 systemd/journald-shturman.conf /etc/systemd/journald.conf.d/shturman.conf sudo install -m644 systemd/oomd-shturman.conf /etc/systemd/oomd.conf.d/shturman.conf sudo install -m644 systemd/zram-generator.conf /etc/systemd/zram-generator.conf +sudo install -d /etc/tmpfiles.d +sudo install -m644 systemd/tmpfiles-shturman.conf /etc/tmpfiles.d/shturman.conf +sudo systemd-tmpfiles --create /etc/tmpfiles.d/shturman.conf || true sudo systemctl daemon-reload # применить конфиги детерминированно (на свежем boot drop-in’ы появились после старта демонов) sudo systemctl reload dbus 2>/dev/null || true @@ -95,9 +101,10 @@ sudo systemctl start "systemd-zram-setup@zram0.service" 2>/dev/null || true sudo systemctl restart systemd-oomd 2>/dev/null || sudo systemctl start systemd-oomd 2>/dev/null || true # подхватить oomd.conf.d pass "юниты/политики разложены" -info "старт shturman.target" +info "старт shturman.target (зонтик → Stage 0/1/2)" sudo systemctl start shturman.target || fail "shturman.target не стартовал" -sudo systemctl restart shturman-shell.service || true # свежий кадр (на повторном прогоне) +# Фазовый старт рендерит splash → frame → warmup по порядку (Before/After). Restart shell НЕ делаем: +# иначе frame.png стал бы новее stage2.ready и сломал ассерт «warmup после кадра» (порядок фаз). for _ in $(seq 1 15); do systemctl is-active --quiet shturman-shell && break; sleep 1; done # ---- 1. /data до сервисов + реальные power-safe опции (§9.3.1) ---- @@ -161,6 +168,23 @@ sz=$(sudo stat -c%s "$FRAME"); [ "$sz" -gt 10000 ] || fail "кадр подоз sudo head -c8 "$FRAME" | od -An -tx1 | tr -d ' \n' | grep -qi "89504e47" || fail "$FRAME не PNG" pass "кадр $FRAME: $sz Б, валидный PNG" +# ---- Stage 0/1/2 разделены (v0.2 boot-конвейер) ---- +info "Stage 0/1/2: фазы разделены + splash до кадра + warmup после" +for t in shturman-stage0 shturman-stage1 shturman-stage2; do + systemctl is-active --quiet "$t.target" || fail "$t.target не достигнут ($(systemctl is-active "$t.target" 2>&1))" + pass "$t.target reached" +done +sudo test -f /run/shturman/splash.png || fail "нет splash.png (Stage 0)" +sudo head -c8 /run/shturman/splash.png | od -An -tx1 | tr -d ' \n' | grep -qi 89504e47 || fail "splash.png не PNG" +fr=$(sudo stat -c %Y "$FRAME"); sp=$(sudo stat -c %Y /run/shturman/splash.png) +[ "$sp" -le "$fr" ] || fail "splash.png ($sp) позже frame.png ($fr) — Stage 0 не раньше Stage 1" +sudo test -f /run/shturman/stage2.ready || fail "нет stage2.ready (Stage 2 warmup не отработал)" +w2=$(sudo stat -c %Y /run/shturman/stage2.ready) +[ "$w2" -ge "$fr" ] || fail "stage2.ready ($w2) раньше кадра ($fr) — Stage 2 не деферред" +pass "порядок фаз: splash($sp) ≤ frame($fr) ≤ stage2($w2)" +# boot-тайминг (функц., НЕ гейт; вердикт — RK3588, performance §2) +echo " $(systemd-analyze time 2>/dev/null | head -1 || echo 'systemd-analyze н/д')" + # ---- 8. base-бюджеты: journald / zram / fake-hwclock / eMMC-прокси (§9.3.7) ---- info "8. base-бюджеты (функц.)" # journald volatile: активный журнал в /run/log/journal, persistent /var/log/journal отсутствует (A10)