aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2015-06-29 12:45:11 +0200
committerJacob Erlbeck <jerlbeck@sysmocom.de>2015-07-03 12:05:51 +0200
commitfa464bbce90130a7f429cdbafac7b64b1fdacd32 (patch)
tree92caa7bfb23afce373fc65773ca25d535137c9f8 /tests
parente565564bc9d74e09ec1962f86aa5155e97377e1f (diff)
alloc/test: Enhance test_alloc_a
This commit adds: - an assertion to check that count is valid, - an assertion the verify that tbf_alloc did not fail - a slots parameter to specify the enabled slots - additional test invocations with more slots enabled Sponsored-by: On-Waves ehf
Diffstat (limited to 'tests')
-rw-r--r--tests/alloc/AllocTest.cpp21
-rw-r--r--tests/alloc/AllocTest.err2
-rw-r--r--tests/alloc/AllocTest.ok2
3 files changed, 20 insertions, 5 deletions
diff --git a/tests/alloc/AllocTest.cpp b/tests/alloc/AllocTest.cpp
index 95a6cb6..70c8551 100644
--- a/tests/alloc/AllocTest.cpp
+++ b/tests/alloc/AllocTest.cpp
@@ -47,9 +47,11 @@ static gprs_rlcmac_tbf *tbf_alloc(struct gprs_rlcmac_bts *bts,
return tbf_alloc_dl_tbf(bts, ms, tfi, trx, ms_class, single_slot);
}
-static void test_alloc_a(gprs_rlcmac_tbf_direction dir, const int count)
+static void test_alloc_a(gprs_rlcmac_tbf_direction dir,
+ uint8_t slots, const int count)
{
int tfi;
+ int i;
uint8_t used_trx;
BTS the_bts;
struct gprs_rlcmac_bts *bts;
@@ -61,8 +63,11 @@ static void test_alloc_a(gprs_rlcmac_tbf_direction dir, const int count)
bts->alloc_algorithm = alloc_algorithm_a;
struct gprs_rlcmac_trx *trx = &bts->trx[0];
- trx->pdch[2].enable();
- trx->pdch[3].enable();
+ for (i = 0; i < 8; i += 1)
+ if (slots & (1 << i))
+ trx->pdch[i].enable();
+
+ OSMO_ASSERT(count >= 0 && count <= (int)ARRAY_SIZE(tbfs));
/**
* Currently alloc_a will only allocate from the first
@@ -74,6 +79,7 @@ static void test_alloc_a(gprs_rlcmac_tbf_direction dir, const int count)
tfi = the_bts.tfi_find_free(dir, &used_trx, 0);
OSMO_ASSERT(tfi >= 0);
tbfs[i] = tbf_alloc(bts, NULL, dir, tfi, used_trx, 0, 0);
+ OSMO_ASSERT(tbfs[i] != NULL);
}
/* Now check that there are still some TFIs */
@@ -102,8 +108,13 @@ static void test_alloc_a(gprs_rlcmac_tbf_direction dir, const int count)
static void test_alloc_a()
{
- test_alloc_a(GPRS_RLCMAC_DL_TBF, 32);
- test_alloc_a(GPRS_RLCMAC_UL_TBF, 7);
+ /* slots 2 - 3 */
+ test_alloc_a(GPRS_RLCMAC_DL_TBF, 0x0c, 32);
+ test_alloc_a(GPRS_RLCMAC_UL_TBF, 0x0c, 7);
+
+ /* slots 1 - 5 */
+ test_alloc_a(GPRS_RLCMAC_DL_TBF, 0x1e, 32);
+ test_alloc_a(GPRS_RLCMAC_UL_TBF, 0x1e, 7);
}
static void dump_assignment(struct gprs_rlcmac_tbf *tbf, const char *dir)
diff --git a/tests/alloc/AllocTest.err b/tests/alloc/AllocTest.err
index 23eea09..db95601 100644
--- a/tests/alloc/AllocTest.err
+++ b/tests/alloc/AllocTest.err
@@ -1,5 +1,7 @@
No TFI available.
- Failed allocating TS=2, no USF available
+No TFI available.
+- Failed allocating TS=1, no USF available
- Failed allocating TS=3, no USF available
No suitable uplink slots available
No suitable uplink slots available
diff --git a/tests/alloc/AllocTest.ok b/tests/alloc/AllocTest.ok
index f5df0f8..89393fc 100644
--- a/tests/alloc/AllocTest.ok
+++ b/tests/alloc/AllocTest.ok
@@ -1,5 +1,7 @@
Testing alloc_a direction(0)
Testing alloc_a direction(1)
+Testing alloc_a direction(0)
+Testing alloc_a direction(1)
Going to test multislot assignment MS_CLASS=0
Testing UL then DL assignment.
PDCH[6] is used for UL