Skip to content

test(cli): no timeout decides a cli_scope test; finish keeps the environment - #2590

Merged
DeusData merged 1 commit into
mainfrom
fix/cli-scope-no-timeouts
Oct 11, 2026
Merged

DeusData merged 1 commit into
mainfrom
fix/cli-scope-no-timeouts

Conversation

@DeusData

Copy link
Copy Markdown
Owner

Follow-up to #2589, test code only (tests/test_cli.c).

What

No timeout decides a cli_scope test. #2589 removed the 90 s readiness deadline. Four other timeouts could still turn a slow but healthy run into a failure:

wait before now
"is the host still serving?" probe one request with a 15 s budget repeated while a live process holds the endpoint without answering; a reply or a refusal decides
parent's client connect one attempt, 5 s same retry rule
reaping the host child SIGKILL after 60 s, then host_exit == -1 waitpid without a deadline
the host child's cohort join 45 s deadline UINT64_MAX: waits for locks, answers a conflicting holder at once

The retry rule uses what the daemon API already reports. A failed status or connect still carries muted_endpoint_holder_pid, which is nonzero only when a live process accepted the connection and didn't answer in time. Each attempt keeps the API's finite 5 s budget, so a mute endpoint is not spun in a hot loop. A wedged child is left to the harness's per-suite ceiling.

cli_scope_fixture_finish keeps the environment after an early setup failure. Every cli_scope test calls finish, even when start failed. A start that failed before saving HOME, CBM_CACHE_DIR and SHELL had finish "restore" them to nothing, which unset them for every later test in the suite. finish now restores only what start saved.

Not changed: the 2 s probe that checks an already-drained host has stopped serving (CLI_SCOPE_HOST_DRAINED_PROBE_MS). It's recorded as a separate question. The daemon_* cohort fixture near the top of the file also keeps its own 45 s join.

Tests

  • cli_scope_fixture_finish_keeps_env_after_an_early_failure: fails on main at ASSERT(home_kept) and passes with this change.
  • cli_scope_retries_a_mute_endpoint_until_it_answers: checks the retry rule on scripted outcomes (mute, mute, mute, answered → true after 4 attempts; mute, refused → false after 2; answered → true after 1).
  • All cli_scope tests pass against a real host child.

Checks

  • Affected suites (daemon_version daemon_application cli, macOS ASan): 444 passed, 0 failed. make lint-ci clean.
  • Local 3-OS ladder on this exact tree:
    • macOS (scripts/test.sh): 9,137 passed, 0 failed, 11 skipped (177 suites); cli 358/0
    • Linux arm64 container (run.sh test): 8,975 passed, 0 failed, 10 skipped (173 suites); cli 359/0
    • Windows arm64 VM (win.sh test, the runner's full 177-suite list): 8,961 passed, 0 failed, 91 skipped. The cli_scope fixture is POSIX-only (it forks), so its tests are not built on Windows. Windows guards (CI's TEST_SEAMS=1 build): 8/8 green.

…ronment

Follow-up to #2589.

No timeout decides a cli_scope test any more:
- The status probe and the parent's client connect repeat an attempt that
  reaches a live but mute endpoint (a loaded runner answering slowly). A
  reply or a definite refusal decides. Each attempt keeps the API's finite
  5 s budget. This replaces the 15 s status budget and the single 5 s
  connect.
- The host child is reaped without a deadline (it used to get SIGKILL after
  60 s).
- The host child joins its version cohort with UINT64_MAX, which waits for
  locks but answers a conflicting holder at once (it used to have a 45 s
  deadline).
A wedged child is left to the harness's per-suite ceiling.

cli_scope_fixture_finish restored HOME, CBM_CACHE_DIR and SHELL even when
start had failed before saving them, which unset them for every later test
in the suite. It now restores only what start saved.

New tests:
- cli_scope_fixture_finish_keeps_env_after_an_early_failure fails on main
  at ASSERT(home_kept);
- cli_scope_retries_a_mute_endpoint_until_it_answers checks the retry rule
  on scripted attempt outcomes.

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
@DeusData
DeusData merged commit 1691be7 into main Oct 11, 2026
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant