From d80d49a9dab8f5276b3be1e1396efb58485aaf4b Mon Sep 17 00:00:00 2001 From: yagoda Date: Tue, 15 May 2018 16:59:06 +0200 Subject: [PATCH] adding tests for embms rlc functionality --- lib/test/asn1/CMakeLists.txt | 10 +++-- lib/test/common/CMakeLists.txt | 2 +- lib/test/upper/rlc_am_test.cc | 1 + lib/test/upper/rlc_stress_test.cc | 1 + lib/test/upper/rlc_um_test.cc | 75 ++++++++++++++++++++++++++++++- 5 files changed, 83 insertions(+), 6 deletions(-) diff --git a/lib/test/asn1/CMakeLists.txt b/lib/test/asn1/CMakeLists.txt index 6c52d1972..0f59d0417 100644 --- a/lib/test/asn1/CMakeLists.txt +++ b/lib/test/asn1/CMakeLists.txt @@ -18,6 +18,10 @@ # and at http://www.gnu.org/licenses/. # -add_executable(rrc_meas_test rrc_meas_test.cc) -target_link_libraries(rrc_meas_test srslte_common srslte_phy srslte_asn1) -add_test(rrc_meas_test rrc_meas_test) +add_executable(srslte_asn1_rrc_mcch_test srslte_asn1_rrc_mcch_test.cc) +target_link_libraries(srslte_asn1_rrc_mcch_test srslte_asn1 srslte_common) +add_test(srslte_asn1_rrc_mcch_test srslte_asn1_rrc_mcch_test) + +add_executable(srslte_asn1_rrc_meas_test srslte_asn1_rrc_meas_test.cc) +target_link_libraries(srslte_asn1_rrc_meas_test srslte_common srslte_phy srslte_asn1) +add_test(srslte_asn1_rrc_meas_test srslte_asn1_rrc_meas_test) diff --git a/lib/test/common/CMakeLists.txt b/lib/test/common/CMakeLists.txt index 9c8bece01..8230c3698 100644 --- a/lib/test/common/CMakeLists.txt +++ b/lib/test/common/CMakeLists.txt @@ -19,7 +19,7 @@ # ####################################################################### -# LOGGER TEST +# COMMON TESTS ####################################################################### add_executable(logger_test logger_test.cc) target_link_libraries(logger_test srslte_phy srslte_common srslte_phy ${SEC_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES}) diff --git a/lib/test/upper/rlc_am_test.cc b/lib/test/upper/rlc_am_test.cc index 59642ed01..41057fbd5 100644 --- a/lib/test/upper/rlc_am_test.cc +++ b/lib/test/upper/rlc_am_test.cc @@ -80,6 +80,7 @@ public: void write_pdu_bcch_bch(byte_buffer_t *sdu) {} void write_pdu_bcch_dlsch(byte_buffer_t *sdu) {} void write_pdu_pcch(byte_buffer_t *sdu) {} + void write_pdu_mch(uint32_t lcid, srslte::byte_buffer_t *pdu){} // RRC interface void max_retx_attempted(){} diff --git a/lib/test/upper/rlc_stress_test.cc b/lib/test/upper/rlc_stress_test.cc index 0def725c1..b138b2b90 100644 --- a/lib/test/upper/rlc_stress_test.cc +++ b/lib/test/upper/rlc_stress_test.cc @@ -263,6 +263,7 @@ public: void write_pdu_bcch_bch(byte_buffer_t *sdu) {} void write_pdu_bcch_dlsch(byte_buffer_t *sdu) {} void write_pdu_pcch(byte_buffer_t *sdu) {} + void write_pdu_mch(uint32_t lcid, srslte::byte_buffer_t *sdu) {} // RRC interface void max_retx_attempted(){} diff --git a/lib/test/upper/rlc_um_test.cc b/lib/test/upper/rlc_um_test.cc index 2a4ffac0b..5e2ae0910 100644 --- a/lib/test/upper/rlc_um_test.cc +++ b/lib/test/upper/rlc_um_test.cc @@ -85,12 +85,18 @@ public: void write_pdu_bcch_bch(byte_buffer_t *sdu) {} void write_pdu_bcch_dlsch(byte_buffer_t *sdu) {} void write_pdu_pcch(byte_buffer_t *sdu) {} + void write_pdu_mch(uint32_t lcid, srslte::byte_buffer_t *sdu) + { + assert(lcid == 3); + sdus[n_sdus++] = sdu; + } // RRC interface void max_retx_attempted(){} std::string get_rb_name(uint32_t lcid) { return std::string(""); } void set_expected_sdu_len(uint32_t len) { expected_sdu_len = len; } + byte_buffer_t *sdus[MAX_NBUFS]; int n_sdus; uint32_t expected_sdu_len; @@ -235,7 +241,71 @@ void loss_test() } -// This test checks the reassembly routines when a PDU +void basic_mbsfn_test() +{ + srslte::log_filter log1("RLC_UM_1"); + srslte::log_filter log2("RLC_UM_2"); + log1.set_level(srslte::LOG_LEVEL_DEBUG); + log2.set_level(srslte::LOG_LEVEL_DEBUG); + log1.set_hex_limit(-1); + log2.set_hex_limit(-1); + rlc_um_tester tester; + mac_dummy_timers timers; + + rlc_um rlc1; + rlc_um rlc2; + + int len; + + log1.set_level(srslte::LOG_LEVEL_DEBUG); + log2.set_level(srslte::LOG_LEVEL_DEBUG); + + bool is_mrb = true; + rlc1.init(&log1, 3, &tester, &tester, &timers, is_mrb); + rlc2.init(&log2, 3, &tester, &tester, &timers, is_mrb); + + //rlc1.configure(&cnfg); //MRB RLC is default configured + //rlc2.configure(&cnfg); //MRB RLC is default configured + + // Push 5 SDUs into RLC1 + byte_buffer_t sdu_bufs[NBUFS*2]; + for(int i=0;iN_bytes == 1); + assert(*(tester.sdus[i]->msg) == i); + } +} + + + // This test checks the reassembly routines when a PDU // is lost that contains the beginning of SDU segment. // The PDU that contains the end of this SDU _also_ contains // a segment of another SDU. @@ -460,13 +530,14 @@ void reassmble_test2() } } - int main(int argc, char **argv) { basic_test(); byte_buffer_pool::get_instance()->cleanup(); loss_test(); byte_buffer_pool::get_instance()->cleanup(); + basic_mbsfn_test(); + byte_buffer_pool::get_instance()->cleanup(); reassmble_test(); byte_buffer_pool::get_instance()->cleanup();