Fixup tests to consider wrap-around in status report

This commit is contained in:
Pedro Alvarez 2021-03-03 17:30:32 +00:00 committed by Francisco Paisana
parent c4e9516561
commit 7b23a83306
2 changed files with 10 additions and 8 deletions

View File

@ -485,7 +485,7 @@ void pdcp_entity_lte::send_status_report()
bitmap_sz);
for (uint32_t sn = fms + 1; sn <= fms + sn_diff; sn++) {
if (undelivered_sdus->has_sdu(sn % (1u << cfg.sn_len))) {
uint32_t offset = sn - fms;
uint32_t offset = sn - (fms + 1);
uint32_t bit_offset = offset % 8;
uint32_t byte_offset = offset / 8;
pdu->msg[pdu->N_bytes + byte_offset] |= 1 << (7 - bit_offset);

View File

@ -87,8 +87,8 @@ int test_tx_status_report(const srslte::pdcp_lte_state_t& init_state, srslog::ba
TESTASSERT(out_pdu->N_bytes == 4);
TESTASSERT(out_pdu->msg[0] == 0b00000001);
TESTASSERT(out_pdu->msg[1] == 0b00000001);
TESTASSERT(out_pdu->msg[2] == 0b11000000);
TESTASSERT(out_pdu->msg[3] == 0b00000011);
TESTASSERT(out_pdu->msg[2] == 0b10000000);
TESTASSERT(out_pdu->msg[3] == 0b00000110);
return 0;
}
@ -140,7 +140,7 @@ int test_tx_wraparound_status_report(const srslte::pdcp_lte_state_t& init_state,
TESTASSERT(out_pdu->N_bytes == 2);
// Write another 32 SDUs but don't notify SN=4080, SN=4081, SN=14 and SN=15
for (uint32_t i = 4080; i < 4113; i++) {
for (uint32_t i = 4080; i < 4112; i++) {
srslte::unique_byte_buffer_t sdu = srslte::make_byte_buffer();
sdu->append_bytes(sdu1, sizeof(sdu1));
pdcp->write_sdu(std::move(sdu));
@ -167,8 +167,10 @@ int test_tx_wraparound_status_report(const srslte::pdcp_lte_state_t& init_state,
TESTASSERT(out_pdu->N_bytes == 6);
TESTASSERT(out_pdu->msg[0] == 0b00001111);
TESTASSERT(out_pdu->msg[1] == 0b11110000);
// TESTASSERT(out_pdu->msg[2] == 0b11000000);
// TESTASSERT(out_pdu->msg[3] == 0b00000011);
TESTASSERT(out_pdu->msg[2] == 0b10000000);
TESTASSERT(out_pdu->msg[3] == 0b00000000);
TESTASSERT(out_pdu->msg[4] == 0b00000000);
TESTASSERT(out_pdu->msg[5] == 0b00000110);
return 0;
}
/*
@ -259,9 +261,9 @@ int run_all_tests()
// This is the normal initial state. All state variables are set to zero
srslte::pdcp_lte_state_t normal_init_state = {};
// TESTASSERT(test_tx_status_report(normal_init_state, logger) == 0);
TESTASSERT(test_tx_status_report(normal_init_state, logger) == 0);
TESTASSERT(test_tx_wraparound_status_report(normal_init_state, logger) == 0);
// TESTASSERT(test_rx_status_report(normal_init_state, logger) == 0);
TESTASSERT(test_rx_status_report(normal_init_state, logger) == 0);
return 0;
}