This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
pravin gerrit-no-reply at lists.osmocom.orgReview at https://gerrit.osmocom.org/417 Add test case for decompression of compressed bitmap Test case is added to validate decompressed result of the bitmap present in EPDAN. Test is done for multiple bitmaps of varying length. Change-Id: I0f26ec3d9eeace4ea8396ad5786a988fb58cf445 --- M tests/tbf/TbfTest.cpp 1 file changed, 109 insertions(+), 15 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/17/417/1 diff --git a/tests/tbf/TbfTest.cpp b/tests/tbf/TbfTest.cpp index e1be844..5f293d1 100644 --- a/tests/tbf/TbfTest.cpp +++ b/tests/tbf/TbfTest.cpp @@ -26,10 +26,11 @@ #include "pcu_utils.h" #include "gprs_bssgp_pcu.h" #include "pcu_l1_if.h" - +#include "egprs_rlc_compression.h" +#include "decoding.h" extern "C" { #include "pcu_vty.h" - +#include <osmocom/core/bitcomp.h> #include <osmocom/core/application.h> #include <osmocom/core/msgb.h> #include <osmocom/core/talloc.h> @@ -38,9 +39,30 @@ } #include <errno.h> - +#define NUMBER_OF_TEST_CASE 4 +#define NEW 1 +#define DELTA 1000 void *tall_pcu_ctx; int16_t spoof_mnc = 0, spoof_mcc = 0; +struct test_data { + int8_t crbb_len; + uint8_t cc ; + uint8_t data[23]; + uint8_t exp_data[40]; + int exp_len; +}test[4] = { { (int8_t)67, (uint8_t)1,{0x02, 0x0c, 0xa0, 0x30, 0xcb, 0x1a, 0x0c, 0xe3, 0x6c}, + {0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x01, 0xff, 0xff, 0xff, 0xf8, 0x00, + 0x00, 0x00, 0xff, 0xff, 0xff, 0xfe, 0x00, 0x00, 0x3f, 0xff, 0xff, 0xff, + 0xdb}, (int)194}, + {(int8_t)40, (uint8_t)1, {0x53,0x06,0xc5,0x40,0x6d}, {0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0x00, + 0x00, 0x00, 0x00, 0x03}, (int)182}, + { (int8_t)8, (uint8_t)1, {0x02}, {0xff, 0xff, 0xff, 0xf8}, (int)29}, + { (int8_t)103,(uint8_t)1, {0x02, 0x0c, 0xe0, 0x41, 0xa0, 0x0c, 0x36, 0x0d, 0x03, + 0x71, 0xb0, 0x6e, 0x24}, {0xff, 0xff, 0xff, 0xf8, 0x00, 0x00, 0xff, 0xff, 0xff, + 0xf8, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xfe, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xff, + 0xe0, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xff, 0x80, 0x00, 0x01, 0xff, 0xff, 0xff, 0xff} , + (int)288} }; static void check_tbf(gprs_rlcmac_tbf *tbf) { @@ -51,19 +73,90 @@ OSMO_ASSERT(tbf->T != 0); } -/* -static unsigned inc_fn(fn) +/* To verify the result with expected result */ +int check_result(bitvec bits, uint8_t *exp_data, int exp_len) { - unsigned next_fn; + if (bits.cur_bit != exp_len) + return 0; + size_t n = (exp_len / 8); + int rem = (exp_len % 8); + if (memcmp (exp_data, bits.data, n) == 0) { + if (rem == 0) + return 1; + int i = 0, bytes = 7; - next_fn = fn + 4; - if ((block_nr % 3) == 2) - next_fn ++; - next_fn = next_fn % 2715648; - - return next_fn; + for (i ; i < rem ; i++) { + if (((((bits.data[n]))>>(bytes-i)) & 1) == ((((*(exp_data + n))>>(bytes-i)) & 1))) + ; + else + break; + } + if (i == rem) { + return 1; + } else { + return 0; + } + } else { + return 0; + } } -*/ +/* To check time taken to decode crbb by Tree based method + * and to verify the result with expected result */ +void test_EPDAN_time_tree(int test_run, int verify) +{ + int itr = 0; + long long int min_tree = 0, max_tree = 0, sum = 0, avg = 0; + float avg_tree = 0; + bitvec bits; + struct bitvec data1; + for (itr ; itr < NUMBER_OF_TEST_CASE ; itr++) { + int loop = 0, init_flag = 1, first = 0, last = 0, count = 0; + avg_tree = 0 , min_tree = 0 , max_tree = 0; + while (loop++ < test_run) { + data1.data_len = ((test[itr].crbb_len + 7)/8); + data1.cur_bit = test[itr].crbb_len; + struct timeval t0, t1; + data1.data = test[itr].data; + uint8_t bits_data[RLC_EGPRS_MAX_WS/8]; + bits.data = bits_data; + bits.data_len = sizeof(bits_data); + bits.cur_bit = 0; + gettimeofday(&t0, 0); + Decoding::decompress_crbb(test[itr].crbb_len, test[itr].cc, test[itr].data, &bits); + gettimeofday(&t1, 0); + long long elapsed = (t1.tv_sec-t0.tv_sec)*1000000LL + t1.tv_usec-t0.tv_usec; + if (init_flag) + init_flag = 0; + if (verify) { + if (check_result(bits, test[itr].exp_data, test[itr].exp_len) == 0) { + LOGP (DRLCMACDL, LOGL_DEBUG, "Tree based decoding :Error\n"); + OSMO_ASSERT(0) ; + } + } + if (loop == 1) { + first = elapsed; + min_tree = elapsed; + max_tree = elapsed; + sum = elapsed; + avg = elapsed; + avg_tree = elapsed; + } else { + if (loop == test_run-1) + last = elapsed; + if (elapsed > (avg+DELTA)) + count++; + sum = sum + elapsed; + avg = sum / loop; + if (min_tree > elapsed) + min_tree = elapsed; + if (max_tree < elapsed) + max_tree = elapsed; + avg_tree = avg_tree + elapsed; + } + } + avg_tree = (avg_tree / test_run); + } +} static void test_tbf_base() { @@ -1337,7 +1430,8 @@ vty_init(&pcu_vty_info); pcu_vty_init(&debug_log_info); - + /*initialization_of_tree*/ + egprs_compress::instance()->decode_tree_init(); test_tbf_base(); test_tbf_tlli_update(); test_tbf_final_ack(TEST_MODE_STANDARD); @@ -1356,7 +1450,7 @@ test_tbf_ws(); test_tbf_egprs_two_phase(); test_tbf_egprs_dl(); - + test_EPDAN_time_tree(10000, 1); if (getenv("TALLOC_REPORT_FULL")) talloc_report_full(tall_pcu_ctx, stderr); return EXIT_SUCCESS; -- To view, visit https://gerrit.osmocom.org/417 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I0f26ec3d9eeace4ea8396ad5786a988fb58cf445 Gerrit-PatchSet: 1 Gerrit-Project: osmo-pcu Gerrit-Branch: master Gerrit-Owner: pravin <pravin.manoharan at radisys.com>