Skip to content

test: expand module regressions beyond 95% local line coverage - #58

Merged
esrrhs merged 4 commits into
masterfrom
test/module-coverage-95
Nov 18, 2026
Merged

esrrhs merged 4 commits into
masterfrom
test/module-coverage-95

Conversation

@esrrhs

@esrrhs esrrhs commented Nov 17, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add 123 descriptive GoogleTest cases in 31 existing module files, plus 36 Lua fixtures in their existing module directories. No new catch-all test file, test_coverage/cov_gaps naming, private PackSpec exposure, coverage-only hooks, denominator exclusions, or dead-code deletion.
  • Exercise compiler/semantic/C generation, interpreter/runtime ABI, closures, tables, strings/packing, IO/processes, HTTP/TCP/UDP/WebSocket, live MySQL/Redis, serialization/Protobuf, and the remaining native-library modules. Tests assert results, ownership, recovery and callback contracts rather than only executing lines.

Real regressions repaired

  • MySQL: queue SQL together with its callback so submissions cannot replace an in-flight query's callback; validate prepared-statement parameter counts before passing the binding vector to the client library.
  • UTF-8: guard direct generated-C iterator entries so invalid input cannot unwind C++ exceptions through TCC frames.
  • HTTP: validate response formatting before setting the writing flag, allowing a corrected reply after validation rejects the first attempt.
  • Redis: keep only an owned cloned reply, and translate clone/depth exceptions into operation errors instead of unwinding through hiredis; verify subsequent PING recovery.
  • Instrumented GCC JIT: disable reuse of instrumented shared images at the JIT boundary, preserving each compilation's gcno/gcda ownership while leaving the filesystem-cache implementation directly testable.

Validation on the exact committed source

  • Linux, GCC 14.2.0, Debug, USE_COV=ON, lcov 2.0; local MySQL/Redis fixtures available.
  • Cold full suite: 1825/1825 tests passed across 48 suites, followed by both CLI lifecycle and --once checks (exit 0).
  • 30,322 / 31,904 executable lines = 95.0413741223671%, strictly above 95%; 2,640/2,666 functions covered.
  • Captured on 2026-11-17 at 20:23 Asia/Shanghai. Before the run, all previous profiles were archived and verified, then all gcda counters were cleared and verified absent. Only this complete suite plus the two CLI processes contributed final counters; 1,343 source/test/config file hashes remained unchanged through validation.
  • Capture ran after process exit/unload flushing. Ordinary capture (not --initial) does not treat old unloaded generated-C images' gcno files as executed; old artifacts remain preserved locally. Instrumented generated images are freshly owned, not reused from prior runs.
  • Unchanged CI extraction scope: src/*, include/*, build-cov/jit_cov/*, --no-external; existing lcov error tolerances retained, no exclusions added.
  • Environment caveat: Codecov's latest master baseline is 26,326/29,649 = 88.79% (127 files), while this local capture has 120 files and 31,904 lines. Toolchain/preprocessing/profile and generated-C differences mean these are not identical denominators; the 95.041% figure is the clean local measurement, not a claim that remote CI has already reproduced it.
  • Root .clang-format, clang-format 21.1.8: all 39 changed C/C++ files pass dry-run/Werror; git diff --check passes. New C++ case names and Lua filenames/function names were audited for descriptive module placement.

Repository hygiene

  • Base master verified at 5ae28f02c02c581941180ee0e7391d24e7ec9d1b before push.
  • Author and committer are both esrrhs <esrrhs@163.com>.
  • No build output, profiles, logs, standalone coverage scripts/docs, environment credentials, or service data committed. The two original untracked artifacts are preserved byte-for-byte locally.
  • Not merged; remote CI is expected to validate platform-specific behavior.

@codecov-commenter

codecov-commenter commented Nov 17, 2026 •

Copy link
Copy Markdown

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

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.82%. Comparing base (5ae28f0) to head (6fcb399).
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #58      +/-   ##
==========================================
+ Coverage   88.79%   95.82%   +7.03%     
==========================================
  Files         127      127              
  Lines       29649    29751     +102     
==========================================
+ Hits        26326    28510    +2184     
+ Misses       3323     1241    -2082     

☔ 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.

Unpinned `choco install mysql` resolved to 26.10.0 and aborted mid-download
from cdn.mysql.com (connection reset / 404) before compile. Pin Approved
package 9.6.0, whose zip is still served, and retry transient CDN failures.

macOS Homebrew MySQL starts with an empty root password. The workflow only
detected that and created database test, so new tests that require the
documented root/root credentials never became healthy and exhausted their
wait loops. Set root/root and create the test database, matching Linux and
Windows.
test_crypto calls OpenSSL APIs directly, and fakelua.dll is built with
-Wl,--exclude-libs,ALL so those symbols are not re-exported. unit_tests
must therefore link OpenSSL::SSL and OpenSSL::Crypto itself. Mark the
imported targets IMPORTED_GLOBAL so test/ can use src/'s find_package
result without a second lookup that would miss the MinGW policy.
Windows CI failed 2 of 1824 tests on c4e5f27.

MakeClientContext ignored SSL_CTX_load_verify_locations failures, so a
missing tls_ca still started a connect to the default 127.0.0.1:8888.
Linux often surfaces ECONNREFUSED on the first poll; Windows does not,
and closed stayed 0. Fail the context when a specified CA cannot be
loaded so Connect() emits Close without starting a connection.

packsize("!8bXll") == 16 holds only when sizeof(long) is 8. On Windows
LLP64, long is 4 bytes and the size is 8. Keep the X-alignment checks
and compute the expected size from the native item sizes.
@esrrhs
esrrhs merged commit e1f27d1 into master Nov 18, 2026
9 checks passed
@esrrhs
esrrhs deleted the test/module-coverage-95 branch November 18, 2026 03:05
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