Skip to content

Coverage/bugfixes#277

Merged
sgerbino merged 9 commits into
cppalliance:developfrom
sgerbino:pr/coverage-ii
Jun 12, 2026
Merged

Coverage/bugfixes#277
sgerbino merged 9 commits into
cppalliance:developfrom
sgerbino:pr/coverage-ii

Conversation

@sgerbino

Copy link
Copy Markdown
Collaborator

Resolves #256.

sgerbino added 2 commits June 12, 2026 17:14
Add datagram_paths.cpp covering the would-block routes the per-type
unit tests skip: parked recv/recv_from before the sender sends,
send/send_to bursts into shrunken kernel buffers, and stop-token
cancellation of parked recv, recv_from, send, send_to, wait(read),
and wait(error) on UDP and local datagram sockets.

The buffer-pressure tests cover both kernel contracts: a unix-datagram
send into a full peer buffer returns EAGAIN on Linux and parks the op,
while BSD and macOS report ENOBUFS and complete the send with an
error. The reader drains what the writer actually delivered and the
assertions split per platform.

Extend reactor_paths.cpp with a stop-token cancel of a parked
local-stream read, a local-stream write EAGAIN variant, and an
io_context teardown with reads parked on every reactor socket type
so abandoned ops run reactor_op::destroy.
Parameterize stream_file.cpp and random_access_file.cpp on the
backend tag via COROSIO_BACKEND_TESTS so the full file API (open
flags, seek, resize, sync, release, assign, cancellation) runs
against each platform backend instead of only the default one.

Skip the single-threaded operation_not_supported check on io_uring,
which performs file I/O through the ring and has no thread-pool
restriction. Add a resize-overflow check rejecting sizes beyond
off_t with EOVERFLOW.
@cppalliance-bot

cppalliance-bot commented Jun 12, 2026

Copy link
Copy Markdown

An automated preview of the documentation is available at https://277.corosio.prtest3.cppalliance.org/index.html

If more commits are pushed to the pull request, the docs will rebuild at the same URL.

2026-06-12 16:48:53 UTC

@cppalliance-bot

Copy link
Copy Markdown

GCOVR code coverage report https://277.corosio.prtest3.cppalliance.org/gcovr/index.html
LCOV code coverage report https://277.corosio.prtest3.cppalliance.org/genhtml/index.html
Coverage Diff Report https://277.corosio.prtest3.cppalliance.org/diff-report/index.html

Build time: 2026-06-12 15:41:24 UTC

@cppalliance-bot

cppalliance-bot commented Jun 12, 2026

Copy link
Copy Markdown

GCOVR code coverage report https://277.corosio.prtest3.cppalliance.org/gcovr/index.html
LCOV code coverage report https://277.corosio.prtest3.cppalliance.org/genhtml/index.html
Coverage Diff Report https://277.corosio.prtest3.cppalliance.org/diff-report/index.html

Build time: 2026-06-12 16:55:46 UTC

sgerbino added 7 commits June 12, 2026 18:35
The reactor accept and wait completion paths reset the scheduler's
inline budget through desc_state_.scheduler_, which is only assigned
when do_listen registers the descriptor. Calling accept() on an open,
bound, but non-listening acceptor takes the immediate-error completion
path with that pointer still null and crashes. Guard both acceptor-side
resets; sockets register at open and are unaffected.

Add acceptor waiter-lifecycle tests for tcp and local stream on every
backend: stop-token cancel of a parked accept (the per-waiter stop
callback, distinct from acceptor-wide cancel()), accept of a connection
already queued in the listen backlog, accept without listen, and
io_context teardown with a parked accept.
dispatch_or_queue armed the waiter's stop callback while holding the
acceptor mutex. std::stop_callback invokes its callback synchronously
when the token is already stopped, so the canceller re-entered
cancel_waiter and self-deadlocked on the same mutex.

