| 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 |
# URL ?profile= parsing exercised through the public rist_parse_address2 API. |
| 47 |
test_url_profile_parse = executable('test_url_profile_parse', |
| 48 |
'test_url_profile_parse.c', |
| 49 |
include_directories : inc, |
| 50 |
link_with : librist) |
| 51 |
test('url_profile_parse', test_url_profile_parse, suite:['unit']) |
| 52 |
|
| 53 |
# ?profile= URL override semantics inside rist_peer_create. |
| 54 |
test_url_profile_override = executable('test_url_profile_override', |
| 55 |
'test_url_profile_override.c', |
| 56 |
include_directories : inc, |
| 57 |
link_with : librist) |
| 58 |
test('url_profile_override', test_url_profile_override, suite:['unit']) |
| 59 |
|
| 60 |
# ?srp-compat= URL parsing exercised through the public rist_parse_address2 API. |
| 61 |
test_url_srp_compat_parse = executable('test_url_srp_compat_parse', |
| 62 |
'test_url_srp_compat_parse.c', |
| 63 |
include_directories : inc, |
| 64 |
link_with : librist) |
| 65 |
test('url_srp_compat_parse', test_url_srp_compat_parse, suite:['unit']) |
| 66 |
|
| 67 |
# Versioned peer-config defaults gate fields by RIST_PEER_CONFIG_VERSION. |
| 68 |
test_peer_config_versioned_defaults = executable('test_peer_config_versioned_defaults', |
| 69 |
'test_peer_config_versioned_defaults.c', |
| 70 |
include_directories : inc, |
| 71 |
link_with : librist) |
| 72 |
test('peer_config_versioned_defaults', test_peer_config_versioned_defaults, suite:['unit']) |
| 73 |
|
| 74 |
# ?recovery-priority= URL parsing exercised through the public API. |
| 75 |
test_url_recovery_priority_parse = executable('test_url_recovery_priority_parse', |
| 76 |
'test_url_recovery_priority_parse.c', |
| 77 |
include_directories : inc, |
| 78 |
link_with : librist) |
| 79 |
test('url_recovery_priority_parse', test_url_recovery_priority_parse, suite:['unit']) |
| 80 |
|
| 81 |
# NACK routing peer-selection predicate (header-only, no link needed). |
| 82 |
test_nack_peer_select = executable('test_nack_peer_select', |
| 83 |
'test_nack_peer_select.c', |
| 84 |
include_directories : inc) |
| 85 |
test('nack_peer_select', test_nack_peer_select, suite:['unit']) |
| 86 |
|
| 87 |
# Receiver gap-detector sequence-number gap helper (rist_seq_gap): verifies |
| 88 |
# 16-bit wrap for short-sequence (Simple/Main) flows vs the true >64k gap for |
| 89 |
# 32-bit (Advanced) flows. Pure, link-free. |
| 90 |
test_seq_gap = executable('test_seq_gap', |
| 91 |
'test_seq_gap.c', |
| 92 |
include_directories : inc) |
| 93 |
test('seq_gap', test_seq_gap, suite:['unit']) |
| 94 |
|
| 95 |
# Expected-next-sequence helper (rist_seq_next): verifies 16-bit wrap for |
| 96 |
# short-sequence flows (incl. odd successors) and 32-bit successor for |
| 97 |
# Advanced flows. Pure, link-free. |
| 98 |
test_seq_next = executable('test_seq_next', |
| 99 |
'test_seq_next.c', |
| 100 |
include_directories : inc) |
| 101 |
test('seq_next', test_seq_next, suite:['unit']) |
| 102 |
|
| 103 |
# rist_recovery_depth_set() level -> ring-size mapping/resize contract. |
| 104 |
# Includes rist-private.h to inspect internal ring sizes. |
| 105 |
test_recovery_depth = executable('test_recovery_depth', |
| 106 |
'test_recovery_depth.c', |
| 107 |
include_directories : inc, |
| 108 |
link_with : librist, |
| 109 |
dependencies : [threads, stdatomic_dependency]) |
| 110 |
test('recovery_depth', test_recovery_depth, suite:['unit']) |
| 111 |
|
| 112 |
# ?recovery-depth= URL parsing exercised through the public API. |
| 113 |
test_url_recovery_depth_parse = executable('test_url_recovery_depth_parse', |
| 114 |
'test_url_recovery_depth_parse.c', |
| 115 |
include_directories : inc, |
| 116 |
link_with : librist) |
| 117 |
test('url_recovery_depth_parse', test_url_recovery_depth_parse, suite:['unit']) |