Repository navigation
test: serve every test daemon through one forked harness - #8254
Merged
Merged
Conversation
oferchen
force-pushed
the
fix/daemon-tests-no-retries
branch
from
November 3, 2026 17:03
fcf8ca0 to
08aab3c
Compare
oferchen
force-pushed
the
fix/daemon-tests-no-retries
branch
from
November 3, 2026 19:31
6687ccd to
e2d43e0
Compare
This was referenced Nov 3, 2026
This was referenced Nov 4, 2026
oferchen
force-pushed
the
fix/daemon-tests-no-retries
branch
from
November 10, 2026 11:18
d922c2a to
b61385d
Compare
oferchen
force-pushed
the
fix/daemon-tests-no-retries
branch
from
November 10, 2026 13:23
b61385d to
7a2efe7
Compare
4 of 5 tasks
oferchen
force-pushed
the
fix/daemon-tests-no-retries
branch
2 times, most recently
from
November 10, 2026 17:08
6965a4f to
3c8c8c0
Compare
oferchen
force-pushed
the
fix/daemon-tests-no-retries
branch
2 times, most recently
from
November 10, 2026 20:35
efde29e to
a24b45a
Compare
Replays the branch onto current master as one commit and moves the two daemon tests master added since (filter-rule parse, checksum-choice none) onto the inetd and forked-daemon harnesses.
oferchen
force-pushed
the
fix/daemon-tests-no-retries
branch
from
November 12, 2026 13:57
a24b45a to
e1b44e9
Compare
…rame_layout and daemon pid test
oferchen
added a commit
that referenced
this pull request
Nov 14, 2026
## Summary `daemon_operator_path_symlinks` polled journald for up to 5 s to see the `log file` refusal reach syslog. 3.5.1's own tests for this case (`testsuite/log-file-symlink_test.py`, `operator-path-log-file_test.py`) only check that the victim file is untouched; nothing in the 3.5.1 testsuite reads syslog. The test now checks what upstream checks: the victim is unchanged, the planted symlink is left alone, and the daemon keeps serving (log.c:169, :175-182). The two fallback lines and their order are already pinned by the unit test `log_file_open_failure_falls_back_to_syslog`. Also drops the `Duration, Instant` import that #8254 left unused. Stacked on #8254. ## Tests - Run as root, the file's 6 tests pass. - Mutation: when the daemon log open follows symlinks, the victim assertion fails.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
folio_wait_bit_common) for 10-34 s before its first log line, so the 5 s readiness bound failed sessions that would have succeeded.forked_server::ForkedServerforks a closure throughplatform::session_fork's safe API, records how the run ended, and kills and reaps its process group on drop. It can capture the server's stderr through a pipe, using the newplatform::session_fork::redirect_stderr(nixdup2_stderr).oc_daemon::OcDaemon(featuredaemon) binds127.0.0.1:0, and with.quic()a UDP127.0.0.1:0socket too, before the fork, then runsdaemon::run_daemonon those sockets. A client connect queues in the backlog: no port probe, no readiness wait, no retry, and no exec.inetd_server::InetdServerserves upstream binaries, which cannot take a pre-bound socket, in inetd mode: one process per accepted connection, with the socket as stdin/stdout. upstream: clientserver.c:1748is_inetd_socket().DaemonHandleis a thin adapter overForkedServer.TestDaemon, all 27 transfer daemon tests and the five root-crate daemon tests useOcDaemonorInetdServer.DaemonProcess,spawn_daemon_on_free_port,daemon_listen_portand their tests go with their last callers.DaemonConfigBuilder::pre_bound_quic_socket, the UDP twin ofpre_bound_listener. Injected sockets replace the daemon's own QUIC bind, so no test races another process for a UDP port.Deleted tests (property pinned elsewhere)
uts_nextest_daemon_gzip_zz::second_daemon_on_the_same_port_is_refused_no_co_bind. With a pre-bound fixture listener it cannot fail. The daemon unit testdefault_single_listener_refuses_a_second_bind_on_the_same_portpins the same SO_REUSEADDR-only rule through the productionbind_listeners_per_family.quic_daemon_address.rs. Its property is the daemon's ownquic addressbind, which a pre-bound socket bypasses, and no race-free port exists for the daemon to bind itself (quic port = 0means 873). The unit tests inserver_runtime/tests.rspinresolve_quic_bind_addressesandbind_quic_sockets_per_familyfor explicit address lists.Other changes
concurrent_fixtures_get_distinct_ports_and_do_not_cross_talkforks every fixture on the main thread before any client thread exists.client_daemon_interop::test_client_incremental_transferbackdates its first copy. A same-second rewrite of an equal-length file was skipped by the quick check; the slow old harness used to hide that.bstr(via the daemon feature's engine/globset path) into every test target that depends on test-support. Itsimpl AsRef<BStr> for [u8]madex.as_ref()inference ambiguous at 10 sites inrsync_ioandchecksums; those bindings now name&[u8]/&mut [u8]explicitly. No behaviour change.Test plan
cargo nextest run -p core --all-features --retries 0, 5 runs: 2938/2938 each.cargo nextest run -p daemon --all-features --retries 0, 5 runs: 2144/2144 each.--retries 0, 5 runs: 110/110 each. QUIC binaries alone: 35/35.posix_fadvise DONTNEED) every second for the whole run: 2938/2938. A single cold client exec measured 3.59 s, against 0.01 s hot; the client is bounded only by its own--timeout./usr/bin/rsync3.5.1 standing in for the pinned versions):cargo nextest run -p core -p daemon -p transfer -p test-support -p rsync_io -p checksums -p bin --all-features --retries 0: 11768/11768.cargo fmt --all -- --checkandcheck_rustfmt_all.py.cargo clippy --workspace --all-targets --all-features --no-deps -- -D warnings.--tests, for test-support, core, transfer, daemon and platform.cargo check --target x86_64-pc-windows-gnu --testsfor the same crates.unsafe_owner_deps.py,dead_code_census.py,xtask no-placeholders.Findings, not fixed here (filed as tasks)
v61d_2_daemon_push_increcurse_perf_regressionfails for any non-root runner once upstream is installed:gid = nobodymakes upstream call setgid (clientserver.c:844, 1100), contrary to the test's comment (separate PR).msg_no_send_unsendable_file's client deadline loop.Coordination
Conventional commit prefix
test:Pre-merge checklist
cargo fmt --allrun locally.CHANGELOG.md: not updated, because only tests and test infrastructure change. The one production addition is a test-only daemon config hook.Folded in
Folded in
Root daemon tests: reserved listeners, no readiness polls (task 538)
The 21 root
tests/files that spawnedoc-rsync --daemonand polledconnect()under a 30 s ready timeout now get a listener that is bound before the daemon runs. A connect therefore queues in the kernel backlog, and no test waits for readiness.InetdServer (
test_support::inetd_server): the real binary serves each accepted socket in inetd mode (upstream clientserver.c:1748). It's used where the test needs the shipped binary's daemon behaviour, or serves upstream 3.5.1 too:wrapped_by(sudo -n ...))OcDaemon (
test_support::oc_daemon), which forks the daemon library onto a reserved listener. It's used for the two tests about daemon startup itself:join()Harness additions:
InetdServer::finish()stops accepting and waits for every session to exit, so a session's log lines are on disk before the test reads them. This replaces the kill-then-read races and the log-file polls. Also new:reserve_port()/start_reserved(),OcDaemonBuilder::reserved_port()for a port that must be written into a config first, andInetdCommand::{discarding_stderr, wrapped_by, env}.Client-side wall-clock loops removed: client_empty_flist_skips_recv_loop, daemon_sender_per_file_error_no_hang, missing_source_arg_exits_partial and flist_banner_before_names now block on the client via
Command::output(). The nextest per-test timeout is the only bound, so a hang under test fails as a TIMEOUT that names the test. client_empty_flist_skips_recv_loop and missing_source_arg_exits_partial are now#![cfg(unix)]:oc-rsync --daemondoes not run on Windows.Assertions on daemon stderr and log files are byte-identical. daemon_transfer_logging_per_file now also asserts, after
finish(), that the log contains the marker line it used to poll for.Mutation checks, one per family, each reverted afterwards:
"send"->"sendX"(log_format.rs): daemon_transfer_logging_per_file 5/29 FAILinsecure_linksdefault -> true (module_definition/finish.rs): daemon_concurrent_module_confinement 2/3 FAIL, strict_alone_is_confined and the concurrent case--remove-source-filesdropped (client_args/long_form_args.rs): daemon_honours_forwarded_remove_source_files 1/1 FAILTwo tests that merged after this PR was written used the deleted
DaemonProcess. They now use the harness: crates/test-support/tests/receiver_write_failure.rs (#8304) usesOcDaemonwith--once, gated on thedaemonfeature; crates/transfer/tests/push_list_only_reaches_client.rs serves oc or 3.5.1 throughInetdServer. Also, crates/daemon/src/tests/chunks/run_daemon_serves_slow_handshake.rs is now rustfmt-clean. It is include!d, socargo fmt --allnever reached it, but check_rustfmt_all did.Left in place: daemon_operator_path_symlinks still polls journald for up to 5 s for its syslog line. It reads an external system log; task 584 tracks it.
Daemon listener address families, tested in process (task 612)
The five
listener_address_familytests started a daemon on a port reserved by binding then dropping a probe, then retriedconnect. Another process could take the port in between; #8321's macOS run hit exactly that. Upstream's testsuite has no daemon-level family test: its daemon tests useRSYNC_CONNECT_PROGand open no listener at all (testsuite/rsyncfns.py:833-865). So this PR drops those daemon-process tests and tests the family selection in process instead. No production code changes.crates/daemon/tests/listener_address_family.rsis removed.server_runtime/tests.rsrun the daemon's own path:RuntimeOptionsparsing, thenresolve_bind_addresses, thenbind_listeners_per_familyat port 0, with no daemon process and no readiness wait. TheOC_RSYNC_DAEMON_ADDRESS_FAMILYoverride is passed as a value rather than through the environment. The IPv6 cells skip, with a reason, when::1cannot bind.both_family_flags_bind_both_families, and making the IPv4 override bind IPv6 failsipv4_override_binds_only_ipv4.Last readiness polls in the root tests (task 538)
tests/daemon_session_error_keeps_listener.rs: the 15 s connect-retry loop and socket timeouts become a single connect against the pre-bound listener. The 500 ms sleep is removed with no new seam: sessions are forked children, so a session error cannot reach the accept loop, and the first client's read-to-EOF already waits for its session to end.tests/integration_daemon.rsloses a dead 30 sconnect_with_retries, a reserve-then-releaseallocate_test_portand two dead protocol helpers.daemon_list_modules_via_clinever started a daemon; it now serves two modules from anOcDaemonand asserts the exact(name, comment)rows of--list-only rsync://.../.daemon_list_modules_via_cli; a daemon that binds and never accepts fails both tests in under a second, not at a timeout.Left as is: the journald poll in
daemon_operator_path_symlinks(task 584), the public-server polls inintegration_rsync_protocol.rs, andtests/compress_interop_test.sh(shell harness outside nextest).