Arm the callback before the waiter is linked into waiters_ and outside
the mutex. A new queued flag (guarded by the mutex) lets cancel_waiter
distinguish a not-yet-queued waiter — in that case the initiation path
observes the cancelled flag under the lock and completes the op itself.
Arming before visibility also means the CQE handler can never claim and
delete a waiter whose callback is still being constructed, and a ready
fd that parks while the callback is armed is preferred over queueing
the waiter behind it.

Add precancel.cpp: initiate read, write, connect, accept, wait, and
every datagram op with a pre-stopped token on each backend and require
immediate canceled completion. This exercises the stop_now
short-circuits at the head of each io_uring initiation path and the
equivalent reactor checks, none of which were reached by the existing
cancel-after-park tests.
Add a dedicated test for the socket_option public header: get/set
round-trips for boolean, integer, and linger options on tcp, udp,
local stream, and local datagram sockets, bound-socket local_endpoint
readback, the closed-socket logic_error guards, and an unsupported
option reporting a system error.
Both TLS stream impls referenced their owner's stream_ member, so
moving an openssl_stream or wolfssl_stream left the impl reading and
writing through the moved-from object's empty any_stream. Store a
pointer instead and re-seat it onto the new owner's stream_ in the
move constructor and move assignment.

Add shared TLS tests: move construction before the handshake and move
assignment of a live session followed by data transfer, reads and
shutdown after the peer closes the transport without close_notify
(stream_truncated), a handshake whose server key is AES-encrypted PEM
loaded through the password callback, an unparseable-credentials
context failing the handshake cleanly, and a no-SNI client against a
server with a servername callback. Encrypted-key decryption is a
compile-time wolfSSL feature, so that backend only requires a clean
outcome with the callback invoked; a failsafe timer tears down the
transport if a feature-limited build stalls the handshake.
Parameterize the tcp_server suite on the backend tag via
COROSIO_BACKEND_TESTS so its accept-loop, worker dispatch, and stop
behavior run against each platform backend instead of only the
default one.
The per-backend suite registrations run as concurrent ctest processes,
and unseeded std::rand() produces the same sequence in each one, so
the rand-named temp files in stream_file, random_access_file, and
tls_context collided across processes. Name them with a random_device
seed plus an atomic counter instead.

Tests that destroy the io_context with ops still parked abandon the
suspended coroutine frames: op destroy() must not resume or destroy
them, so the frames are unreachable at exit and LeakSanitizer reports
them. Gate those teardown tests behind COROSIO_TEST_HAS_ASAN.
Parameterize the io_context suite on the backend tag so run, run_one,
poll, run_for, stop/restart, and the multithreaded tests exercise each
scheduler's loop machinery instead of only the default backend's. The
dedicated constructor-overload checks keep their default-backend forms.

Add edge tests: IPv6 parsing (uppercase hex, full-form embedded IPv4,
truncated and over-full group forms, malformed dotted octets), the
datagram connect_pair open-socket rejection, byte-sized IPv4 multicast
option round-trips (covering the single-byte getsockopt readback
normalization), v6_only, and the closed-acceptor accept/wait throw
guards including the returning accept() overload.
@codecov

codecov Bot commented Jun 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.77%. Comparing base (069ba7e) to head (59b2720).
⚠️ Report is 1 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #277      +/-   ##
===========================================
+ Coverage    77.73%   77.77%   +0.04%     
===========================================
  Files           96       96              
  Lines         7234     7218      -16     
  Branches      1764     1759       -5     
===========================================
- Hits          5623     5614       -9     
+ Misses        1102     1099       -3     
+ Partials       509      505       -4     
Files with missing lines Coverage Δ
src/openssl/src/openssl_stream.cpp 56.04% <ø> (-0.07%) ⬇️
src/wolfssl/src/wolfssl_stream.cpp 62.26% <ø> (+0.19%) ⬆️

Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 069ba7e...59b2720. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sgerbino sgerbino merged commit 637a90d into cppalliance:develop Jun 12, 2026
41 checks passed
@sgerbino sgerbino deleted the pr/coverage-ii branch June 12, 2026 21:43
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.

openssl_stream / wolfssl_stream move operations leave impl_->s_ dangling

2 participants