aboutsummaryrefslogtreecommitdiffstats
path: root/tests/ms/MsTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ms/MsTest.cpp')
-rw-r--r--tests/ms/MsTest.cpp284
1 files changed, 107 insertions, 177 deletions
diff --git a/tests/ms/MsTest.cpp b/tests/ms/MsTest.cpp
index 498c8358..5bfbc28f 100644
--- a/tests/ms/MsTest.cpp
+++ b/tests/ms/MsTest.cpp
@@ -24,7 +24,6 @@
#include "tbf_ul.h"
#include "gprs_debug.h"
#include "gprs_ms.h"
-#include "gprs_ms_storage.h"
#include "bts.h"
extern "C" {
@@ -46,120 +45,77 @@ void *tall_pcu_ctx;
int16_t spoof_mnc = 0, spoof_mcc = 0;
bool spoof_mnc_3_digits = false;
-static void test_ms_state()
+static int ul_tbf_dtor(struct gprs_rlcmac_ul_tbf *tbf)
{
- uint32_t tlli = 0xffeeddbb;
- gprs_rlcmac_dl_tbf *dl_tbf;
- gprs_rlcmac_ul_tbf *ul_tbf;
- struct gprs_rlcmac_bts *bts = bts_alloc(the_pcu, 0);
- GprsMs *ms;
-
- printf("=== start %s ===\n", __func__);
+ tbf->~gprs_rlcmac_ul_tbf();
+ return 0;
+}
- ms = ms_alloc(bts, tlli);
- OSMO_ASSERT(ms_is_idle(ms));
+static int dl_tbf_dtor(struct gprs_rlcmac_dl_tbf *tbf)
+{
+ tbf->~gprs_rlcmac_dl_tbf();
+ return 0;
+}
- dl_tbf = talloc_zero(tall_pcu_ctx, struct gprs_rlcmac_dl_tbf);
- new (dl_tbf) gprs_rlcmac_dl_tbf(bts, ms);
+static gprs_rlcmac_ul_tbf *alloc_ul_tbf(struct gprs_rlcmac_bts *bts, GprsMs *ms)
+{
+ gprs_rlcmac_ul_tbf *ul_tbf;
ul_tbf = talloc_zero(tall_pcu_ctx, struct gprs_rlcmac_ul_tbf);
+ talloc_set_destructor(ul_tbf, ul_tbf_dtor);
new (ul_tbf) gprs_rlcmac_ul_tbf(bts, ms);
-
- ms_attach_tbf(ms, ul_tbf);
- OSMO_ASSERT(!ms_is_idle(ms));
- OSMO_ASSERT(ms_ul_tbf(ms) == ul_tbf);
- OSMO_ASSERT(ms_dl_tbf(ms) == NULL);
-
- ms_attach_tbf(ms, dl_tbf);
- OSMO_ASSERT(!ms_is_idle(ms));
- OSMO_ASSERT(ms_ul_tbf(ms) == ul_tbf);
- OSMO_ASSERT(ms_dl_tbf(ms) == dl_tbf);
-
- OSMO_ASSERT(ms_tbf(ms, GPRS_RLCMAC_UL_TBF) == ul_tbf);
- OSMO_ASSERT(ms_tbf(ms, GPRS_RLCMAC_DL_TBF) == dl_tbf);
-
- ms_detach_tbf(ms, ul_tbf);
- OSMO_ASSERT(!ms_is_idle(ms));
- OSMO_ASSERT(ms_ul_tbf(ms) == NULL);
- OSMO_ASSERT(ms_dl_tbf(ms) == dl_tbf);
-
- ms_detach_tbf(ms, dl_tbf);
- /* The ms object is freed now */
- ms = NULL;
-
- talloc_free(dl_tbf);
- talloc_free(ul_tbf);
- talloc_free(bts);
- printf("=== end %s ===\n", __func__);
+ return ul_tbf;
}
-static enum {CB_UNKNOWN, CB_IS_IDLE, CB_IS_ACTIVE} last_cb = CB_UNKNOWN;
-static void ms_idle_cb(struct GprsMs *ms)
-{
- OSMO_ASSERT(ms_is_idle(ms));
- printf(" ms_idle() was called\n");
- last_cb = CB_IS_IDLE;
-}
-static void ms_active_cb(struct GprsMs *ms)
+static gprs_rlcmac_dl_tbf *alloc_dl_tbf(struct gprs_rlcmac_bts *bts, GprsMs *ms)
{
- OSMO_ASSERT(!ms_is_idle(ms));
- printf(" ms_active() was called\n");
- last_cb = CB_IS_ACTIVE;
+ gprs_rlcmac_dl_tbf *dl_tbf;
+ dl_tbf = talloc_zero(tall_pcu_ctx, struct gprs_rlcmac_dl_tbf);
+ talloc_set_destructor(dl_tbf, dl_tbf_dtor);
+ new (dl_tbf) gprs_rlcmac_dl_tbf(bts, ms);
+ return dl_tbf;
}
-static struct gpr_ms_callback ms_cb = {
- .ms_idle = ms_idle_cb,
- .ms_active = ms_active_cb
-};
-static void test_ms_callback()
+
+static void test_ms_state()
{
uint32_t tlli = 0xffeeddbb;
gprs_rlcmac_dl_tbf *dl_tbf;
gprs_rlcmac_ul_tbf *ul_tbf;
struct gprs_rlcmac_bts *bts = bts_alloc(the_pcu, 0);
GprsMs *ms;
- last_cb = CB_UNKNOWN;
printf("=== start %s ===\n", __func__);
- ms = ms_alloc(bts, tlli);
- ms_set_callback(ms, &ms_cb);
-
+ ms = ms_alloc(bts, __func__);
+ ms_set_tlli(ms, tlli);
OSMO_ASSERT(ms_is_idle(ms));
- dl_tbf = talloc_zero(tall_pcu_ctx, struct gprs_rlcmac_dl_tbf);
- new (dl_tbf) gprs_rlcmac_dl_tbf(bts, ms);
- ul_tbf = talloc_zero(tall_pcu_ctx, struct gprs_rlcmac_ul_tbf);
- new (ul_tbf) gprs_rlcmac_ul_tbf(bts, ms);
-
- OSMO_ASSERT(last_cb == CB_UNKNOWN);
+ dl_tbf = alloc_dl_tbf(bts, ms);
+ ul_tbf = alloc_ul_tbf(bts, ms);
ms_attach_tbf(ms, ul_tbf);
OSMO_ASSERT(!ms_is_idle(ms));
OSMO_ASSERT(ms_ul_tbf(ms) == ul_tbf);
OSMO_ASSERT(ms_dl_tbf(ms) == NULL);
- OSMO_ASSERT(last_cb == CB_IS_ACTIVE);
-
- last_cb = CB_UNKNOWN;
ms_attach_tbf(ms, dl_tbf);
OSMO_ASSERT(!ms_is_idle(ms));
OSMO_ASSERT(ms_ul_tbf(ms) == ul_tbf);
OSMO_ASSERT(ms_dl_tbf(ms) == dl_tbf);
- OSMO_ASSERT(last_cb == CB_UNKNOWN);
+
+ OSMO_ASSERT(ms_tbf(ms, GPRS_RLCMAC_UL_TBF) == ul_tbf);
+ OSMO_ASSERT(ms_tbf(ms, GPRS_RLCMAC_DL_TBF) == dl_tbf);
+
+ /* The MS is kept alive references by the TBFs: */
+ ms_unref(ms, __func__);
ms_detach_tbf(ms, ul_tbf);
OSMO_ASSERT(!ms_is_idle(ms));
OSMO_ASSERT(ms_ul_tbf(ms) == NULL);
OSMO_ASSERT(ms_dl_tbf(ms) == dl_tbf);
- OSMO_ASSERT(last_cb == CB_UNKNOWN);
ms_detach_tbf(ms, dl_tbf);
- OSMO_ASSERT(ms_is_idle(ms));
- OSMO_ASSERT(ms_ul_tbf(ms) == NULL);
- OSMO_ASSERT(ms_dl_tbf(ms) == NULL);
- OSMO_ASSERT(last_cb == CB_IS_IDLE);
-
- last_cb = CB_UNKNOWN;
- talloc_free(ms);
+ /* The ms object is freed now */
+ ms = NULL;
talloc_free(dl_tbf);
talloc_free(ul_tbf);
@@ -167,22 +123,6 @@ static void test_ms_callback()
printf("=== end %s ===\n", __func__);
}
-static bool was_idle;
-static void ms_replace_tbf_idle_cb(struct GprsMs *ms)
-{
- OSMO_ASSERT(ms_is_idle(ms));
- printf(" ms_idle() was called\n");
- was_idle = true;
-}
-static void ms_replace_tbf_active_cb(struct GprsMs *ms)
-{
- OSMO_ASSERT(!ms_is_idle(ms));
- printf(" ms_active() was called\n");
-}
-static struct gpr_ms_callback ms_replace_tbf_cb = {
- .ms_idle = ms_replace_tbf_idle_cb,
- .ms_active = ms_replace_tbf_active_cb
-};
static void test_ms_replace_tbf()
{
uint32_t tlli = 0xffeeddbb;
@@ -193,62 +133,50 @@ static void test_ms_replace_tbf()
printf("=== start %s ===\n", __func__);
- ms = ms_alloc(bts, tlli);
- ms_set_callback(ms, &ms_replace_tbf_cb);
+ ms = ms_alloc(bts, __func__);
+ ms_confirm_tlli(ms, tlli);
OSMO_ASSERT(ms_is_idle(ms));
- was_idle = false;
- dl_tbf[0] = talloc_zero(tall_pcu_ctx, struct gprs_rlcmac_dl_tbf);
- new (dl_tbf[0]) gprs_rlcmac_dl_tbf(bts, ms);
- dl_tbf[1] = talloc_zero(tall_pcu_ctx, struct gprs_rlcmac_dl_tbf);
- new (dl_tbf[1]) gprs_rlcmac_dl_tbf(bts, ms);
- ul_tbf = talloc_zero(tall_pcu_ctx, struct gprs_rlcmac_ul_tbf);
- new (ul_tbf) gprs_rlcmac_ul_tbf(bts, ms);
+ dl_tbf[0] = alloc_dl_tbf(bts, ms);
+ dl_tbf[1] = alloc_dl_tbf(bts, ms);
+ ul_tbf = alloc_ul_tbf(bts, ms);
ms_attach_tbf(ms, dl_tbf[0]);
OSMO_ASSERT(!ms_is_idle(ms));
OSMO_ASSERT(ms_ul_tbf(ms) == NULL);
OSMO_ASSERT(ms_dl_tbf(ms) == dl_tbf[0]);
OSMO_ASSERT(llist_empty(&ms->old_tbfs));
- OSMO_ASSERT(!was_idle);
ms_attach_tbf(ms, dl_tbf[1]);
OSMO_ASSERT(!ms_is_idle(ms));
OSMO_ASSERT(ms_ul_tbf(ms) == NULL);
OSMO_ASSERT(ms_dl_tbf(ms) == dl_tbf[1]);
OSMO_ASSERT(!llist_empty(&ms->old_tbfs));
- OSMO_ASSERT(!was_idle);
ms_attach_tbf(ms, ul_tbf);
OSMO_ASSERT(!ms_is_idle(ms));
OSMO_ASSERT(ms_ul_tbf(ms) == ul_tbf);
OSMO_ASSERT(ms_dl_tbf(ms) == dl_tbf[1]);
OSMO_ASSERT(!llist_empty(&ms->old_tbfs));
- OSMO_ASSERT(!was_idle);
+
+ ms_unref(ms, __func__);
ms_detach_tbf(ms, ul_tbf);
OSMO_ASSERT(!ms_is_idle(ms));
OSMO_ASSERT(ms_ul_tbf(ms) == NULL);
OSMO_ASSERT(ms_dl_tbf(ms) == dl_tbf[1]);
OSMO_ASSERT(!llist_empty(&ms->old_tbfs));
- OSMO_ASSERT(!was_idle);
ms_detach_tbf(ms, dl_tbf[0]);
OSMO_ASSERT(!ms_is_idle(ms));
OSMO_ASSERT(ms_ul_tbf(ms) == NULL);
OSMO_ASSERT(ms_dl_tbf(ms) == dl_tbf[1]);
OSMO_ASSERT(llist_empty(&ms->old_tbfs));
- OSMO_ASSERT(!was_idle);
ms_detach_tbf(ms, dl_tbf[1]);
- OSMO_ASSERT(ms_is_idle(ms));
- OSMO_ASSERT(ms_ul_tbf(ms) == NULL);
- OSMO_ASSERT(ms_dl_tbf(ms) == NULL);
- OSMO_ASSERT(llist_empty(&ms->old_tbfs));
- OSMO_ASSERT(was_idle);
-
- talloc_free(ms);
+ /* MS is gone now: */
+ OSMO_ASSERT(bts_get_ms_by_tlli(bts, tlli, GSM_RESERVED_TMSI) == NULL);
talloc_free(dl_tbf[0]);
talloc_free(dl_tbf[1]);
@@ -267,7 +195,7 @@ static void test_ms_change_tlli()
printf("=== start %s ===\n", __func__);
- ms = ms_alloc(bts, start_tlli);
+ ms = ms_alloc(bts, __func__);
OSMO_ASSERT(ms_is_idle(ms));
@@ -275,12 +203,10 @@ static void test_ms_change_tlli()
ms_set_tlli(ms, new_ms_tlli);
OSMO_ASSERT(ms_tlli(ms) == new_ms_tlli);
OSMO_ASSERT(ms_check_tlli(ms, new_ms_tlli));
- OSMO_ASSERT(ms_check_tlli(ms, start_tlli));
ms_confirm_tlli(ms, new_ms_tlli);
OSMO_ASSERT(ms_tlli(ms) == new_ms_tlli);
OSMO_ASSERT(ms_check_tlli(ms, new_ms_tlli));
- OSMO_ASSERT(!ms_check_tlli(ms, start_tlli));
/* MS announces TLLI, SGSN uses it later */
ms_set_tlli(ms, start_tlli);
@@ -346,18 +272,20 @@ static void test_ms_change_tlli()
OSMO_ASSERT(ms_check_tlli(ms, new_ms_tlli));
OSMO_ASSERT(!ms_check_tlli(ms, start_tlli));
- talloc_free(ms);
+ /* This frees the MS: */
+ ms_unref(ms, __func__);
+
talloc_free(bts);
printf("=== end %s ===\n", __func__);
}
-static GprsMs *prepare_ms(GprsMsStorage *st, uint32_t tlli, enum gprs_rlcmac_tbf_direction dir)
+static GprsMs *prepare_ms(struct gprs_rlcmac_bts *bts, uint32_t tlli, enum gprs_rlcmac_tbf_direction dir)
{
- GprsMs *ms = st->get_ms(tlli);
+ GprsMs *ms = bts_get_ms_by_tlli(bts, tlli, GSM_RESERVED_TMSI);
if (ms)
return ms;
- ms = st->create_ms();
+ ms = ms_alloc(bts, NULL);
if (dir == GPRS_RLCMAC_UL_TBF)
ms_set_tlli(ms, tlli);
@@ -376,66 +304,65 @@ static void test_ms_storage()
gprs_rlcmac_ul_tbf *ul_tbf;
struct gprs_rlcmac_bts *bts = bts_alloc(the_pcu, 0);
GprsMs *ms, *ms_tmp;
- GprsMsStorage store(bts);
printf("=== start %s ===\n", __func__);
- ms = store.get_ms(tlli + 0);
+ ms = bts_get_ms_by_tlli(bts, tlli + 0, GSM_RESERVED_TMSI);
OSMO_ASSERT(ms == NULL);
- ms = prepare_ms(&store, tlli + 0, GPRS_RLCMAC_UL_TBF);
+ ms = prepare_ms(bts, tlli + 0, GPRS_RLCMAC_UL_TBF);
OSMO_ASSERT(ms != NULL);
OSMO_ASSERT(ms_tlli(ms) == tlli + 0);
ms_set_imsi(ms, imsi1);
OSMO_ASSERT(strcmp(ms_imsi(ms), imsi1) == 0);
- ms_tmp = store.get_ms(tlli + 0);
+ ms_tmp = bts_get_ms_by_tlli(bts, tlli + 0, GSM_RESERVED_TMSI);
OSMO_ASSERT(ms == ms_tmp);
OSMO_ASSERT(ms_tlli(ms) == tlli + 0);
- ms_tmp = store.get_ms(0, 0, imsi1);
+ ms_tmp = bts_get_ms_by_imsi(bts, imsi1);
OSMO_ASSERT(ms == ms_tmp);
OSMO_ASSERT(strcmp(ms_imsi(ms), imsi1) == 0);
- ms_tmp = store.get_ms(0, 0, imsi2);
+ ms_tmp = bts_get_ms_by_imsi(bts, imsi2);
OSMO_ASSERT(ms_tmp == NULL);
- ms = prepare_ms(&store, tlli + 1, GPRS_RLCMAC_UL_TBF);
+ ms = prepare_ms(bts, tlli + 1, GPRS_RLCMAC_UL_TBF);
OSMO_ASSERT(ms != NULL);
OSMO_ASSERT(ms_tlli(ms) == tlli + 1);
ms_set_imsi(ms, imsi2);
OSMO_ASSERT(strcmp(ms_imsi(ms), imsi2) == 0);
- ms_tmp = store.get_ms(tlli + 1);
+ ms_tmp = bts_get_ms_by_tlli(bts, tlli + 1, GSM_RESERVED_TMSI);
OSMO_ASSERT(ms == ms_tmp);
OSMO_ASSERT(ms_tlli(ms) == tlli + 1);
- ms_tmp = store.get_ms(0, 0, imsi1);
+ ms_tmp = bts_get_ms_by_imsi(bts, imsi1);
OSMO_ASSERT(ms_tmp != NULL);
OSMO_ASSERT(ms_tmp != ms);
- ms_tmp = store.get_ms(0, 0, imsi2);
+ ms_tmp = bts_get_ms_by_imsi(bts, imsi2);
OSMO_ASSERT(ms == ms_tmp);
OSMO_ASSERT(strcmp(ms_imsi(ms), imsi2) == 0);
/* delete ms */
- ms = store.get_ms(tlli + 0);
+ ms = bts_get_ms_by_tlli(bts, tlli + 0, GSM_RESERVED_TMSI);
OSMO_ASSERT(ms != NULL);
- ul_tbf = talloc_zero(tall_pcu_ctx, struct gprs_rlcmac_ul_tbf);
- new (ul_tbf) gprs_rlcmac_ul_tbf(bts, ms);
+ ul_tbf = alloc_ul_tbf(bts, ms);
ms_attach_tbf(ms, ul_tbf);
- ms_detach_tbf(ms, ul_tbf);
- ms = store.get_ms(tlli + 0);
+ tbf_set_ms(ul_tbf, NULL);
+ ms = bts_get_ms_by_tlli(bts, tlli + 0, GSM_RESERVED_TMSI);
OSMO_ASSERT(ms == NULL);
- ms = store.get_ms(tlli + 1);
+ ms = bts_get_ms_by_tlli(bts, tlli + 1, GSM_RESERVED_TMSI);
OSMO_ASSERT(ms != NULL);
/* delete ms */
- ms = store.get_ms(tlli + 1);
+ ms = bts_get_ms_by_tlli(bts, tlli + 1, GSM_RESERVED_TMSI);
OSMO_ASSERT(ms != NULL);
- ms_attach_tbf(ms, ul_tbf);
- ms_detach_tbf(ms, ul_tbf);
- ms = store.get_ms(tlli + 1);
+ tbf_set_ms(ul_tbf, ms);
+ tbf_set_ms(ul_tbf, NULL);
+ ms = bts_get_ms_by_tlli(bts, tlli + 1, GSM_RESERVED_TMSI);
OSMO_ASSERT(ms == NULL);
+ talloc_free(ms);
talloc_free(ul_tbf);
talloc_free(bts);
printf("=== end %s ===\n", __func__);
@@ -448,53 +375,49 @@ static void test_ms_timeout()
gprs_rlcmac_ul_tbf *ul_tbf;
struct gprs_rlcmac_bts *bts = bts_alloc(the_pcu, 0);
GprsMs *ms;
- last_cb = CB_UNKNOWN;
printf("=== start %s ===\n", __func__);
- ms = ms_alloc(bts, tlli);
- ms_set_callback(ms, &ms_cb);
- ms_set_timeout(ms, 1);
+ OSMO_ASSERT(osmo_tdef_set(the_pcu->T_defs, -2030, 1, OSMO_TDEF_S) == 0);
- OSMO_ASSERT(ms_is_idle(ms));
+ ms = ms_alloc(bts, __func__);
+ ms_set_tlli(ms, tlli);
- dl_tbf = talloc_zero(tall_pcu_ctx, struct gprs_rlcmac_dl_tbf);
- new (dl_tbf) gprs_rlcmac_dl_tbf(bts, ms);
- ul_tbf = talloc_zero(tall_pcu_ctx, struct gprs_rlcmac_ul_tbf);
- new (ul_tbf) gprs_rlcmac_ul_tbf(bts, ms);
+ OSMO_ASSERT(ms_is_idle(ms));
- OSMO_ASSERT(last_cb == CB_UNKNOWN);
+ dl_tbf = alloc_dl_tbf(bts, ms);
+ ul_tbf = alloc_ul_tbf(bts, ms);
ms_attach_tbf(ms, ul_tbf);
OSMO_ASSERT(!ms_is_idle(ms));
- OSMO_ASSERT(last_cb == CB_IS_ACTIVE);
-
- last_cb = CB_UNKNOWN;
ms_attach_tbf(ms, dl_tbf);
OSMO_ASSERT(!ms_is_idle(ms));
- OSMO_ASSERT(last_cb == CB_UNKNOWN);
+
+ /* MS is kept alive by TBFs referencing it: */
+ ms_unref(ms, __func__);
ms_detach_tbf(ms, ul_tbf);
OSMO_ASSERT(!ms_is_idle(ms));
- OSMO_ASSERT(last_cb == CB_UNKNOWN);
ms_detach_tbf(ms, dl_tbf);
- OSMO_ASSERT(!ms_is_idle(ms));
- OSMO_ASSERT(last_cb == CB_UNKNOWN);
+ /* test MS still exists and it's idle: */
+ OSMO_ASSERT(bts_get_ms_by_tlli(bts, tlli, GSM_RESERVED_TMSI) != NULL);
+ OSMO_ASSERT(ms_is_idle(ms));
+ OSMO_ASSERT(osmo_timer_pending(&ms->release_timer));
usleep(1100000);
osmo_timers_update();
- OSMO_ASSERT(ms_is_idle(ms));
- OSMO_ASSERT(last_cb == CB_IS_IDLE);
+ /* MS is gone now: */
+ OSMO_ASSERT(bts_get_ms_by_tlli(bts, tlli, GSM_RESERVED_TMSI) == NULL);
- last_cb = CB_UNKNOWN;
- talloc_free(ms);
talloc_free(dl_tbf);
talloc_free(ul_tbf);
talloc_free(bts);
printf("=== end %s ===\n", __func__);
+ /* Return the timer to the usually expected value 0 for other tests: */
+ OSMO_ASSERT(osmo_tdef_set(the_pcu->T_defs, -2030, 0, OSMO_TDEF_S) == 0);
}
static void test_ms_cs_selection()
@@ -512,12 +435,12 @@ static void test_ms_cs_selection()
the_pcu->vty.cs_downgrade_threshold = 0;
the_pcu->vty.cs_adj_lower_limit = 0;
- ms = ms_alloc(bts, tlli);
+ ms = ms_alloc(bts, __func__);
+ ms_confirm_tlli(ms, tlli);
OSMO_ASSERT(ms_is_idle(ms));
- dl_tbf = talloc_zero(tall_pcu_ctx, struct gprs_rlcmac_dl_tbf);
- new (dl_tbf) gprs_rlcmac_dl_tbf(bts, ms);
+ dl_tbf = alloc_dl_tbf(bts, ms);
ms_attach_tbf(ms, dl_tbf);
OSMO_ASSERT(!ms_is_idle(ms));
@@ -528,7 +451,10 @@ static void test_ms_cs_selection()
OSMO_ASSERT(mcs_chan_code(ms_current_cs_dl(ms, ms_mode(ms))) == 2);
+ ms_detach_tbf(ms, dl_tbf);
talloc_free(dl_tbf);
+ ms_unref(ms, __func__);
+ /* MS has been freed here*/
talloc_free(bts);
printf("=== end %s ===\n", __func__);
}
@@ -552,18 +478,19 @@ static void test_ms_mcs_mode()
printf("=== start %s ===\n", __func__);
- ms1 = ms_alloc(bts, tlli);
+ ms1 = ms_alloc(bts, __func__);
+ ms_confirm_tlli(ms1, tlli);
dump_ms(ms1, "1: no BTS defaults ");
bts->initial_cs_dl = 4;
bts->initial_cs_ul = 1;
the_pcu->vty.cs_downgrade_threshold = 0;
- ms2 = ms_alloc(bts, tlli + 1);
+ ms2 = ms_alloc(bts,__func__);
+ ms_confirm_tlli(ms2, tlli + 1);
dump_ms(ms2, "2: with BTS defaults");
- dl_tbf = talloc_zero(tall_pcu_ctx, struct gprs_rlcmac_dl_tbf);
- new (dl_tbf) gprs_rlcmac_dl_tbf(bts, ms2);
+ dl_tbf = alloc_dl_tbf(bts, ms2);
ms_attach_tbf(ms2, dl_tbf);
dump_ms(ms2, "2: after TBF attach ");
@@ -586,9 +513,8 @@ static void test_ms_mcs_mode()
ms_set_mode(ms2, EGPRS_GMSK);
dump_ms(ms2, "2: after mode set ");
- // FIXME: following code triggers ASAN failure:
- // ms2->detach_tbf(dl_tbf);
- // dump_ms(ms2, "2: after TBF detach ");
+ ms_detach_tbf(ms2, dl_tbf);
+ dump_ms(ms2, "2: after TBF detach ");
ms_set_mode(ms1, GPRS);
dump_ms(ms1, "1: after mode set ");
@@ -597,6 +523,8 @@ static void test_ms_mcs_mode()
dump_ms(ms2, "2: after mode set ");
talloc_free(dl_tbf);
+ talloc_free(ms1);
+ talloc_free(ms2);
talloc_free(bts);
printf("=== end %s ===\n", __func__);
}
@@ -616,15 +544,16 @@ int main(int argc, char **argv)
log_set_log_level(osmo_stderr_target, LOGL_INFO);
log_set_print_category(osmo_stderr_target, 0);
log_set_print_category_hex(osmo_stderr_target, 0);
- log_parse_category_mask(osmo_stderr_target, "DPCU,3:DRLCMAC,3");
+ log_parse_category_mask(osmo_stderr_target, "DPCU,3:DRLCMAC,3:DMS,3");
the_pcu = gprs_pcu_alloc(tall_pcu_ctx);
vty_init(&pcu_vty_info);
pcu_vty_init();
+ osmo_tdef_set(the_pcu->T_defs, -2030, 0, OSMO_TDEF_S);
+
test_ms_state();
- test_ms_callback();
test_ms_replace_tbf();
test_ms_change_tlli();
test_ms_storage();
@@ -643,6 +572,7 @@ int main(int argc, char **argv)
extern "C" {
void l1if_pdch_req() { abort(); }
void l1if_connect_pdch() { abort(); }
-void l1if_close_pdch() { abort(); }
-void l1if_open_pdch() { abort(); }
+void l1if_disconnect_pdch() { abort(); }
+void l1if_close_trx() { abort(); }
+void l1if_open_trx() { abort(); }
}