1515#include " test_utils/indication_generators.h"
1616#include " test_utils/result_test_helpers.h"
1717#include " test_utils/scheduler_test_bench.h"
18+ #include " srsran/ran/prach/prach_helper.h"
1819#include < gtest/gtest.h>
1920
2021using namespace srsran ;
@@ -49,6 +50,13 @@ class base_scheduler_tdd_tester : public scheduler_test_bench
4950 // TDD params.
5051 sched_cfg.tdd_ul_dl_cfg_common = tdd_cfg;
5152
53+ // RACH config
54+ optional<uint8_t > chosen_prach_cfg_idx =
55+ prach_helper::find_valid_prach_config_index (sched_cfg.ul_cfg_common .init_ul_bwp .generic_params .scs ,
56+ sched_cfg.ul_cfg_common .init_ul_bwp .generic_params .cp_extended ,
57+ *sched_cfg.tdd_ul_dl_cfg_common );
58+ sched_cfg.ul_cfg_common .init_ul_bwp .rach_cfg_common ->rach_cfg_generic .prach_config_index = *chosen_prach_cfg_idx;
59+
5260 return sched_cfg;
5361 }());
5462
@@ -68,13 +76,13 @@ class base_scheduler_tdd_tester : public scheduler_test_bench
6876
6977using test_params = tdd_ul_dl_config_common;
7078
71- class scheduler_tdd_tester : public base_scheduler_tdd_tester , public ::testing::TestWithParam<test_params>
79+ class scheduler_dl_tdd_tester : public base_scheduler_tdd_tester , public ::testing::TestWithParam<test_params>
7280{
7381public:
74- scheduler_tdd_tester () : base_scheduler_tdd_tester(GetParam()) {}
82+ scheduler_dl_tdd_tester () : base_scheduler_tdd_tester(GetParam()) {}
7583};
7684
77- TEST_P (scheduler_tdd_tester , all_dl_slots_are_scheduled)
85+ TEST_P (scheduler_dl_tdd_tester , all_dl_slots_are_scheduled)
7886{
7987 // Enqueue enough bytes for continuous DL tx.
8088 dl_buffer_state_indication_message dl_buf_st{ue_idx, ue_drb_lcid, 10000000 };
@@ -83,7 +91,6 @@ TEST_P(scheduler_tdd_tester, all_dl_slots_are_scheduled)
8391 const unsigned MAX_COUNT = 1000 ;
8492 for (unsigned count = 0 ; count != MAX_COUNT; ++count) {
8593 this ->run_slot ();
86- ASSERT_TRUE (this ->last_sched_res ->success );
8794
8895 // For every DL slot.
8996 // Note: Skip special slots in test for now.
@@ -105,7 +112,13 @@ TEST_P(scheduler_tdd_tester, all_dl_slots_are_scheduled)
105112 }
106113}
107114
108- TEST_P (scheduler_tdd_tester, all_ul_slots_are_scheduled)
115+ class scheduler_ul_tdd_tester : public base_scheduler_tdd_tester , public ::testing::TestWithParam<test_params>
116+ {
117+ public:
118+ scheduler_ul_tdd_tester () : base_scheduler_tdd_tester(GetParam()) {}
119+ };
120+
121+ TEST_P (scheduler_ul_tdd_tester, all_ul_slots_are_scheduled)
109122{
110123 // Enqueue enough bytes for continuous UL tx.
111124 ul_bsr_indication_message bsr{
@@ -120,7 +133,6 @@ TEST_P(scheduler_tdd_tester, all_ul_slots_are_scheduled)
120133 const unsigned MAX_COUNT = 1000 ;
121134 for (unsigned count = 0 ; count != MAX_COUNT; ++count) {
122135 this ->run_slot ();
123- ASSERT_TRUE (this ->last_sched_res ->success );
124136
125137 // For every UL slot.
126138 // Note: Skip special slots in test for now.
@@ -146,13 +158,21 @@ TEST_P(scheduler_tdd_tester, all_ul_slots_are_scheduled)
146158
147159INSTANTIATE_TEST_SUITE_P (
148160 scheduler_tdd_test,
149- scheduler_tdd_tester ,
161+ scheduler_dl_tdd_tester ,
150162 testing::Values (
151163 // clang-format off
152164 // test_params{ref_scs, pattern1={slot_period, DL_slots, DL_symbols, UL_slots, UL_symbols}, pattern2={...}}
153165 test_params{subcarrier_spacing::kHz30 , {10 , 6 , 4 , 3 , 4 }, nullopt }));
154- // Note: Not working because some PDSCHs fail due to insufficient PUCCH resources.
155- // test_params{subcarrier_spacing::kHz30, {10, 7, 4, 2, 4}, nullopt},
156- // Note: Not working because PRACH configuration needs to be adjusted.
157- // test_params{subcarrier_spacing::kHz30, {6, 3, 4, 2, 4}, tdd_ul_dl_pattern{4, 4, 0, 0, 0}}));
166+ // TODO: Support more TDD patterns.
167+ // clang-format on
168+
169+ INSTANTIATE_TEST_SUITE_P (
170+ scheduler_tdd_test,
171+ scheduler_ul_tdd_tester,
172+ testing::Values (
173+ // clang-format off
174+ // test_params{ref_scs, pattern1={slot_period, DL_slots, DL_symbols, UL_slots, UL_symbols}, pattern2={...}}
175+ test_params{subcarrier_spacing::kHz30 , {10 , 6 , 4 , 3 , 4 }, nullopt },
176+ test_params{subcarrier_spacing::kHz30 , {10 , 7 , 4 , 2 , 4 }, nullopt },
177+ test_params{subcarrier_spacing::kHz30 , {6 , 3 , 4 , 2 , 4 }, tdd_ul_dl_pattern{4 , 4 , 0 , 0 , 0 }}));
158178// clang-format on
0 commit comments