Skip to content

Commit 3d027a5

Browse files
carlo-galfrankist
authored andcommitted
sched: add PUCCH res manager unittest for 2 SRs
Signed-off-by: Carlo Galiotto <[email protected]>
1 parent 4107f48 commit 3d027a5

File tree

4 files changed

+35
-6
lines changed

4 files changed

+35
-6
lines changed

tests/unittests/scheduler/test_utils/config_generators.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,12 @@ inline uplink_config make_test_ue_uplink_config(const cell_config_builder_params
201201
pucch_resource& res10 = pucch_cfg.pucch_res_list.back();
202202
res10.res_id = 10;
203203
res10.starting_prb = 0;
204-
res10.second_hop_prb = nof_rbs - 1;
204+
205+
// >>> PUCCH resource 11.
206+
pucch_cfg.pucch_res_list.push_back(res_basic);
207+
pucch_resource& res11 = pucch_cfg.pucch_res_list.back();
208+
res11.res_id = 11;
209+
res11.starting_prb = nof_rbs - 3;
205210

206211
// TODO: add more PUCCH resources.
207212

tests/unittests/scheduler/uci_and_pucch/pucch_allocator_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ struct pucch_test_parameters {
6060
static expected_output_params_f1 make_expected_output_params_sr_only()
6161
{
6262
return expected_output_params_f1{.format = pucch_format::FORMAT_1,
63-
.prbs = prb_interval{0, 1},
63+
.prbs = prb_interval{NOF_RBS - 3, NOF_RBS - 2},
6464
.second_hop_prbs = prb_interval{0, 0},
6565
.symbols = ofdm_symbol_range{0, 14},
6666
.intra_slot_freq_hop = false,

tests/unittests/scheduler/uci_and_pucch/pucch_res_manager_test.cpp

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,19 @@ class test_pucch_resource_manager : public ::testing::Test
3838
pucch_cfg{ue_cell_cfg.cfg_dedicated().ul_config.value().init_ul_bwp.pucch_cfg.value()},
3939
sl_tx(slot_point(0, 0))
4040
{
41+
uplink_config ul_cfg = test_helpers::make_test_ue_uplink_config(cell_config_builder_params{});
42+
ul_cfg.init_ul_bwp.pucch_cfg.value().sr_res_list.front().pucch_res_id = 10;
43+
pucch_cfg_ue_2 = ul_cfg.init_ul_bwp.pucch_cfg.value();
4144
res_manager.slot_indication(sl_tx);
4245
};
4346

4447
protected:
4548
cell_configuration cell_cfg;
4649
ue_cell_configuration ue_cell_cfg;
4750
// Helper variable.
48-
const pucch_config& pucch_cfg;
51+
const pucch_config& pucch_cfg;
52+
// Config with alternative configuration for SR using PUCCH resource idx 10.
53+
pucch_config pucch_cfg_ue_2;
4954
pucch_resource_manager res_manager;
5055
slot_point sl_tx;
5156

@@ -366,13 +371,32 @@ TEST_F(test_pucch_resource_manager, test_allocation_release_sr_resource)
366371
// Release resource and verify it was successful.
367372
ASSERT_TRUE(res_manager.release_sr_resource(sl_tx, to_rnti(0x4601)));
368373

369-
// Assigne a different UE and verify it is assigned a resource.
374+
// Allocate SR to another UE and verify it is assigned a resource.
370375
const pucch_resource* sr_resource_ue2 = res_manager.reserve_sr_res_available(sl_tx, to_rnti(0x4602), pucch_cfg);
371376
ASSERT_FALSE(nullptr == sr_resource_ue2);
372377
unsigned sr_pucch_res_idx = pucch_cfg.pucch_res_list.size() - 1;
373378
ASSERT_EQ(&pucch_cfg.pucch_res_list[sr_pucch_res_idx], sr_resource_ue2);
374379
}
375380

381+
// Tests SRs for 2 UEs using different PUCCH resource indices.
382+
TEST_F(test_pucch_resource_manager, test_allocation_2_sr_resource)
383+
{
384+
res_manager.reserve_sr_res_available(sl_tx, to_rnti(0x4601), pucch_cfg);
385+
res_manager.reserve_sr_res_available(sl_tx, to_rnti(0x4602), pucch_cfg_ue_2);
386+
387+
// Attempt to allocate UEs over already used SR resources.
388+
ASSERT_EQ(nullptr, res_manager.reserve_sr_res_available(sl_tx, to_rnti(0x4603), pucch_cfg));
389+
ASSERT_EQ(nullptr, res_manager.reserve_sr_res_available(sl_tx, to_rnti(0x4604), pucch_cfg_ue_2));
390+
391+
// Release resource and verify it was successful.
392+
ASSERT_TRUE(res_manager.release_sr_resource(sl_tx, to_rnti(0x4601)));
393+
ASSERT_TRUE(res_manager.release_sr_resource(sl_tx, to_rnti(0x4602)));
394+
395+
// Attempt to allocate UEs over released SR resources.
396+
ASSERT_NE(nullptr, res_manager.reserve_sr_res_available(sl_tx, to_rnti(0x4603), pucch_cfg));
397+
ASSERT_NE(nullptr, res_manager.reserve_sr_res_available(sl_tx, to_rnti(0x4604), pucch_cfg_ue_2));
398+
}
399+
376400
int main(int argc, char** argv)
377401
{
378402
srslog::fetch_basic_logger("TEST").set_level(srslog::basic_levels::info);

tests/unittests/scheduler/uci_and_pucch/uci_scheduling_test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class test_pucch_output_sr_only : public ::testing::TestWithParam<sr_periodicity
5353
pucch_expected.crnti = to_rnti(0x4601);
5454
pucch_expected.bwp_cfg = &t_bench.cell_cfg.ul_cfg_common.init_ul_bwp.generic_params;
5555

56-
pucch_expected.resources.prbs = prb_interval{0, 1};
56+
pucch_expected.resources.prbs = prb_interval{49, 50};
5757
pucch_expected.resources.second_hop_prbs = prb_interval{0, 0};
5858
pucch_expected.resources.symbols = ofdm_symbol_range{0, 14};
5959

@@ -132,7 +132,7 @@ class test_pucch_output_sr_harq : public ::testing::TestWithParam<sr_periodicity
132132
pucch_expected.crnti = to_rnti(0x4601);
133133
pucch_expected.bwp_cfg = &t_bench.cell_cfg.ul_cfg_common.init_ul_bwp.generic_params;
134134

135-
pucch_expected.resources.prbs = prb_interval{0, 1};
135+
pucch_expected.resources.prbs = prb_interval{49, 50};
136136
pucch_expected.resources.second_hop_prbs = prb_interval{0, 0};
137137
pucch_expected.resources.symbols = ofdm_symbol_range{0, 14};
138138

0 commit comments

Comments
 (0)