aboutsummaryrefslogtreecommitdiffstats
path: root/tests/ms/MsTest.cpp
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2023-04-17 14:25:51 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2023-04-17 20:46:41 +0200
commitf80cc5b9c81c6711a25e460ac5df793517ed5566 (patch)
tree52d69edd30dd5b73510eaae02c94b06f1e75dec7 /tests/ms/MsTest.cpp
parent14379ef901df1735a2d54fe3bb5bc353abe7ba51 (diff)
ms: Drop setting tlli during ms_alloc()
Inside osmo-pcu code, the code path is to always call ms_alloc with tlli=GSM_RESERVED_TMSI; a different value is only passed during unit tests. It makes no sense to have unit tests using differnet code paths than ther app itself, since in the app it always desired to go through the ms_set_tlli() and ms_confirm_tlli() which does more stuff. Hence, drop the tlli param in ms_alloc and change the unit tests to use the available APIs used by the application. Change-Id: I730ec911a43b0f4e78faee4eeffb3ca8601564f8
Diffstat (limited to 'tests/ms/MsTest.cpp')
-rw-r--r--tests/ms/MsTest.cpp25
1 files changed, 15 insertions, 10 deletions
diff --git a/tests/ms/MsTest.cpp b/tests/ms/MsTest.cpp
index 6a770c9b..ec1672a6 100644
--- a/tests/ms/MsTest.cpp
+++ b/tests/ms/MsTest.cpp
@@ -86,7 +86,8 @@ static void test_ms_state()
printf("=== start %s ===\n", __func__);
- ms = ms_alloc(bts, tlli);
+ ms = ms_alloc(bts);
+ ms_set_tlli(ms, tlli);
OSMO_ASSERT(ms_is_idle(ms));
dl_tbf = alloc_dl_tbf(bts, ms);
@@ -148,7 +149,8 @@ static void test_ms_callback()
printf("=== start %s ===\n", __func__);
- ms = ms_alloc(bts, tlli);
+ ms = ms_alloc(bts);
+ ms_set_tlli(ms, tlli);
ms_set_callback(ms, &ms_cb);
OSMO_ASSERT(ms_is_idle(ms));
@@ -219,7 +221,8 @@ static void test_ms_replace_tbf()
printf("=== start %s ===\n", __func__);
- ms = ms_alloc(bts, tlli);
+ ms = ms_alloc(bts);
+ ms_confirm_tlli(ms, tlli);
ms_set_callback(ms, &ms_replace_tbf_cb);
OSMO_ASSERT(ms_is_idle(ms));
@@ -290,7 +293,7 @@ static void test_ms_change_tlli()
printf("=== start %s ===\n", __func__);
- ms = ms_alloc(bts, start_tlli);
+ ms = ms_alloc(bts);
OSMO_ASSERT(ms_is_idle(ms));
@@ -298,12 +301,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);
@@ -474,7 +475,8 @@ static void test_ms_timeout()
printf("=== start %s ===\n", __func__);
- ms = ms_alloc(bts, tlli);
+ ms = ms_alloc(bts);
+ ms_set_tlli(ms, tlli);
ms_set_callback(ms, &ms_cb);
ms_set_timeout(ms, 1);
@@ -532,7 +534,8 @@ 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);
+ ms_confirm_tlli(ms, tlli);
OSMO_ASSERT(ms_is_idle(ms));
@@ -571,14 +574,16 @@ static void test_ms_mcs_mode()
printf("=== start %s ===\n", __func__);
- ms1 = ms_alloc(bts, tlli);
+ ms1 = ms_alloc(bts);
+ 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);
+ ms_confirm_tlli(ms2, tlli + 1);
dump_ms(ms2, "2: with BTS defaults");
dl_tbf = alloc_dl_tbf(bts, ms2);