Skip to content

Commit a4795fd

Browse files
update the tests
1 parent 0615c0b commit a4795fd

7 files changed

Lines changed: 215 additions & 232 deletions

tests/src/test_e2e_api.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ void test_reliable_delivery_under_losses()
157157
res = instrumented_allocator_make_resource(&pub_tx_alloc_payload);
158158
}
159159
const udpard_rx_mem_resources_t pub_rx_mem{ .session = instrumented_allocator_make_resource(&pub_rx_alloc_session),
160+
.slot = instrumented_allocator_make_resource(&pub_rx_alloc_session),
160161
.fragment = instrumented_allocator_make_resource(&pub_rx_alloc_frag) };
161162

162163
udpard_tx_mem_resources_t sub_tx_mem{};
@@ -165,6 +166,7 @@ void test_reliable_delivery_under_losses()
165166
res = instrumented_allocator_make_resource(&sub_tx_alloc_payload);
166167
}
167168
const udpard_rx_mem_resources_t sub_rx_mem{ .session = instrumented_allocator_make_resource(&sub_rx_alloc_session),
169+
.slot = instrumented_allocator_make_resource(&sub_rx_alloc_session),
168170
.fragment = instrumented_allocator_make_resource(&sub_rx_alloc_frag) };
169171

170172
// Publisher node: single TX, single RX (linked to TX for ACK processing).
@@ -368,6 +370,7 @@ void test_reliable_stats_and_failures()
368370
instrumented_allocator_new(&src_alloc_transfer);
369371
instrumented_allocator_new(&src_alloc_payload);
370372
const udpard_rx_mem_resources_t rx_mem{ .session = instrumented_allocator_make_resource(&rx_alloc_session),
373+
.slot = instrumented_allocator_make_resource(&rx_alloc_session),
371374
.fragment = instrumented_allocator_make_resource(&rx_alloc_frag) };
372375
udpard_tx_mem_resources_t src_mem{};
373376
src_mem.transfer = instrumented_allocator_make_resource(&src_alloc_transfer);

tests/src/test_e2e_edge.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ struct Fixture
119119
res = instrumented_allocator_make_resource(&tx_alloc_payload);
120120
}
121121
const udpard_rx_mem_resources_t rx_mem{ .session = instrumented_allocator_make_resource(&rx_alloc_session),
122+
.slot = instrumented_allocator_make_resource(&rx_alloc_session),
122123
.fragment = instrumented_allocator_make_resource(&rx_alloc_frag) };
123124
tx_payload_deleter = udpard_deleter_t{ .vtable = &tx_refcount_deleter_vt, .context = nullptr };
124125
source = { .ip = 0x0A000001U, .port = 7501U };
@@ -328,6 +329,7 @@ void test_udpard_tx_push_p2p()
328329
tx.user = &frames;
329330

330331
const udpard_rx_mem_resources_t rx_mem{ .session = instrumented_allocator_make_resource(&rx_alloc_session),
332+
.slot = instrumented_allocator_make_resource(&rx_alloc_session),
331333
.fragment = instrumented_allocator_make_resource(&rx_alloc_frag) };
332334
udpard_rx_t rx{};
333335
udpard_rx_port_t port{};
@@ -390,6 +392,7 @@ void test_udpard_tx_minimum_mtu()
390392
res = instrumented_allocator_make_resource(&tx_alloc_payload);
391393
}
392394
const udpard_rx_mem_resources_t rx_mem{ .session = instrumented_allocator_make_resource(&rx_alloc_session),
395+
.slot = instrumented_allocator_make_resource(&rx_alloc_session),
393396
.fragment = instrumented_allocator_make_resource(&rx_alloc_frag) };
394397

395398
udpard_tx_t tx{};
@@ -503,6 +506,7 @@ void test_udpard_rx_zero_extent()
503506
res = instrumented_allocator_make_resource(&tx_alloc_payload);
504507
}
505508
const udpard_rx_mem_resources_t rx_mem{ .session = instrumented_allocator_make_resource(&rx_alloc_session),
509+
.slot = instrumented_allocator_make_resource(&rx_alloc_session),
506510
.fragment = instrumented_allocator_make_resource(&rx_alloc_frag) };
507511

508512
udpard_tx_t tx{};

tests/src/test_e2e_random.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ void test_udpard_tx_rx_end_to_end()
207207
instrumented_allocator_t rx_alloc_session{};
208208
instrumented_allocator_new(&rx_alloc_session);
209209
const udpard_rx_mem_resources_t rx_mem{ .session = instrumented_allocator_make_resource(&rx_alloc_session),
210+
.slot = instrumented_allocator_make_resource(&rx_alloc_session),
210211
.fragment = instrumented_allocator_make_resource(&rx_alloc_frag) };
211212
udpard_rx_t rx;
212213
udpard_rx_new(&rx, &ack_tx);
@@ -215,6 +216,7 @@ void test_udpard_tx_rx_end_to_end()
215216
instrumented_allocator_new(&ack_rx_alloc_frag);
216217
instrumented_allocator_new(&ack_rx_alloc_session);
217218
const udpard_rx_mem_resources_t ack_rx_mem{ .session = instrumented_allocator_make_resource(&ack_rx_alloc_session),
219+
.slot = instrumented_allocator_make_resource(&ack_rx_alloc_session),
218220
.fragment = instrumented_allocator_make_resource(&ack_rx_alloc_frag) };
219221
udpard_rx_t ack_rx{};
220222
udpard_rx_port_t ack_port{};

