Skip to content

Commit 0c628e5

Browse files
committed
sched: use auto-crc/uci indication feature in sched unit tests
1 parent 76f109e commit 0c628e5

File tree

2 files changed

+10
-80
lines changed

2 files changed

+10
-80
lines changed

tests/unittests/scheduler/scheduler_multi_grants_test.cpp

Lines changed: 5 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@ class base_sched_grants_per_slot_test : public scheduler_test_simulator
3131
{
3232
protected:
3333
base_sched_grants_per_slot_test(unsigned max_ul_grants_per_slot = 32) :
34-
scheduler_test_simulator(create_custom_sched_cfg(max_ul_grants_per_slot), 4, subcarrier_spacing::kHz30),
34+
scheduler_test_simulator(scheduler_test_sim_config{create_custom_sched_cfg(max_ul_grants_per_slot),
35+
4,
36+
subcarrier_spacing::kHz30,
37+
true,
38+
true}),
3539
params(cell_config_builder_profiles::tdd())
3640
{
3741
auto sched_cell_cfg_req = sched_config_helper::make_default_sched_cell_configuration_request(params);
@@ -75,47 +79,6 @@ class base_sched_grants_per_slot_test : public scheduler_test_simulator
7579
this->push_bsr(bsr);
7680
}
7781

78-
void run_slot()
79-
{
80-
scheduler_test_simulator::run_slot();
81-
82-
// Handle UCI and CRC indications.
83-
uci_indication uci_ind;
84-
uci_ind.cell_index = to_du_cell_index(0);
85-
uci_ind.slot_rx = this->last_result_slot();
86-
ul_crc_indication crc_ind;
87-
crc_ind.cell_index = to_du_cell_index(0);
88-
crc_ind.sl_rx = last_result_slot();
89-
90-
span<const ul_sched_info> ul_grants = this->last_sched_res_list[0]->ul.puschs;
91-
92-
// Handle PUCCHs.
93-
for (const pucch_info& pucch : this->last_sched_res_list[to_du_cell_index(0)]->ul.pucchs) {
94-
if (pucch.format() == pucch_format::FORMAT_1 and pucch.uci_bits.sr_bits != sr_nof_bits::no_sr) {
95-
// Skip SRs for this test.
96-
continue;
97-
}
98-
du_ue_index_t ue_idx = to_du_ue_index((unsigned)pucch.crnti - 0x4601);
99-
uci_ind.ucis.push_back(test_helper::create_uci_indication_pdu(ue_idx, pucch));
100-
}
101-
102-
// Handle CRCs and PUSCH UCIs.
103-
for (const ul_sched_info& grant : ul_grants) {
104-
crc_ind.crcs.emplace_back(test_helper::create_crc_pdu_indication(grant));
105-
if (grant.uci.has_value()) {
106-
uci_ind.ucis.push_back(
107-
test_helper::create_uci_indication_pdu(grant.pusch_cfg.rnti, grant.context.ue_index, grant.uci.value()));
108-
}
109-
}
110-
111-
if (not uci_ind.ucis.empty()) {
112-
this->sched->handle_uci_indication(uci_ind);
113-
}
114-
if (not crc_ind.crcs.empty()) {
115-
this->sched->handle_crc_indication(crc_ind);
116-
}
117-
}
118-
11982
cell_config_builder_params params;
12083
pucch_res_builder_test_helper pucch_cfg_builder;
12184
unsigned nof_ues = 0;

tests/unittests/scheduler/scheduler_qos_test.cpp

Lines changed: 5 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ class scheduler_qos_test : public scheduler_test_simulator, public ::testing::Te
5656
};
5757

5858
public:
59-
scheduler_qos_test() : scheduler_test_simulator(4, subcarrier_spacing::kHz30)
59+
scheduler_qos_test() :
60+
scheduler_test_simulator(
61+
scheduler_test_sim_config{.max_scs = subcarrier_spacing::kHz30, .auto_uci = true, .auto_crc = true})
6062
{
6163
params = cell_config_builder_profiles::tdd(subcarrier_spacing::kHz30);
6264

@@ -114,48 +116,13 @@ class scheduler_qos_test : public scheduler_test_simulator, public ::testing::Te
114116
{
115117
scheduler_test_simulator::run_slot();
116118

117-
// Handle UCI and CRC indications.
118-
uci_indication uci_ind;
119-
uci_ind.cell_index = to_du_cell_index(0);
120-
uci_ind.slot_rx = this->last_result_slot();
121-
ul_crc_indication crc_ind;
122-
crc_ind.cell_index = to_du_cell_index(0);
123-
crc_ind.sl_rx = last_result_slot();
124-
125-
span<const dl_msg_alloc> ue_grants = this->last_sched_res_list[0]->dl.ue_grants;
126-
span<const ul_sched_info> ul_grants = this->last_sched_res_list[0]->ul.puschs;
127-
128-
// Handle PUCCHs.
129-
for (const pucch_info& pucch : this->last_sched_res_list[to_du_cell_index(0)]->ul.pucchs) {
130-
if (pucch.format() == pucch_format::FORMAT_1 and pucch.uci_bits.sr_bits != sr_nof_bits::no_sr) {
131-
// Skip SRs for this test.
132-
continue;
133-
}
134-
du_ue_index_t ue_idx = to_du_ue_index((unsigned)pucch.crnti - 0x4601);
135-
uci_ind.ucis.push_back(test_helper::create_uci_indication_pdu(ue_idx, pucch));
136-
}
137-
138-
// Handle CRCs and PUSCH UCIs.
139-
for (const ul_sched_info& grant : ul_grants) {
140-
crc_ind.crcs.emplace_back(test_helper::create_crc_pdu_indication(grant));
141-
if (grant.uci.has_value()) {
142-
uci_ind.ucis.push_back(
143-
test_helper::create_uci_indication_pdu(grant.pusch_cfg.rnti, grant.context.ue_index, grant.uci.value()));
144-
}
145-
}
146-
147-
if (not uci_ind.ucis.empty()) {
148-
this->sched->handle_uci_indication(uci_ind);
149-
}
150-
if (not crc_ind.crcs.empty()) {
151-
this->sched->handle_crc_indication(crc_ind);
152-
}
153-
154119
// Register DL sched bytes.
120+
span<const dl_msg_alloc> ue_grants = this->last_sched_res_list[0]->dl.ue_grants;
155121
for (const dl_msg_alloc& grant : ue_grants) {
156122
ue_stats_map[grant.context.ue_index].dl_bytes_sum += grant.pdsch_cfg.codewords[0].tb_size_bytes;
157123
}
158124
// Register UL sched bytes.
125+
span<const ul_sched_info> ul_grants = this->last_sched_res_list[0]->ul.puschs;
159126
for (const ul_sched_info& grant : ul_grants) {
160127
ue_stats_map[grant.context.ue_index].ul_bytes_sum += grant.pusch_cfg.tb_size_bytes;
161128
}

0 commit comments

Comments
 (0)