testsAndMisc/phone_focus_mode/lib/tests
Krzysztof kuhy Rudnicki 094c4765f3
Some checks are pending
Pre-commit checks / pre-commit (push) Waiting to run
Shell tests / shell-tests (push) Waiting to run
Shell tests / arch-tests (push) Waiting to run
focus_daemon: split 543 -> 206 + 165 + 140 + 94, with 110 tests
Location/curfew goes to daemon_location.sh, the derived state files to
daemon_state.sh, the app layer to daemon_apps.sh. All 23 functions moved
verbatim -- nothing restructured, which matters more here than anywhere
else in this session.

focus_daemon.sh has five `while IFS= read -r pkg; do ... done <file` loops
and EVERY body calls pm. Piping any of them in lets pm inherit and drain
the loop's stdin, so it would process one package instead of all of them --
measured elsewhere in this repo as 1 of 54. That audit ran BEFORE the
extraction, not after coverage came back short, and all five moved
untouched with a note above them saying why.

CURRENT_MODE and _CURFEW_TICK_CACHED are each written in both the entry
script and a library, so both stay declared with main, same call as
NET_BUILT in the curfew split.

110 assertions and 33 mutations, all killed. Two survived the first run and
both were defects in my own tests: the whitelist and sysprotect exactness
checks used a SUPERSTRING of a listed entry, which fails under grep -qF and
grep -qxF alike and so proved nothing about which was in use.

Two subjects are NOT at 100%, and the numbers are reported as measured:

  daemon_state.sh     67/67 = 100.00%
  daemon_location.sh  26/40 =  65.00%
  daemon_apps.sh      71/76 =  93.42%

Both shortfalls are kcov attribution failures, shown to be artifacts rather
than gaps. daemon_location.sh's missing lines are all inside the embedded
awk Haversine; mutating the Earth radius and dropping the longitude term
both fail the suite, and an isolated probe shows a one-line awk measuring
100% where the identical multi-line one measures 0%. Collapsing the formula
to satisfy the tool would cost the readability of the only real mathematics
in the repo, so it stays.

daemon_apps.sh's five are the trailing `done <file` of the very loops
described above. That is the same artifact piping fixed in curfew_net.sh,
and it is exactly what must NOT be done here. Redirecting two of them from
/dev/null fails the suite, so the lines run; all three are pinned in the
mutation spec instead.

Over-cap count 19 -> 18.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011w2Pj4Ek3ZNMQVYcFHgXDY
2026-08-17 16:54:04 +02:00
..
adb_test_harness.sh phone_focus_mode: split test_adb_common.sh 287 -> 134 + 105 2026-08-17 10:34:55 +02:00
backup_capture_harness.sh phone_backup: split 333 -> 229 + 114, with the library at 100% 2026-08-17 16:02:25 +02:00
curfew_net_cases_chain.sh curfew_enforcer: split 367 -> 244 + 156, net layer at 100% 2026-08-17 16:18:05 +02:00
curfew_net_cases_lifecycle.sh curfew_enforcer: split 367 -> 244 + 156, net layer at 100% 2026-08-17 16:18:05 +02:00
curfew_net_harness.sh curfew_enforcer: split 367 -> 244 + 156, net layer at 100% 2026-08-17 16:18:05 +02:00
daemon_cases_apps.sh focus_daemon: split 543 -> 206 + 165 + 140 + 94, with 110 tests 2026-08-17 16:54:04 +02:00
daemon_cases_location.sh focus_daemon: split 543 -> 206 + 165 + 140 + 94, with 110 tests 2026-08-17 16:54:04 +02:00
daemon_cases_state.sh focus_daemon: split 543 -> 206 + 165 + 140 + 94, with 110 tests 2026-08-17 16:54:04 +02:00
daemon_cases_sweep.sh focus_daemon: split 543 -> 206 + 165 + 140 + 94, with 110 tests 2026-08-17 16:54:04 +02:00
daemon_libs_harness.sh focus_daemon: split 543 -> 206 + 165 + 140 + 94, with 110 tests 2026-08-17 16:54:04 +02:00
dns_iptables_harness.sh meta: measurable shell coverage, and dns_iptables.sh at 100% 2026-08-17 15:29:08 +02:00
hosts_cases_assert.sh hosts_enforcer: split 421 -> 207 + 166 + 91, both libs at 100% 2026-08-17 16:30:56 +02:00
hosts_cases_cache.sh hosts_enforcer: split 421 -> 207 + 166 + 91, both libs at 100% 2026-08-17 16:30:56 +02:00
hosts_cases_magisk.sh hosts_enforcer: split 421 -> 207 + 166 + 91, both libs at 100% 2026-08-17 16:30:56 +02:00
hosts_cases_mount.sh hosts_enforcer: split 421 -> 207 + 166 + 91, both libs at 100% 2026-08-17 16:30:56 +02:00
hosts_libs_harness.sh hosts_enforcer: split 421 -> 207 + 166 + 91, both libs at 100% 2026-08-17 16:30:56 +02:00
monitor_cases_health.sh monitor: backfill to 100% coverage, fixing two defects it exposed 2026-08-17 15:54:04 +02:00
monitor_cases_policy.sh monitor: backfill to 100% coverage, fixing two defects it exposed 2026-08-17 15:54:04 +02:00
monitor_harness.sh monitor: backfill to 100% coverage, fixing two defects it exposed 2026-08-17 15:54:04 +02:00
test_adb_common.sh phone_focus_mode: split test_adb_common.sh 287 -> 134 + 105 2026-08-17 10:34:55 +02:00
test_adb_trusted.sh phone_focus_mode: split test_adb_common.sh 287 -> 134 + 105 2026-08-17 10:34:55 +02:00
test_backup_capture.sh phone_backup: split 333 -> 229 + 114, with the library at 100% 2026-08-17 16:02:25 +02:00
test_curfew_net.sh curfew_enforcer: split 367 -> 244 + 156, net layer at 100% 2026-08-17 16:18:05 +02:00
test_daemon_libs.sh focus_daemon: split 543 -> 206 + 165 + 140 + 94, with 110 tests 2026-08-17 16:54:04 +02:00
test_dns_iptables.sh meta: measurable shell coverage, and dns_iptables.sh at 100% 2026-08-17 15:29:08 +02:00
test_hosts_libs.sh hosts_enforcer: split 421 -> 207 + 166 + 91, both libs at 100% 2026-08-17 16:30:56 +02:00
test_magisk_service.sh feat(phone-focus): add recovery workflow, automation scripts, and docs 2026-05-01 19:07:27 +02:00
test_monitor.sh monitor: backfill to 100% coverage, fixing two defects it exposed 2026-08-17 15:54:04 +02:00
test_tether_enforcer.sh tether_enforcer: split 267 -> 182 + 103, and grow both deploy lists 2026-08-17 14:38:53 +02:00