tests/src/test_e2e_responses.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ void test_topic_with_p2p_response()
215215
res = instrumented_allocator_make_resource(&a_tx_alloc_payload);
216216
}
217217
const udpard_rx_mem_resources_t a_rx_mem{ .session = instrumented_allocator_make_resource(&a_rx_alloc_session),
218+
.slot = instrumented_allocator_make_resource(&a_rx_alloc_session),
218219
.fragment = instrumented_allocator_make_resource(&a_rx_alloc_frag) };
219220

220221
udpard_tx_mem_resources_t b_tx_mem{};
@@ -223,6 +224,7 @@ void test_topic_with_p2p_response()
223224
res = instrumented_allocator_make_resource(&b_tx_alloc_payload);
224225
}
225226
const udpard_rx_mem_resources_t b_rx_mem{ .session = instrumented_allocator_make_resource(&b_rx_alloc_session),
227+
.slot = instrumented_allocator_make_resource(&b_rx_alloc_session),
226228
.fragment = instrumented_allocator_make_resource(&b_rx_alloc_frag) };
227229

228230
// ================================================================================================================
@@ -497,6 +499,7 @@ void test_topic_with_p2p_response_under_loss()
497499
res = instrumented_allocator_make_resource(&a_tx_alloc_payload);
498500
}
499501
const udpard_rx_mem_resources_t a_rx_mem{ .session = instrumented_allocator_make_resource(&a_rx_alloc_session),
502+
.slot = instrumented_allocator_make_resource(&a_rx_alloc_session),
500503
.fragment = instrumented_allocator_make_resource(&a_rx_alloc_frag) };
501504

502505
udpard_tx_mem_resources_t b_tx_mem{};
@@ -505,6 +508,7 @@ void test_topic_with_p2p_response_under_loss()
505508
res = instrumented_allocator_make_resource(&b_tx_alloc_payload);
506509
}
507510
const udpard_rx_mem_resources_t b_rx_mem{ .session = instrumented_allocator_make_resource(&b_rx_alloc_session),
511+
.slot = instrumented_allocator_make_resource(&b_rx_alloc_session),
508512
.fragment = instrumented_allocator_make_resource(&b_rx_alloc_frag) };
509513

510514
// ================================================================================================================

tests/src/test_integration_sockets.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ struct RxFixture
203203
instrumented_allocator_new(&session);
204204
instrumented_allocator_new(&fragment);
205205
mem.session = instrumented_allocator_make_resource(&session);
206+
mem.slot = instrumented_allocator_make_resource(&session);
206207
mem.fragment = instrumented_allocator_make_resource(&fragment);
207208
udpard_rx_new(&rx, nullptr);
208209
rx.user = &ctx;

tests/src/test_intrusive_guards.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,9 @@ static void test_rx_guards(void)
257257
// RX port creation guards reject invalid parameters.
258258
static char rx_tag_a;
259259
static char rx_tag_b;
260-
const udpard_rx_mem_resources_t rx_mem = { .session = make_mem(&rx_tag_a), .fragment = make_mem(&rx_tag_b) };
260+
const udpard_rx_mem_resources_t rx_mem = { .session = make_mem(&rx_tag_a),
261+
.slot = make_mem(&rx_tag_a),
262+
.fragment = make_mem(&rx_tag_b) };
261263
const udpard_rx_port_vtable_t rx_vtb = { .on_message = on_message_stub };
262264
udpard_rx_port_t port;
263265
TEST_ASSERT_FALSE(udpard_rx_port_new(NULL, 0, rx_mem, &rx_vtb));
@@ -275,6 +277,11 @@ static void test_rx_guards(void)
275277
TEST_ASSERT_FALSE(rx_validate_mem_resources(bad_session));
276278
bad_session.session.vtable = &vtable_no_alloc;
277279
TEST_ASSERT_FALSE(rx_validate_mem_resources(bad_session));
280+
udpard_rx_mem_resources_t bad_slot = rx_mem;
281+
bad_slot.slot.vtable = &vtable_no_free;
282+
TEST_ASSERT_FALSE(rx_validate_mem_resources(bad_slot));
283+
bad_slot.slot.vtable = &vtable_no_alloc;
284+
TEST_ASSERT_FALSE(rx_validate_mem_resources(bad_slot));
278285
udpard_rx_mem_resources_t bad_fragment = rx_mem;
279286
bad_fragment.fragment.vtable = &vtable_no_free;
280287
TEST_ASSERT_FALSE(rx_validate_mem_resources(bad_fragment));

0 commit comments

Comments
 (0)