Skip to content

Make the platform ipc and watch tests wait for the peer instead of a time - #509

Merged
yansfil merged 2 commits into
mainfrom
test/ipc-waits-on-state
Oct 5, 2026
Merged

yansfil merged 2 commits into
mainfrom
test/ipc-waits-on-state

Conversation

@yansfil

@yansfil yansfil commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Refs #437

Summary

hide-platform의 ipc와 watch 계약 테스트 9개에서 #437 allow를 없앱니다. 6개는 시간 대신 상태를 기다리고, 3개는 감독 결정에 따라 고유 이유의 allow로 재분류했습니다. 제품 코드는 바뀌지 않았습니다.

상태를 기다리게 바꾼 것:

  • a_read_timeout_fires..., the_accepted_stream_names...: 상대가 1.5초/0.5초 자며 연결을 쥐던 것을, 테스트가 채널로 놓아 줄 때까지 쥐게 했습니다(10초는 실패 경로의 한도).
  • a_timeout_does_not_lose_bytes...: 상대가 500ms 뒤가 아니라 클라이언트의 read가 timeout된 뒤에 씁니다.
  • an_answer_written_just_before_the_end_is_dropped...: 300ms 대신, 클라이언트가 마지막 256바이트를 읽지 않은 채 listener 쪽이 쓰기를 끝내고 drop했다는 신호를 받은 뒤 나머지를 읽습니다. "읽지 않은 바이트가 남은 채 닫힘"이 이제 매번 일어납니다(256 < Windows pipe 512 요청, Unix socket buffer).
  • a_timeout_can_be_set_after_the_peer_has_closed...: join 뒤의 200ms를 지웠습니다. Unix stream은 drop에서 descriptor를 닫으므로 join이 곧 "상대가 닫힘"입니다.
  • watch.rs a_filtered_watch...: 100개마다 20ms 대신, 필터가 남기는 refs/pace* 파일을 쓰고 그 보고를 기다립니다. 시스템은 순서대로 보고하므로 그 앞의 100개는 읽혔습니다.

Review

  • 판단해 주세요 (재분류 3개): close_from_another_thread_frees_a_blocked_accept, shutdown_from_another_thread_frees_a_blocked_read, shutdown_frees_a_read_that_has_a_timeout_too. 대상이 "막힌 syscall을 깨우는 경로"인데 thread가 syscall 안에서 막혔다는 상태를 이식 가능하게 볼 방법이 없습니다. allow 이유를 "time for the other thread to block in the call it frees: no portable state says a thread is inside a system call"로 바꿨고, thread가 accept/read 직전에 보내는 신호를 받은 뒤에만 300ms를 잡니다(길이는 그대로, thread 시작 시간은 덮지 않음). 상대를 10초 sleep으로 쥐던 것은 채널로 바꿨습니다.
  • 판단해 주세요: 위 3개가 순서와 무관하게 성립하도록, close/shutdown이 호출보다 먼저 온 경우를 테스트 2개로 새로 고정했습니다(a_close_before_the_accept..., a_shutdown_before_the_read..., timeout 있음/없음). OS contract lane이 세 시스템에서 돌립니다. 테스트를 늘린 것이 괜찮은지.
  • 조심해서 볼 파일: hide-platform/tests/watch.rs - 이제 pace 파일 26개의 보고를 각각 기다립니다(각 2초 한도). 보고가 늦은 시스템에서는 실패가 "a kept path ... was not reported"로 나옵니다.

Evidence

  • 확인한 것: 부하(yes 4개 + taskpolicy -b)에서 수정 전과 후 binary를 같은 조건으로: ipc 바꾼 8개 60/60 대 60/60, watch 30/30 대 30/30, 새 순서 테스트 2개 60/60(macOS). 매 run의 N passed로 test가 실제로 돌았는지 확인했습니다(ipc run당 8개, 순서 2개, watch 1개).
  • 확인한 것: 순서 확인 - close/shutdown을 호출 전에 보내도 accept는 두 번 다 ConnectionAborted, read는 Ok(0), 뒤의 write는 실패로 같은 답(macOS). Linux와 Windows는 이 PR의 OS contract lane으로 봅니다.
  • 확인한 것: verify-cargo.sh clippy -p hide-platform --all-targets -D warnings, fmt, test-scoped -p hide-platform --test ipc --test watch 통과.
  • 확인하지 못한 것: 수정 전 흔들림은 로컬에서 재현되지 않았습니다. "읽기로 판단한 위험"입니다. drop 직전 응답 테스트는 Windows 전용 결함을 겨냥하므로 macOS에서 planted defect로 확인하지 못했습니다.
  • 확인하지 못한 것: 남은 Rust tests sleep instead of waiting for a state or injecting the clock #437 allow는 이 PR만 놓고 50개, Make the process and lock wait tests wait for the child or the waiter #503 #504와 함께 42개입니다.

…time

A silent or late peer now holds its end on a channel the test releases,
the drop-with-unread-bytes test leaves its last bytes unread until the
listener's end is gone, and the filtered burst is paced by a kept path's
arrival. The three tests about a call freed while it is blocked keep their
300 ms, now only after the thread says it is about to block, under an allow
that names why: no portable state says a thread is inside a system call.
The three tests that free a blocked accept or read leave the last step into
the call to the scheduler, so the same answer when the close or shutdown
lands first is what keeps them from failing on a slow runner.
@yansfil
yansfil added this pull request to the merge queue Oct 5, 2026
Merged via the queue into main with commit edc6529 Oct 5, 2026
28 checks passed
@yansfil
yansfil deleted the test/ipc-waits-on-state branch October 5, 2026 13:32
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