Skip to content

Improve test coverage - #47

Merged
RaphiaRa merged 4 commits into
mainfrom
improve_test_coverage
Aug 12, 2026
Merged

Improve test coverage#47
RaphiaRa merged 4 commits into
mainfrom
improve_test_coverage

Conversation

@RaphiaRa

Copy link
Copy Markdown
Owner

Improve test coverage of:

  • acceptor
  • address
  • cookie_parser
  • dir_mgr
  • conn_tracker

- extract th_addrinfo (getaddrinfo/freeaddrinfo mirrored 1:1) into
  th_address, resolved once by th_listener before opening the acceptor
- add TH_ERR_CATEGORY_EAI for getaddrinfo's EAI_* codes, distinct from
  errno; EAI_SYSTEM still maps to TH_ERR_SYSTEM(errno)
- split th_acceptor_ops.open into socket/setsockopt/set_nonblocking/
  bind/listen/close, one op per syscall, so tests can fake each step
- add TH_EADDRINUSE
- th_test_allocator_fail_after(n) makes the Nth alloc/realloc call
  return NULL, self-resetting once triggered; also reset at the start
  of every test case so a leftover countdown can't leak into the next
- add th_dir_mgr_add coverage looping fail_after over every step,
  verifying the eventual success is actually visible via a get
Covers tracking on init/deinit, count across multiple conns,
async_wait's fire-on-any-destroy-while-armed/once-only behavior, and
cancel_all - using a fake th_conn_observable, no real socket needed.
Cover a cookie-name starting with a separator, tabs before the value,
and a control character inside a quoted value.
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 55.40541% with 33 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/th_acceptor.c 40.47% 22 Missing and 3 partials ⚠️
src/th_address.c 88.88% 2 Missing and 1 partial ⚠️
src/th_listener.c 0.00% 3 Missing ⚠️
src/th_error.c 0.00% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@RaphiaRa
RaphiaRa merged commit f8243b9 into main Aug 12, 2026
3 checks passed
@RaphiaRa
RaphiaRa deleted the improve_test_coverage branch August 12, 2026 12:37
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.

2 participants