@@ -83,6 +83,12 @@ struct test_params {
8383 unsigned nof_retxs = 0 ;
8484};
8585
86+ // / Formatter for test params.
87+ void PrintTo (const test_params& value, ::std::ostream* os)
88+ {
89+ *os << fmt::format (" nof_retx={}" , value.nof_retxs );
90+ }
91+
8692class scheduler_retx_tester : public base_scheduler_retx_tester , public ::testing::TestWithParam<test_params>
8793{};
8894
@@ -135,11 +141,14 @@ TEST_P(scheduler_retx_tester, msg3_gets_retx_if_nacked)
135141}
136142
137143class scheduler_missing_ack_tester : public base_scheduler_retx_tester , public ::testing::Test
138- {};
144+ {
145+ protected:
146+ static const unsigned MAX_HARQ_TIMEOUT = 256 ;
147+ };
139148
140149TEST_F (scheduler_missing_ack_tester, when_no_harq_ack_arrives_then_harq_eventually_becomes_available)
141150{
142- static constexpr unsigned nof_harqs = 8 ;
151+ static constexpr unsigned nof_harqs = 16 ;
143152 static constexpr rnti_t rnti = to_rnti (0x4601 );
144153 sched_ue_creation_request_message ue_create_req = test_helpers::create_default_sched_ue_creation_request ();
145154 ue_create_req.crnti = rnti;
@@ -158,19 +167,25 @@ TEST_F(scheduler_missing_ack_tester, when_no_harq_ack_arrives_then_harq_eventual
158167 }
159168
160169 // Set buffer state to zero, so that no newtxs get allocated once the current harqs become empty.
170+ srslog::fetch_basic_logger (" TEST" ).info (" -- Setting DL BS=0, which will stop new DL grants --" );
161171 bench.push_dl_buffer_state (dl_buffer_state_indication_message{ue_create_req.ue_index , LCID_SRB1, 0 });
162172 bench.run_slot (to_du_cell_index (0 ));
163173 ASSERT_EQ (bench.find_ue_dl_pdcch (rnti), nullptr ) << " No HARQs should be available at this point" ;
164174
165175 // After several slots without HARQ-ACK, the HARQ should auto retx.
166- const unsigned MAX_HARQ_TIMEOUT = 10240 , MAX_TEST_COUNT = 256 ;
176+ srslog::fetch_basic_logger (" TEST" ).info (" -- DL HARQs should be auto-retransmitted --" );
177+ const unsigned MAX_TEST_COUNT = nof_harqs * 8 ;
178+ unsigned nof_retxs = 0 ;
167179 for (unsigned i = 0 ; i != MAX_TEST_COUNT; ++i) {
168180 const pdcch_dl_information* pdcch = this ->run_until_next_dl_pdcch_alloc (MAX_HARQ_TIMEOUT);
169181 if (pdcch == nullptr ) {
170182 // All HARQs should be reset at this point.
171183 break ;
172184 }
185+ nof_retxs++;
173186 }
187+ ASSERT_GT (nof_retxs, 0 );
188+ ASSERT_TRUE (nof_retxs % nof_harqs == 0 ) << " All HARQs should have expired at this point" ;
174189
175190 // At this point, all HARQs should be free once again. Push enough bytes and verify that all HARQs get re-allocated.
176191 bench.push_dl_buffer_state (dl_buffer_state_indication_message{ue_create_req.ue_index , LCID_SRB1, 10000000 });
@@ -182,7 +197,7 @@ TEST_F(scheduler_missing_ack_tester, when_no_harq_ack_arrives_then_harq_eventual
182197
183198TEST_F (scheduler_missing_ack_tester, when_no_crc_arrives_then_ul_harq_eventually_becomes_available)
184199{
185- static constexpr unsigned nof_harqs = 8 ;
200+ static constexpr unsigned nof_harqs = 16 ;
186201 static constexpr rnti_t rnti = to_rnti (0x4601 );
187202 sched_ue_creation_request_message ue_create_req = test_helpers::create_default_sched_ue_creation_request ();
188203 ue_create_req.crnti = rnti;
@@ -204,22 +219,29 @@ TEST_F(scheduler_missing_ack_tester, when_no_crc_arrives_then_ul_harq_eventually
204219 }
205220
206221 // Set buffer state to zero, so that no newtxs get allocated once the current harqs become empty.
222+ srslog::fetch_basic_logger (" TEST" ).info (" -- Setting BSR=0, which will stop new UL grants --" );
207223 bsr.reported_lcgs [0 ].nof_bytes = 0 ;
208224 bench.push_bsr (bsr);
209225 bench.run_slot (to_du_cell_index (0 ));
210226 ASSERT_EQ (bench.find_ue_ul_pdcch (rnti), nullptr ) << " No HARQs should be available at this point" ;
211227
212228 // After several slots without HARQ-ACK, the HARQ should auto retx.
213- const unsigned MAX_HARQ_TIMEOUT = 32 , MAX_TEST_COUNT = 10000 ;
229+ srslog::fetch_basic_logger (" TEST" ).info (" -- UL HARQs should be auto-retransmitted --" );
230+ const unsigned MAX_TEST_COUNT = nof_harqs * 8 ;
231+ unsigned nof_retxs = 0 ;
214232 for (unsigned i = 0 ; i != MAX_TEST_COUNT; ++i) {
215233 const pdcch_ul_information* pdcch = this ->run_until_next_ul_pdcch_alloc (MAX_HARQ_TIMEOUT);
216234 if (pdcch == nullptr ) {
217235 // All HARQs should be reset at this point.
218236 break ;
219237 }
238+ nof_retxs++;
220239 }
240+ ASSERT_GT (nof_retxs, 0 );
241+ ASSERT_TRUE (nof_retxs % nof_harqs == 0 ) << " All HARQs should have expired at this point" ;
221242
222243 // At this point, all HARQs should be free once again. Push enough bytes and verify that all HARQs get re-allocated.
244+ srslog::fetch_basic_logger (" TEST" ).info (" -- Pushing BSR > 0 and ensuring HARQs get reallocated. --" );
223245 bsr.reported_lcgs [0 ].nof_bytes = 100000000 ;
224246 bench.push_bsr (bsr);
225247 for (unsigned i = 0 ; i != nof_harqs; ++i) {
0 commit comments