fix RLC AM test in release

master
Andre Puschmann 6 years ago
parent 24cde06e32
commit 6c896c4962

@ -141,7 +141,7 @@ private:
bool running;
};
void basic_test()
bool basic_test()
{
srslte::log_filter log1("RLC_AM_1");
srslte::log_filter log2("RLC_AM_2");
@ -172,8 +172,13 @@ void basic_test()
cnfg.ul_am_rlc.poll_pdu = LIBLTE_RRC_POLL_PDU_P4;
cnfg.ul_am_rlc.t_poll_retx = LIBLTE_RRC_T_POLL_RETRANSMIT_MS5;
assert(rlc1.configure(&cnfg) == true);
assert(rlc2.configure(&cnfg) == true);
if (not rlc1.configure(&cnfg)) {
return -1;
}
if (not rlc2.configure(&cnfg)) {
return -1;
}
// Push 5 SDUs into RLC1
byte_buffer_t sdu_bufs[NBUFS];
@ -221,11 +226,17 @@ void basic_test()
}
// Check statistics
assert(rlc1.get_num_tx_bytes() == rlc2.get_num_rx_bytes());
assert(rlc2.get_num_tx_bytes() == rlc1.get_num_rx_bytes());
if (rlc1.get_num_tx_bytes() != rlc2.get_num_rx_bytes()) {
return -1;
}
if (rlc2.get_num_tx_bytes() != rlc1.get_num_rx_bytes()) {
return -1;
}
return 0;
}
void concat_test()
bool concat_test()
{
srslte::log_filter log1("RLC_AM_1");
srslte::log_filter log2("RLC_AM_2");
@ -256,8 +267,13 @@ void concat_test()
cnfg.ul_am_rlc.poll_pdu = LIBLTE_RRC_POLL_PDU_P4;
cnfg.ul_am_rlc.t_poll_retx = LIBLTE_RRC_T_POLL_RETRANSMIT_MS5;
assert(rlc1.configure(&cnfg) == true);
assert(rlc2.configure(&cnfg) == true);
if (not rlc1.configure(&cnfg)) {
return -1;
}
if (not rlc2.configure(&cnfg)) {
return -1;
}
// Push 5 SDUs into RLC1
byte_buffer_t sdu_bufs[NBUFS];
@ -290,11 +306,17 @@ void concat_test()
}
// check statistics
assert(rlc1.get_num_tx_bytes() == rlc2.get_num_rx_bytes());
assert(rlc2.get_num_tx_bytes() == rlc1.get_num_rx_bytes());
if (rlc1.get_num_tx_bytes() != rlc2.get_num_rx_bytes()) {
return -1;
}
if (rlc2.get_num_tx_bytes() != rlc1.get_num_rx_bytes()) {
return -1;
}
return 0;
}
void segment_test()
bool segment_test()
{
srslte::log_filter log1("RLC_AM_1");
srslte::log_filter log2("RLC_AM_2");
@ -325,8 +347,13 @@ void segment_test()
cnfg.ul_am_rlc.poll_pdu = LIBLTE_RRC_POLL_PDU_P4;
cnfg.ul_am_rlc.t_poll_retx = LIBLTE_RRC_T_POLL_RETRANSMIT_MS5;
assert(rlc1.configure(&cnfg) == true);
assert(rlc2.configure(&cnfg) == true);
if (not rlc1.configure(&cnfg)) {
return -1;
}
if (not rlc2.configure(&cnfg)) {
return -1;
}
// Push 5 SDUs into RLC1
byte_buffer_t sdu_bufs[NBUFS];
@ -376,11 +403,17 @@ void segment_test()
assert(tester.sdus[i]->msg[j] == j);
}
assert(rlc1.get_num_tx_bytes() == rlc2.get_num_rx_bytes());
assert(rlc2.get_num_tx_bytes() == rlc1.get_num_rx_bytes());
if (rlc1.get_num_tx_bytes() != rlc2.get_num_rx_bytes()) {
return -1;
}
if (rlc2.get_num_tx_bytes() != rlc1.get_num_rx_bytes()) {
return -1;
}
return 0;
}
void retx_test()
bool retx_test()
{
srslte::log_filter log1("RLC_AM_1");
srslte::log_filter log2("RLC_AM_2");
@ -411,8 +444,13 @@ void retx_test()
cnfg.ul_am_rlc.poll_pdu = LIBLTE_RRC_POLL_PDU_P4;
cnfg.ul_am_rlc.t_poll_retx = LIBLTE_RRC_T_POLL_RETRANSMIT_MS5;
assert(rlc1.configure(&cnfg) == true);
assert(rlc2.configure(&cnfg) == true);
if (not rlc1.configure(&cnfg)) {
return -1;
}
if (not rlc2.configure(&cnfg)) {
return -1;
}
// Push 5 SDUs into RLC1
byte_buffer_t sdu_bufs[NBUFS];
@ -471,12 +509,14 @@ void retx_test()
assert(tester.n_sdus == 5);
for(int i=0; i<tester.n_sdus; i++)
{
assert(tester.sdus[i]->N_bytes == 1);
assert(*(tester.sdus[i]->msg) == i);
if (tester.sdus[i]->N_bytes != 1) return -1;
if (*(tester.sdus[i]->msg) != i) return -1;
}
return 0;
}
void resegment_test_1()
bool resegment_test_1()
{
// SDUs: | 10 | 10 | 10 | 10 | 10 |
// PDUs: | 10 | 10 | 10 | 10 | 10 |
@ -511,8 +551,13 @@ void resegment_test_1()
cnfg.ul_am_rlc.poll_pdu = LIBLTE_RRC_POLL_PDU_P4;
cnfg.ul_am_rlc.t_poll_retx = LIBLTE_RRC_T_POLL_RETRANSMIT_MS5;
assert(rlc1.configure(&cnfg) == true);
assert(rlc2.configure(&cnfg) == true);
if (not rlc1.configure(&cnfg)) {
return -1;
}
if (not rlc2.configure(&cnfg)) {
return -1;
}
// Push 5 SDUs into RLC1
byte_buffer_t sdu_bufs[NBUFS];
@ -582,13 +627,15 @@ void resegment_test_1()
assert(tester.n_sdus == 5);
for(int i=0; i<tester.n_sdus; i++)
{
assert(tester.sdus[i]->N_bytes == 10);
if (tester.sdus[i]->N_bytes != 10) return -1;
for(int j=0;j<10;j++)
assert(tester.sdus[i]->msg[j] == j);
if (tester.sdus[i]->msg[j] != j) return -1;
}
return 0;
}
void resegment_test_2()
bool resegment_test_2()
{
// SDUs: | 10 | 10 | 10 | 10 | 10 |
@ -624,8 +671,13 @@ void resegment_test_2()
cnfg.ul_am_rlc.poll_pdu = LIBLTE_RRC_POLL_PDU_P4;
cnfg.ul_am_rlc.t_poll_retx = LIBLTE_RRC_T_POLL_RETRANSMIT_MS5;
assert(rlc1.configure(&cnfg) == true);
assert(rlc2.configure(&cnfg) == true);
if (not rlc1.configure(&cnfg)) {
return -1;
}
if (not rlc2.configure(&cnfg)) {
return -1;
}
// Push 5 SDUs into RLC1
byte_buffer_t sdu_bufs[NBUFS];
@ -692,13 +744,15 @@ void resegment_test_2()
assert(tester.n_sdus == 5);
for(int i=0; i<tester.n_sdus; i++)
{
assert(tester.sdus[i]->N_bytes == 10);
if (tester.sdus[i]->N_bytes != 10) return -1;
for(int j=0;j<10;j++)
assert(tester.sdus[i]->msg[j] == j);
if (tester.sdus[i]->msg[j] != j) return -1;
}
return 0;
}
void resegment_test_3()
bool resegment_test_3()
{
// SDUs: | 10 | 10 | 10 | 10 | 10 |
@ -734,8 +788,13 @@ void resegment_test_3()
cnfg.ul_am_rlc.poll_pdu = LIBLTE_RRC_POLL_PDU_P4;
cnfg.ul_am_rlc.t_poll_retx = LIBLTE_RRC_T_POLL_RETRANSMIT_MS5;
assert(rlc1.configure(&cnfg) == true);
assert(rlc2.configure(&cnfg) == true);
if (not rlc1.configure(&cnfg)) {
return -1;
}
if (not rlc2.configure(&cnfg)) {
return -1;
}
// Push 5 SDUs into RLC1
byte_buffer_t sdu_bufs[NBUFS];
@ -798,13 +857,15 @@ void resegment_test_3()
assert(tester.n_sdus == 5);
for(int i=0; i<tester.n_sdus; i++)
{
assert(tester.sdus[i]->N_bytes == 10);
if (tester.sdus[i]->N_bytes != 10) return -1;
for(int j=0;j<10;j++)
assert(tester.sdus[i]->msg[j] == j);
if (tester.sdus[i]->msg[j] != j) return -1;
}
return 0;
}
void resegment_test_4()
bool resegment_test_4()
{
// SDUs: | 10 | 10 | 10 | 10 | 10 |
@ -840,8 +901,13 @@ void resegment_test_4()
cnfg.ul_am_rlc.poll_pdu = LIBLTE_RRC_POLL_PDU_P4;
cnfg.ul_am_rlc.t_poll_retx = LIBLTE_RRC_T_POLL_RETRANSMIT_MS5;
assert(rlc1.configure(&cnfg) == true);
assert(rlc2.configure(&cnfg) == true);
if (not rlc1.configure(&cnfg)) {
return -1;
}
if (not rlc2.configure(&cnfg)) {
return -1;
}
// Push 5 SDUs into RLC1
byte_buffer_t sdu_bufs[NBUFS];
@ -904,13 +970,15 @@ void resegment_test_4()
assert(tester.n_sdus == 5);
for(int i=0; i<tester.n_sdus; i++)
{
assert(tester.sdus[i]->N_bytes == 10);
if (tester.sdus[i]->N_bytes != 10) return -1;
for(int j=0;j<10;j++)
assert(tester.sdus[i]->msg[j] == j);
if (tester.sdus[i]->msg[j] != j) return -1;
}
return 0;
}
void resegment_test_5()
bool resegment_test_5()
{
// SDUs: | 10 | 10 | 10 | 10 | 10 |
@ -929,8 +997,6 @@ void resegment_test_5()
rlc_am rlc1;
rlc_am rlc2;
int len;
log1.set_level(srslte::LOG_LEVEL_DEBUG);
log2.set_level(srslte::LOG_LEVEL_DEBUG);
@ -946,8 +1012,13 @@ void resegment_test_5()
cnfg.ul_am_rlc.poll_pdu = LIBLTE_RRC_POLL_PDU_P4;
cnfg.ul_am_rlc.t_poll_retx = LIBLTE_RRC_T_POLL_RETRANSMIT_MS5;
assert(rlc1.configure(&cnfg) == true);
assert(rlc2.configure(&cnfg) == true);
if (not rlc1.configure(&cnfg)) {
return -1;
}
if (not rlc2.configure(&cnfg)) {
return -1;
}
// Push 5 SDUs into RLC1
byte_buffer_t sdu_bufs[NBUFS];
@ -1010,13 +1081,15 @@ void resegment_test_5()
assert(tester.n_sdus == 5);
for(int i=0; i<tester.n_sdus; i++)
{
assert(tester.sdus[i]->N_bytes == 10);
if (tester.sdus[i]->N_bytes != 10) return -1;
for(int j=0;j<10;j++)
assert(tester.sdus[i]->msg[j] == j);
if (tester.sdus[i]->msg[j] != j) return -1;
}
return 0;
}
void resegment_test_6()
bool resegment_test_6()
{
// SDUs: |10|10|10| 54 | 54 | 54 | 54 | 54 | 54 |
// PDUs: |10|10|10| 270 | 54 |
@ -1051,8 +1124,13 @@ void resegment_test_6()
cnfg.ul_am_rlc.poll_pdu = LIBLTE_RRC_POLL_PDU_P4;
cnfg.ul_am_rlc.t_poll_retx = LIBLTE_RRC_T_POLL_RETRANSMIT_MS5;
assert(rlc1.configure(&cnfg) == true);
assert(rlc2.configure(&cnfg) == true);
if (not rlc1.configure(&cnfg)) {
return -1;
}
if (not rlc2.configure(&cnfg)) {
return -1;
}
// Push SDUs into RLC1
byte_buffer_t sdu_bufs[9];
@ -1138,14 +1216,17 @@ void resegment_test_6()
}
for(int i=3;i<9;i++)
{
assert(tester.sdus[i]->N_bytes == 54);
for(int j=0;j<54;j++)
assert(tester.sdus[i]->msg[j] == j);
if(tester.sdus[i]->N_bytes != 54) return -1;
for(int j=0;j<54;j++) {
if (tester.sdus[i]->msg[j] != j) return -1;
}
}
return 0;
}
// Retransmission of PDU segments of the same size
void resegment_test_7()
bool resegment_test_7()
{
// SDUs: | 30 | 30 |
// PDUs: | 13 | 13 | 11 | 13 | 10 |
@ -1192,8 +1273,13 @@ void resegment_test_7()
cnfg.ul_am_rlc.poll_pdu = LIBLTE_RRC_POLL_PDU_P4;
cnfg.ul_am_rlc.t_poll_retx = LIBLTE_RRC_T_POLL_RETRANSMIT_MS5;
assert(rlc1.configure(&cnfg) == true);
assert(rlc2.configure(&cnfg) == true);
if (not rlc1.configure(&cnfg)) {
return -1;
}
if (not rlc2.configure(&cnfg)) {
return -1;
}
// Push 2 SDUs into RLC1
byte_buffer_t sdu_bufs[N_SDU_BUFS];
@ -1252,8 +1338,6 @@ void resegment_test_7()
}
}
// Read status PDU from RLC2
assert(rlc2.get_buffer_state());
byte_buffer_t status_buf;
@ -1295,20 +1379,22 @@ void resegment_test_7()
assert(tester.n_sdus == N_SDU_BUFS);
for(int i=0; i<tester.n_sdus; i++)
{
assert(tester.sdus[i]->N_bytes == sdu_size);
if (tester.sdus[i]->N_bytes != sdu_size) return -1;
for(uint32_t j=0;j<N_SDU_BUFS;j++) {
assert(tester.sdus[i]->msg[j] == i);
if (tester.sdus[i]->msg[j] != i) return -1;
}
}
#if HAVE_PCAP
pcap.close();
#endif
return 0;
}
// Retransmission of PDU segments with different size
void resegment_test_8()
bool resegment_test_8()
{
// SDUs: | 30 | 30 |
// PDUs: | 15 | 15 | 15 | 15 | 15 |
@ -1354,8 +1440,13 @@ void resegment_test_8()
cnfg.ul_am_rlc.poll_pdu = LIBLTE_RRC_POLL_PDU_P4;
cnfg.ul_am_rlc.t_poll_retx = LIBLTE_RRC_T_POLL_RETRANSMIT_MS5;
assert(rlc1.configure(&cnfg) == true);
assert(rlc2.configure(&cnfg) == true);
if (not rlc1.configure(&cnfg)) {
exit(-1);
}
if (not rlc2.configure(&cnfg)) {
exit(-1);
}
// Push 2 SDUs into RLC1
byte_buffer_t sdu_bufs[N_SDU_BUFS];
@ -1445,26 +1536,41 @@ void resegment_test_8()
#endif
}
// get BSR from RLC2
status_buf.N_bytes = rlc2.read_pdu(status_buf.msg, 10); // 10 bytes is enough to hold the status
// Write status PDU to RLC1
rlc1.write_pdu(status_buf.msg, status_buf.N_bytes);
#if HAVE_PCAP
pcap.write_ul_am_ccch(status_buf.msg, status_buf.N_bytes);
#endif
// check buffer states
assert(0 == rlc1.get_buffer_state());
assert(0 == rlc2.get_buffer_state());
if (rlc1.get_buffer_state() != 0) {
return -1;
};
if (rlc2.get_buffer_state() != 0) {
return -1;
};
// Check number of SDUs and their content
assert(tester.n_sdus == N_SDU_BUFS);
for(int i=0; i<tester.n_sdus; i++) {
assert(tester.sdus[i]->N_bytes == sdu_size);
if (tester.sdus[i]->N_bytes != sdu_size) return -1;
for(uint32_t j=0;j<N_SDU_BUFS;j++) {
assert(tester.sdus[i]->msg[j] == i);
if (tester.sdus[i]->msg[j] != i) return -1;
}
}
#if HAVE_PCAP
pcap.close();
#endif
return 0;
}
void reset_test()
bool reset_test()
{
srslte::log_filter log1("RLC_AM_1");
srslte::log_filter log2("RLC_AM_2");
@ -1491,7 +1597,9 @@ void reset_test()
cnfg.ul_am_rlc.poll_pdu = LIBLTE_RRC_POLL_PDU_P4;
cnfg.ul_am_rlc.t_poll_retx = LIBLTE_RRC_T_POLL_RETRANSMIT_MS5;
assert(rlc1.configure(&cnfg) == true);
if (not rlc1.configure(&cnfg)) {
return -1;
}
// Push 1 SDU of size 10 into RLC1
byte_buffer_t sdu_buf;
@ -1515,10 +1623,14 @@ void reset_test()
len = rlc1.read_pdu(pdu_bufs.msg, 100);
pdu_bufs.N_bytes = len;
assert(0 == rlc1.get_buffer_state());
if (0 != rlc1.get_buffer_state()) {
return -1;
}
return 0;
}
void stop_test()
bool stop_test()
{
srslte::log_filter log1("RLC_AM_1");
log1.set_level(srslte::LOG_LEVEL_DEBUG);
@ -1541,7 +1653,9 @@ void stop_test()
cnfg.ul_am_rlc.poll_pdu = LIBLTE_RRC_POLL_PDU_P4;
cnfg.ul_am_rlc.t_poll_retx = LIBLTE_RRC_T_POLL_RETRANSMIT_MS5;
assert(rlc1.configure(&cnfg) == true);
if (not rlc1.configure(&cnfg)) {
return -1;
}
// start thread reading
ul_writer writer(&rlc1);
@ -1552,47 +1666,93 @@ void stop_test()
// stop RLC1
rlc1.stop();
return 0;
}
int main(int argc, char **argv) {
basic_test();
int main(int argc, char **argv)
{
if (basic_test()) {
printf("basic_test failed\n");
exit(-1);
};
byte_buffer_pool::get_instance()->cleanup();
concat_test();
if (concat_test()) {
printf("concat_test failed\n");
exit(-1);
};
byte_buffer_pool::get_instance()->cleanup();
segment_test();
if (segment_test()) {
printf("segment_test failed\n");
exit(-1);
};
byte_buffer_pool::get_instance()->cleanup();
retx_test();
if (retx_test()) {
printf("retx_test failed\n");
exit(-1);
};
byte_buffer_pool::get_instance()->cleanup();
resegment_test_1();
if (resegment_test_1()) {
printf("resegment_test_1 failed\n");
exit(-1);
};
byte_buffer_pool::get_instance()->cleanup();
resegment_test_2();
if (resegment_test_2()) {
printf("resegment_test_2 failed\n");
exit(-1);
};
byte_buffer_pool::get_instance()->cleanup();
resegment_test_3();
if (resegment_test_3()) {
printf("resegment_test_3 failed\n");
exit(-1);
};
byte_buffer_pool::get_instance()->cleanup();
resegment_test_4();
if (resegment_test_4()) {
printf("resegment_test_4 failed\n");
exit(-1);
};
byte_buffer_pool::get_instance()->cleanup();
resegment_test_5();
if (resegment_test_5()) {
printf("resegment_test_5 failed\n");
exit(-1);
};
byte_buffer_pool::get_instance()->cleanup();
resegment_test_6();
byte_buffer_pool::get_instance()->cleanup();
resegment_test_7();
if (resegment_test_6()) {
printf("resegment_test_6 failed\n");
exit(-1);
};
byte_buffer_pool::get_instance()->cleanup();
resegment_test_8();
if (resegment_test_7()) {
printf("resegment_test_7 failed\n");
exit(-1);
};
byte_buffer_pool::get_instance()->cleanup();
reset_test();
if (resegment_test_8()) {
printf("resegment_test_8 failed\n");
exit(-1);
};
byte_buffer_pool::get_instance()->cleanup();
stop_test();
if (reset_test()) {
printf("reset_test failed\n");
exit(-1);
};
byte_buffer_pool::get_instance()->cleanup();
if (stop_test()) {
printf("stop_test failed\n");
exit(-1);
};
byte_buffer_pool::get_instance()->cleanup();
}

Loading…
Cancel
Save