diff options
author | Jacob Erlbeck <jerlbeck@sysmocom.de> | 2015-07-13 14:50:08 +0200 |
---|---|---|
committer | Jacob Erlbeck <jerlbeck@sysmocom.de> | 2015-07-16 18:51:31 +0200 |
commit | a8c2aaf6f05d5e25665e8cbb2b415c6a2ad34d8b (patch) | |
tree | 994f19e9d5ca95e8aa0d6df42d2e710dd3a2195f /tests/alloc/AllocTest.cpp | |
parent | 69c9bfa0897c63b8a220bdb8db6658dc5021e5da (diff) |
alloc/test: Add test for interleaved TBF chains
MS iniated TCP connections generally result in a sequence
of short time UL and longer lasting DL TBFs, being interleaved
between several MS. This scenario is not covered by the existing
tests.
This commit adds a test, that allocates as man as possible TBFs
several times with different test modes without clearing the BTS (and
thus the TBF list) in between. The number of allocated DL TBFs in
each round is expected to be constant.
Sponsored-by: On-Waves ehf
Diffstat (limited to 'tests/alloc/AllocTest.cpp')
-rw-r--r-- | tests/alloc/AllocTest.cpp | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/tests/alloc/AllocTest.cpp b/tests/alloc/AllocTest.cpp index 6732058b..19ca7184 100644 --- a/tests/alloc/AllocTest.cpp +++ b/tests/alloc/AllocTest.cpp @@ -646,6 +646,55 @@ static void test_successive_allocation(algo_t algo, unsigned min_class, check_tfi_usage(&the_bts); } +static void test_many_connections(algo_t algo, unsigned expect_num, + const char *text) +{ + BTS the_bts; + struct gprs_rlcmac_bts *bts; + struct gprs_rlcmac_trx *trx; + int counter1, counter2 = -1; + unsigned i; + enum test_mode mode_seq[] = { + TEST_MODE_DL_AFTER_UL, + TEST_MODE_UL_ONLY, + TEST_MODE_DL_AFTER_UL, + TEST_MODE_DL_ONLY, + }; + + printf("Going to test assignment with many connections, %s\n", text); + + bts = the_bts.bts_data(); + bts->alloc_algorithm = algo; + + trx = &bts->trx[0]; + trx->pdch[3].enable(); + trx->pdch[4].enable(); + trx->pdch[5].enable(); + trx->pdch[6].enable(); + trx->pdch[7].enable(); + + for (i = 0; i < ARRAY_SIZE(mode_seq); i += 1) { + counter1 = alloc_many_tbfs(&the_bts, 1, 29, mode_seq[i]); + fprintf(stderr, " Allocated %d TBFs (previously %d)\n", + counter1, counter2); + + check_tfi_usage(&the_bts); + + /* This will stop earlier due to USF shortage */ + if (mode_seq[i] == TEST_MODE_UL_ONLY) + continue; + + if (counter2 >= 0) + OSMO_ASSERT(counter1 >= counter2); + + counter2 = counter1; + } + + printf(" Successfully allocated %d TBFs\n", counter1); + + OSMO_ASSERT(expect_num == (unsigned)counter1); +} + static void test_successive_allocation() { test_successive_allocation(alloc_algorithm_a, 1, 1, TEST_MODE_UL_AND_DL, @@ -685,6 +734,12 @@ static void test_successive_allocation() 32, "algorithm B class 10 (DL ONLY)"); } +static void test_many_connections() +{ + test_many_connections(alloc_algorithm_a, 160, "algorithm A"); + test_many_connections(alloc_algorithm_b, 32, "algorithm B"); +} + int main(int argc, char **argv) { tall_pcu_ctx = talloc_named_const(NULL, 1, "moiji-mobile AllocTest context"); @@ -701,6 +756,7 @@ int main(int argc, char **argv) test_alloc_a(); test_alloc_b(); test_successive_allocation(); + test_many_connections(); return EXIT_SUCCESS; } |