Skip to content

Commit d7048d5

Browse files
committed
unittest: add test to verify PUSCH grant for a pending SR is not allocated with all remaining RBs
1 parent 289a26f commit d7048d5

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

tests/unittests/scheduler/ue_scheduling/ue_grid_allocator_test.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,30 @@ TEST_P(ue_grid_allocator_tester, allocates_pusch_restricted_to_recommended_max_n
317317
ASSERT_EQ(find_ue_pusch(u1.crnti, res_grid[0].result.ul)->pusch_cfg.rbs.type1().length(), grant1.max_nof_rbs);
318318
}
319319

320+
TEST_P(ue_grid_allocator_tester, does_not_allocate_pusch_with_all_remaining_rbs_if_its_a_sr_indication)
321+
{
322+
sched_ue_creation_request_message ue_creation_req =
323+
test_helpers::create_default_sched_ue_creation_request(this->cfg_builder_params);
324+
ue_creation_req.ue_index = to_du_ue_index(0);
325+
ue_creation_req.crnti = to_rnti(0x4601);
326+
ue& u1 = add_ue(ue_creation_req);
327+
// Trigger a SR indication.
328+
u1.handle_sr_indication();
329+
330+
const ue_pusch_grant grant1{.user = &u1,
331+
.cell_index = to_du_cell_index(0),
332+
.h_id = to_harq_id(0),
333+
.recommended_nof_bytes = u1.pending_ul_newtx_bytes()};
334+
335+
const crb_interval cell_crbs = {cell_cfg.ul_cfg_common.init_ul_bwp.generic_params.crbs.start(),
336+
cell_cfg.ul_cfg_common.init_ul_bwp.generic_params.crbs.stop()};
337+
338+
ASSERT_TRUE(run_until([&]() { return alloc.allocate_ul_grant(grant1).status == alloc_status::success; }));
339+
ASSERT_TRUE(run_until([&]() { return find_ue_pusch(u1.crnti, res_grid[0].result.ul) != nullptr; }));
340+
// Successfully allocates PUSCH corresponding to the grant.
341+
ASSERT_LT(find_ue_pusch(u1.crnti, res_grid[0].result.ul)->pusch_cfg.rbs.type1().length(), cell_crbs.length());
342+
}
343+
320344
TEST_P(ue_grid_allocator_tester, no_two_pdschs_are_allocated_in_same_slot_for_a_ue)
321345
{
322346
static const unsigned nof_bytes_to_schedule = 400U;

0 commit comments

Comments
 (0)