Debian Codegraph @

test/rist/unit/meson.build

raw
1 cmocka = dependency('cmocka', required: false, fallback: ['cmocka', 'cmocka_dep'])
2
3 if cmocka.found()
4 if have_srp
5 # stdatomic_dependency mirrors the main librist target so the
6 # srp_unit translation units pick up the compat/msvc shim when
7 # MSVC's <stdatomic.h> requires /experimental:c11atomics.
8 srp_unit_deps = [threads, cmocka, crypto_deps, stdatomic_dependency]
9 if host_machine.system() == 'windows'
10 srp_unit_deps += cc.find_library('bcrypt') # random.c calls BCryptGenRandom
11 endif
12 srp_unit = executable('srp_unit', rev_target,
13 'srp_examples.c',
14 '../../../contrib/pthread-shim.c',
15 '../../../src/crypto/random.c',
16 include_directories : inc,
17 dependencies : srp_unit_deps,
18 )
19
20 test('srp_unit_test', srp_unit, suite:['unit'])
21 endif
22 endif
23
24 # Regression test for #208: rist_logging_set with a remote (udp://)
25 # address must succeed before any rist_*_create call. Does not require
26 # cmocka - links against the public librist API only.
27 logging_init_order = executable('logging_init_order',
28 'logging_init_order.c',
29 include_directories : inc,
30 link_with : librist)
31 test('logging_init_order', logging_init_order, suite:['unit'])
32
33 # Advanced Profile (TR-06-3) header parse/build round-trip tests.
34 # Compiles adv.c directly to access RIST_PRIV (hidden-visibility) symbols.
35 adv_test_deps = [lz4_lib]
36 if host_machine.system() == 'windows'
37 adv_test_deps += cc.find_library('ws2_32')
38 endif
39 test_adv_roundtrip = executable('test_adv_roundtrip',
40 'test_adv_roundtrip.c',
41 '../../../src/adv.c',
42 include_directories : inc,
43 dependencies : adv_test_deps)
44 test('adv_roundtrip', test_adv_roundtrip, suite:['unit'])
45
46 # EAP v4 crypto primitives (HKDF-Expand-SHA256 + AES-256-GCM) known-answer tests.
47 # Compiles eap_v4_crypto.c directly to reach RIST_PRIV (hidden-visibility)
48 # symbols. Gated on have_srp, which implies a real crypto backend (mbedTLS or
49 # Nettle) is present; the built-in fallback has no AEAD.
50 if have_srp
51 eap_v4_crypto_deps = [crypto_deps]
52 if host_machine.system() == 'windows'
53 eap_v4_crypto_deps += cc.find_library('bcrypt') # mbedcrypto entropy_poll calls BCryptGenRandom
54 endif
55 test_eap_v4_crypto = executable('test_eap_v4_crypto',
56 'test_eap_v4_crypto.c',
57 '../../../src/crypto/eap_v4_crypto.c',
58 include_directories : inc,
59 dependencies : eap_v4_crypto_deps)
60 test('eap_v4_crypto', test_eap_v4_crypto, suite:['unit'])
61 endif
62
63 # URL ?profile= parsing exercised through the public rist_parse_address2 API.
64 test_url_profile_parse = executable('test_url_profile_parse',
65 'test_url_profile_parse.c',
66 include_directories : inc,
67 link_with : librist)
68 test('url_profile_parse', test_url_profile_parse, suite:['unit'])
69
70 # ?profile= URL override semantics inside rist_peer_create.
71 test_url_profile_override = executable('test_url_profile_override',
72 'test_url_profile_override.c',
73 include_directories : inc,
74 link_with : librist)
75 test('url_profile_override', test_url_profile_override, suite:['unit'])
76
77 # ?srp-compat= URL parsing exercised through the public rist_parse_address2 API.
78 test_url_srp_compat_parse = executable('test_url_srp_compat_parse',
79 'test_url_srp_compat_parse.c',
80 include_directories : inc,
81 link_with : librist)
82 test('url_srp_compat_parse', test_url_srp_compat_parse, suite:['unit'])
83
84 # Versioned peer-config defaults gate fields by RIST_PEER_CONFIG_VERSION.
85 test_peer_config_versioned_defaults = executable('test_peer_config_versioned_defaults',
86 'test_peer_config_versioned_defaults.c',
87 include_directories : inc,
88 link_with : librist)
89 test('peer_config_versioned_defaults', test_peer_config_versioned_defaults, suite:['unit'])
90
91 # ?recovery-priority= URL parsing exercised through the public API.
92 test_url_recovery_priority_parse = executable('test_url_recovery_priority_parse',
93 'test_url_recovery_priority_parse.c',
94 include_directories : inc,
95 link_with : librist)
96 test('url_recovery_priority_parse', test_url_recovery_priority_parse, suite:['unit'])
97
98 # NACK routing peer-selection predicate (header-only, no link needed).
99 test_nack_peer_select = executable('test_nack_peer_select',
100 'test_nack_peer_select.c',
101 include_directories : inc)
102 test('nack_peer_select', test_nack_peer_select, suite:['unit'])
103
104 # Receiver gap-detector sequence-number gap helper (rist_seq_gap): verifies
105 # 16-bit wrap for short-sequence (Simple/Main) flows vs the true >64k gap for
106 # 32-bit (Advanced) flows. Pure, link-free.
107 test_seq_gap = executable('test_seq_gap',
108 'test_seq_gap.c',
109 include_directories : inc)
110 test('seq_gap', test_seq_gap, suite:['unit'])
111
112 # Expected-next-sequence helper (rist_seq_next): verifies 16-bit wrap for
113 # short-sequence flows (incl. odd successors) and 32-bit successor for
114 # Advanced flows. Pure, link-free.
115 test_seq_next = executable('test_seq_next',
116 'test_seq_next.c',
117 include_directories : inc)
118 test('seq_next', test_seq_next, suite:['unit'])
119
120 # rist_recovery_depth_set() level -> ring-size mapping/resize contract.
121 # Includes rist-private.h to inspect internal ring sizes.
122 test_recovery_depth = executable('test_recovery_depth',
123 'test_recovery_depth.c',
124 include_directories : inc,
125 link_with : librist,
126 dependencies : [threads, stdatomic_dependency])
127 test('recovery_depth', test_recovery_depth, suite:['unit'])
128
129 # udp:// scheme-prefix parsing: guards prefix[16] against copy-length
130 # underflow (leading '/') and out-of-bounds NUL write (over-long scheme).
131 test_url_udp_prefix_parse = executable('test_url_udp_prefix_parse',
132 'test_url_udp_prefix_parse.c',
133 include_directories : inc,
134 link_with : librist)
135 test('url_udp_prefix_parse', test_url_udp_prefix_parse, suite:['unit'])
136
137 # ?recovery-depth= URL parsing exercised through the public API.
138 test_url_recovery_depth_parse = executable('test_url_recovery_depth_parse',
139 'test_url_recovery_depth_parse.c',
140 include_directories : inc,
141 link_with : librist)
142 test('url_recovery_depth_parse', test_url_recovery_depth_parse, suite:['unit'])
143
144 # Retransmission sequence-domain predicate (header-only, no link needed):
145 # an Advanced head-end serving a Main-downgraded peer must resolve that
146 # peer's NACKs in the 16-bit RTP domain, else recovered_packets_total = 0.
147 test_retx_seq_domain = executable('test_retx_seq_domain',
148 'test_retx_seq_domain.c',
149 include_directories : inc)
150 test('retx_seq_domain', test_retx_seq_domain, suite:['unit'])
151
152 # Advanced Profile receive-side 1 MHz source-clock reconstruction
153 # (rist_adv_ts_reconstruct): wrap-safe delta accumulation, retransmit
154 # positioning, and the bounded-delta fallback to arrival. Pure, link-free.
155 test_adv_ts_reconstruct = executable('test_adv_ts_reconstruct',
156 'test_adv_ts_reconstruct.c',
157 include_directories : inc)
158 test('adv_ts_reconstruct', test_adv_ts_reconstruct, suite:['unit'])
159
160 # Flow re-anchor staleness guard: a packet from a leg queued deeper than the
161 # buffer must not become the flow baseline. Header-only, no link.
162 test_reanchor = executable('test_reanchor',
163 'test_reanchor.c',
164 include_directories : inc)
165 test('reanchor', test_reanchor, suite:['unit'])
166
167 # Grace period that keeps a silent peer in the send rotation for one recovery
168 # buffer window (#196), so a late RTCP reply does not cut a single-path stream
169 # whose receiver is still there. Header-only, no link.
170 test_send_grace = executable('test_send_grace',
171 'test_send_grace.c',
172 include_directories : inc)
173 test('send_grace', test_send_grace, suite:['unit'])
174
175 # RTT-based bonded-leg muting hysteresis state machine (header-only, no link).
176 test_rtt_mute = executable('test_rtt_mute',
177 'test_rtt_mute.c',
178 include_directories : inc)
179 test('rtt_mute', test_rtt_mute, suite:['unit'])
180
181 # Retransmission-budget guard: ?bandwidth= caps payload plus retransmissions
182 # together, so a ceiling at or under the payload rate refuses every NACK while
183 # only logging it at debug level. Header-only, no link.
184 test_bandwidth_guard = executable('test_bandwidth_guard',
185 'test_bandwidth_guard.c',
186 include_directories : inc)
187 test('bandwidth_guard', test_bandwidth_guard, suite:['unit'])
188
189 # recovery_maxbitrate = 0 through the C API means "unset", not "no ceiling",
190 # and must be replaced with the default before a peer runs (#229).
191 test_recovery_maxbitrate_zero = executable('test_recovery_maxbitrate_zero',
192 'test_recovery_maxbitrate_zero.c',
193 include_directories : inc,
194 link_with : librist)
195 test('recovery_maxbitrate_zero', test_recovery_maxbitrate_zero, suite:['unit'])
196
197 # ?rtt-drop= et al URL parsing exercised through the public API.
198 test_url_rtt_drop_parse = executable('test_url_rtt_drop_parse',
199 'test_url_rtt_drop_parse.c',
200 include_directories : inc,
201 link_with : librist)
202 test('url_rtt_drop_parse', test_url_rtt_drop_parse, suite:['unit'])
203
204 # ?multiplex-mode= / ?rtp-ptype= URL parsing at the compiled-in udp config
205 # version, so a bump cannot leave either unreachable.
206 test_url_udp_versioned_params = executable('test_url_udp_versioned_params',
207 'test_url_udp_versioned_params.c',
208 include_directories : inc,
209 link_with : librist)
210 test('url_udp_versioned_params', test_url_udp_versioned_params, suite:['unit'])
211
212 # TUN CIDR parsing (IPv4 + IPv6) used by risttunnel -l.
213 test_tun_cidr_parse = executable('test_tun_cidr_parse',
214 'test_tun_cidr_parse.c',
215 include_directories : inc,
216 link_with : librist)
217 test('tun_cidr_parse', test_tun_cidr_parse, suite:['unit'])
218
219 # CBR output pacing scheduler (rist_pacer): rate estimate, occupancy trim,
220 # due-time schedule and slip resync. Every failure mode of this module still
221 # emits packets -- at the wrong cadence or the wrong rate -- so the invariants
222 # are asserted rather than inspected, including a full-sequence cross-check
223 # against an independent transcription of the algorithm.
224 test_rist_pacer = executable('test_rist_pacer',
225 'rist_pacer_test.c',
226 '../../../src/rist_pacer.c',
227 include_directories : inc)
228 test('rist_pacer', test_rist_pacer, suite:['unit'])
229
230 # ?cbr-output= parsing plus its context-wide override semantics. The setting is
231 # not per-peer -- a flow's legs share one output -- so conflicting peers must be
232 # refused rather than silently resolved.
233 test_url_cbr_output = executable('test_url_cbr_output',
234 'test_url_cbr_output.c',
235 include_directories : inc,
236 link_with : librist)
237 test('url_cbr_output', test_url_cbr_output, suite:['unit'])