Skip to content

test: raise coverage toward 98% (task 4.5) - #191

Merged
lirenjie95 merged 6 commits into
masterfrom
refactor/4.5-coverage-98
Sep 8, 2026
Merged

test: raise coverage toward 98% (task 4.5)#191
lirenjie95 merged 6 commits into
masterfrom
refactor/4.5-coverage-98

Conversation

@lirenjie95

Copy link
Copy Markdown
Collaborator

First half of refactor-plan task 4.5 (coverage 93.04% -> 98% target). This PR targets the three largest zero/low-coverage blocks; the remaining error paths in rust2go-common/rust2go-macro and the Codecov threshold gate land in 4.5b.

  • rust2go-gen (generate(), 82 lines at 0%): integration tests run the full pipeline on the cgo/mem/g2r example fixtures with varied GenArgs and assert on generated-content markers (imports, shm templates, internal drop, package/main emission, go118 reflect helpers, the go fmt subprocess branch).
  • rust2go-cli (14 lines at 0%): unit tests for clap Args -> GenArgs, plus a CARGO_BIN_EXE_rust2go-cli end-to-end test covering main.rs.
  • mem-ring: notify EPIPE error path after peer close, Awaiter::new/wait roundtrip (monoio + tokio), WriteQueue::meta fd-ownership semantics, and the tokio handle variants (read_with_tokio_handle/write_with_tokio_handle/run_handler with explicit handle).

@codecov-commenter

codecov-commenter commented Sep 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.39%. Comparing base (3ca7e08) to head (230f8f4).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #191      +/-   ##
==========================================
+ Coverage   93.04%   97.39%   +4.35%     
==========================================
  Files          24       24              
  Lines        3578     3915     +337     
==========================================
+ Hits         3329     3813     +484     
+ Misses        249      102     -147     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

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

…4.5)

Coverage was 93.04%; the largest uncovered blocks were all invocable
directly once targeted:

- rust2go-gen: integration tests run generate() end-to-end on the cgo,
  mem (shm), and g2r example fixtures with varied GenArgs (go118,
  without_main, package name, no_fmt). In real builds generate() only
  runs inside build scripts, which coverage instrumentation never sees.
- rust2go-cli: unit tests for the clap Args -> GenArgs conversion and a
  CARGO_BIN_EXE end-to-end test covering main.rs.
- mem-ring: Notifier::notify error return after peer close (EPIPE),
  Awaiter::new/wait roundtrip under both runtimes, WriteQueue::meta fd
  ownership semantics after write(), and the tokio
  read_with_tokio_handle/write_with_tokio_handle/run_handler-with-handle
  variants.
@lirenjie95
lirenjie95 force-pushed the refactor/4.5-coverage-98 branch from 7c9127c to 4b47d55 Compare September 8, 2026 01:12
@lirenjie95 lirenjie95 changed the title test: cover generate(), the CLI shell, and mem-ring edge paths (task 4.5a) test: raise coverage toward 98% (task 4.5) Sep 8, 2026
- common.rs: tuple-struct rejection in both struct converters, unknown
  heck type rejection, the five ParamType::try_from error paths, all six
  'unrecognized rust primitive type' panic arms (driven by a manually
  built u128 ParamType), and the list-shape panic arms
- r2g/mod.rs: nine try_from rejection tests plus an attribute-matrix
  happy path (mem/shm ids, cgo aliases, go_pass_struct, drop_safe
  variants, send, ret_static reference flip)
- g2r/mod.rs: five rejection tests plus cgo alias, ffi_param_cnt and
  has_ret coverage
- rust2go: direct c_rust2go_internal_drop round-trip test
- unstuck flush: a still-full queue keeps remaining items pending
  (Err -> push_front -> break, stuck re-arm)
- working handler exits via the stop channel when its Guard is dropped;
  later pushes stay queued and the notify EPIPE is swallowed
- drain/yield/re-notify stress for the working handler loop

Note: the unstuck handler's own stop branch is unreachable by design
(the stop receiver lives in the shared WriteQueueInner that the handler
clone keeps alive) and is intentionally not tested here; tracked as a
known issue in the refactor plan.
The working handler drops the read queue when it exits; if the read
queue owned the shared memory, the buffer would be freed while the
write queue still points at it (glibc tcache corruption at teardown).
Swap the roles so the write side owns the memory.
Project status check with target 97% and threshold 0.5%, ratcheting the
coverage reached by this branch (97.39%). No patch gate, so adding
defensive or platform-specific code is never blocked. docs/ci.md
documents the gate and why the remaining misses are out of reach.
@lirenjie95
lirenjie95 merged commit 0272610 into master Sep 8, 2026
6 checks passed
@lirenjie95
lirenjie95 deleted the refactor/4.5-coverage-98 branch September 8, 2026 02:48
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