aboutsummaryrefslogtreecommitdiffstats
path: root/tests/alloc/AllocTest.cpp
diff options
context:
space:
mode:
authorMax <msuraev@sysmocom.de>2018-01-23 20:57:08 +0100
committerHarald Welte <laforge@gnumonks.org>2018-01-25 16:12:57 +0000
commit9f46071409d1ac17a4be5442185f88c4829c310c (patch)
tree7ae437d72eab1a436ff368fd7c958c5055c9fa88 /tests/alloc/AllocTest.cpp
parentc59ef12e51460e97ab6b61a483c35e2fc8f84991 (diff)
AllocTest: remove assumption on max MS class
So far the allocation was only tested up to hardcoded MS class 29. Drop that assumption and test for all supported MS classes. Adjust expected test output as necessary. Note: using mslot_class_max() forces allocation for MS classes 30 and 31 for which no actual data is available (will be added in follow-up patches) which current implementation treats differently depending on TX/RX direction - see gprs_alloc_max_dl_slots_per_ms(). Because of that we have to adjust the expected number of allocations in test_successive_allocation() as well. Change-Id: I7737f303d97197ef159b14a19c3312a11f07b433 Related: OS#2282
Diffstat (limited to 'tests/alloc/AllocTest.cpp')
-rw-r--r--tests/alloc/AllocTest.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/tests/alloc/AllocTest.cpp b/tests/alloc/AllocTest.cpp
index bbc8c7e9..231a9467 100644
--- a/tests/alloc/AllocTest.cpp
+++ b/tests/alloc/AllocTest.cpp
@@ -26,6 +26,7 @@
#include <stdio.h>
extern "C" {
+#include "mslot_class.h"
#include <osmocom/core/application.h>
#include <osmocom/core/msgb.h>
#include <osmocom/core/talloc.h>
@@ -397,13 +398,13 @@ static void test_all_alloc_b()
for (uint8_t ts5 = 0; ts5 < 2; ++ts5)
for (uint8_t ts6 = 0; ts6 < 2; ++ts6)
for (uint8_t ts7 = 0; ts7 < 2; ++ts7)
- for (int ms_class = 0; ms_class < 30; ++ms_class)
+ for (int ms_class = 0; ms_class < mslot_class_max(); ++ms_class)
test_alloc_mass(ts0, ts1, ts2, ts3, ts4, ts5, ts6, ts7, ms_class);
}
static void test_alloc_b()
{
- for (int i = 0; i < 30; ++i)
+ for (int i = 0; i < mslot_class_max(); ++i)
test_alloc_b_for_ms(i);
test_all_alloc_b();
@@ -684,7 +685,7 @@ static void test_many_connections(algo_t algo, unsigned expect_num,
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]);
+ counter1 = alloc_many_tbfs(&the_bts, 1, mslot_class_max(), mode_seq[i]);
fprintf(stderr, " Allocated %d TBFs (previously %d)\n",
counter1, counter2);
@@ -724,9 +725,9 @@ static void test_successive_allocations()
test_successive_allocation(alloc_algorithm_b, 10, 10, TEST_MODE_UL_AND_DL, 32, "B");
test_successive_allocation(alloc_algorithm_b, 12, 12, TEST_MODE_UL_AND_DL, 32, "B");
- test_successive_allocation(alloc_algorithm_b, 1, 12, TEST_MODE_UL_AND_DL, 32, "B");
- test_successive_allocation(alloc_algorithm_b, 1, 29, TEST_MODE_UL_AND_DL, 32, "B");
- test_successive_allocation(alloc_algorithm_dynamic, 1, 29, TEST_MODE_UL_AND_DL, 35, "dynamic");
+ test_successive_allocation(alloc_algorithm_b, 1, 12, TEST_MODE_UL_AND_DL, 32, "B");
+ test_successive_allocation(alloc_algorithm_b, 1, mslot_class_max(), TEST_MODE_UL_AND_DL, 29, "B");
+ test_successive_allocation(alloc_algorithm_dynamic, 1, mslot_class_max(), TEST_MODE_UL_AND_DL, 35, "dynamic");
test_a_b_dyn(TEST_MODE_DL_AND_UL, 35, 32, 32);
test_a_b_dyn(TEST_MODE_DL_AFTER_UL, 160, 32, 95);
@@ -802,7 +803,7 @@ int main(int argc, char **argv)
test_alloc_b();
test_successive_allocations();
test_many_connections(alloc_algorithm_a, 160, "A");
- test_many_connections(alloc_algorithm_b, 32, "B");
+ test_many_connections(alloc_algorithm_b, 29, "B");
test_many_connections(alloc_algorithm_dynamic, 160, "dynamic");
test_2_consecutive_dl_tbfs();
return EXIT_SUCCESS;