Commit 2b3568d
committed
test: lift unit coverage from 81% to ~92% on Linux
Adds targeted unit tests across the public API and native shadow layers
to close the largest line-coverage gaps in the develop baseline.
Major areas:
- tls_context: cover malformed PEM, mismatched cert/key, cipher list,
protocol version round-trip, verify mode/depth, hostname, SNI/ALPN,
CRL, OCSP staple, password callback (24% to 100%).
- io_context and scheduler detail: backend tag construction, run_for,
run_until, restart, post-throws, deterministic multithreaded
notify_one + wait_for coverage.
- socket_option: set/get round-trip for every public option plus the
native templated variants; wrong-protocol error paths.
- local sockets: connect/accept error paths, abstract namespace,
path-length boundary, mid-flight cancel, datagram send/recv. Adopt
the temp_socket_dir helper introduced upstream.
- reactor internals: concurrent read/write on same descriptor,
mid-flight cancel, close-during-op, wait_type::error paths, stop-token
cancellation. Add reactor_paths.cpp aggregating these scenarios.
- tcp_server, posix_resolver_service, host_name, file services:
lifecycle, accept loop, flag variants, error mapping.
- Add testConstructionWithThreadPoolSize regression for the resolver
use_service fix.
Cross-platform reconciliation observed in CI:
- BSD-family kernels reject multicast set_option values (zero buffer
sizes, leave-without-route, IPV6 ifindex 0) that Linux accepts;
wrap in try/catch with documented platform variation.
- macOS returns EMSGSIZE for zero-length UDP datagrams; broaden the
expectation to any error so MinGW and others pass too.
- Windows IOCP: gate testIoContextOptionsMaxEventsZero/BudgetInitClamp
and the single-threaded resolver tests as POSIX-only; relax buffer
size assertions to permit Windows's accept-zero-as-zero contract.
- POSIX-guard local socket tests that exercise abstract namespace and
related Linux-only behavior.
- testMultithreadedNotifyAndWaitFor restructured to depend only on a
work guard and counter drain, not on wall-clock timing, so it
remains deterministic under thread-sanitizer.
- Signal-set shutdown test switched from POSIX-only SIGUSR1/2 to the
portable SIGINT/SIGTERM pair.1 parent 7bbebc7 commit 2b3568d
26 files changed
Lines changed: 5109 additions & 213 deletions
File tree
- test/unit
- native
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
13 | 15 | | |
14 | 16 | | |
15 | 17 | | |
| |||
253 | 255 | | |
254 | 256 | | |
255 | 257 | | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
256 | 301 | | |
257 | 302 | | |
258 | 303 | | |
| |||
642 | 687 | | |
643 | 688 | | |
644 | 689 | | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
645 | 773 | | |
646 | 774 | | |
647 | 775 | | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
648 | 779 | | |
649 | 780 | | |
650 | 781 | | |
| |||
653 | 784 | | |
654 | 785 | | |
655 | 786 | | |
| 787 | + | |
656 | 788 | | |
657 | 789 | | |
658 | 790 | | |
659 | 791 | | |
660 | 792 | | |
661 | 793 | | |
| 794 | + | |
662 | 795 | | |
663 | 796 | | |
| 797 | + | |
664 | 798 | | |
665 | 799 | | |
666 | 800 | | |
| |||
686 | 820 | | |
687 | 821 | | |
688 | 822 | | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
689 | 837 | | |
690 | 838 | | |
691 | 839 | | |
| 840 | + | |
692 | 841 | | |
693 | 842 | | |
694 | 843 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
150 | 191 | | |
151 | 192 | | |
152 | 193 | | |
| |||
202 | 243 | | |
203 | 244 | | |
204 | 245 | | |
| 246 | + | |
| 247 | + | |
205 | 248 | | |
| 249 | + | |
206 | 250 | | |
| 251 | + | |
207 | 252 | | |
208 | 253 | | |
209 | 254 | | |
| |||
0 commit comments