Change in osmo-pcu[master]: Add test for MS mode and (M)CS settings

Harald Welte gerrit-no-reply at lists.osmocom.org
Thu Apr 11 07:29:54 UTC 2019


Harald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/13164 )

Change subject: Add test for MS mode and (M)CS settings
......................................................................

Add test for MS mode and (M)CS settings

Right now set_mode() on GprsMs behaves in pretty counter-intuitive way:
* it's possible to set current DL MCS higher than max value
* EGPRS and EGPRS_GMSK have the same max DL MCS
* setting EGPRS* mode drops current/max MCS values to unknown

Let's capture this in a unit-test before attempting any further
modifications.

Change-Id: Ibf917f4b49d927a21cbd467775806fa6ea06a6a6
---
M tests/ms/MsTest.cpp
M tests/ms/MsTest.err
M tests/ms/MsTest.ok
3 files changed, 86 insertions(+), 0 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/tests/ms/MsTest.cpp b/tests/ms/MsTest.cpp
index aa600e5..4f8f3a0 100644
--- a/tests/ms/MsTest.cpp
+++ b/tests/ms/MsTest.cpp
@@ -531,6 +531,75 @@
 	printf("=== end %s ===\n", __func__);
 }
 
+static void dump_ms(const GprsMs *ms, const char *pref)
+{
+	printf("%s MS DL %s/%s, UL %s/%s, mode %s, <%s>\n", pref,
+	       mcs_name(ms->current_cs_dl()), mcs_name(ms->max_cs_dl()),
+	       mcs_name(ms->current_cs_ul()), mcs_name(ms->max_cs_ul()),
+	       mode_name(ms->mode()),
+	       ms->is_idle() ? "IDLE" : "ACTIVE");
+}
+
+static void test_ms_mcs_mode()
+{
+	BTS the_bts;
+	gprs_rlcmac_bts *bts = the_bts.bts_data();
+	uint32_t tlli = 0xdeadbeef;
+
+	gprs_rlcmac_dl_tbf *dl_tbf;
+	GprsMs *ms1, *ms2;
+
+	printf("=== start %s ===\n", __func__);
+
+	ms1 = new GprsMs(&the_bts, tlli);
+	dump_ms(ms1, "1: no BTS defaults  ");
+
+	bts->initial_cs_dl = 4;
+	bts->initial_cs_ul = 1;
+	bts->cs_downgrade_threshold = 0;
+
+	ms2 = new GprsMs(&the_bts, 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(NULL);
+
+	dl_tbf->set_ms(ms2);
+	dump_ms(ms2, "2: after TBF attach ");
+
+	ms1->set_mode(EGPRS);
+	dump_ms(ms1, "1: after mode set   ");
+
+	ms2->set_mode(EGPRS);
+	dump_ms(ms2, "2: after mode set   ");
+
+	ms1->set_current_cs_dl(MCS7);
+	dump_ms(ms1, "1: after MCS set    ");
+
+	ms2->set_current_cs_dl(MCS8);
+	dump_ms(ms2, "2: after MCS set    ");
+
+	ms1->set_mode(EGPRS_GMSK);
+	dump_ms(ms1, "1: after mode set   ");
+
+	ms2->set_mode(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 ");
+
+	ms1->set_mode(GPRS);
+	dump_ms(ms1, "1: after mode set   ");
+
+	ms2->set_mode(GPRS);
+	dump_ms(ms2, "2: after mode set   ");
+
+	talloc_free(dl_tbf);
+
+	printf("=== end %s ===\n", __func__);
+}
+
 int main(int argc, char **argv)
 {
 	struct vty_app_info pcu_vty_info = {0};
@@ -556,6 +625,7 @@
 	test_ms_storage();
 	test_ms_timeout();
 	test_ms_cs_selection();
+	test_ms_mcs_mode();
 
 	if (getenv("TALLOC_REPORT_FULL"))
 		talloc_report_full(tall_pcu_ctx, stderr);
diff --git a/tests/ms/MsTest.err b/tests/ms/MsTest.err
index a2e4a0c..735c4fe 100644
--- a/tests/ms/MsTest.err
+++ b/tests/ms/MsTest.err
@@ -56,3 +56,6 @@
 Destroying MS object, TLLI = 0xffeeddbb
 Creating MS object, TLLI = 0xffeeddbb
 Attaching TBF to MS object, TLLI = 0xffeeddbb, TBF = TBF(TFI=0 TLLI=0xffeeddbb DIR=DL STATE=NULL)
+Creating MS object, TLLI = 0xdeadbeef
+Creating MS object, TLLI = 0xdeadbef0
+Attaching TBF to MS object, TLLI = 0xdeadbef0, TBF = TBF(TFI=0 TLLI=0xdeadbef0 DIR=DL STATE=NULL)
diff --git a/tests/ms/MsTest.ok b/tests/ms/MsTest.ok
index f14cceb..9952d59 100644
--- a/tests/ms/MsTest.ok
+++ b/tests/ms/MsTest.ok
@@ -18,3 +18,16 @@
 === end test_ms_timeout ===
 === start test_ms_cs_selection ===
 === end test_ms_cs_selection ===
+=== start test_ms_mcs_mode ===
+1: no BTS defaults   MS DL UNKNOWN/UNKNOWN, UL UNKNOWN/UNKNOWN, mode GPRS, <IDLE>
+2: with BTS defaults MS DL CS-4/CS-4, UL CS-1/CS-4, mode GPRS, <IDLE>
+2: after TBF attach  MS DL CS-4/CS-4, UL CS-1/CS-4, mode GPRS, <ACTIVE>
+1: after mode set    MS DL UNKNOWN/UNKNOWN, UL UNKNOWN/UNKNOWN, mode EGPRS, <IDLE>
+2: after mode set    MS DL UNKNOWN/UNKNOWN, UL UNKNOWN/UNKNOWN, mode EGPRS, <ACTIVE>
+1: after MCS set     MS DL MCS-7/MCS-4, UL UNKNOWN/UNKNOWN, mode EGPRS, <IDLE>
+2: after MCS set     MS DL MCS-8/MCS-4, UL UNKNOWN/UNKNOWN, mode EGPRS, <ACTIVE>
+1: after mode set    MS DL MCS-7/MCS-4, UL UNKNOWN/UNKNOWN, mode EGPRS_GMSK-only, <IDLE>
+2: after mode set    MS DL MCS-8/MCS-4, UL UNKNOWN/UNKNOWN, mode EGPRS_GMSK-only, <ACTIVE>
+1: after mode set    MS DL CS-4/CS-4, UL CS-1/CS-4, mode GPRS, <IDLE>
+2: after mode set    MS DL CS-4/CS-4, UL CS-1/CS-4, mode GPRS, <ACTIVE>
+=== end test_ms_mcs_mode ===

-- 
To view, visit https://gerrit.osmocom.org/13164
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ibf917f4b49d927a21cbd467775806fa6ea06a6a6
Gerrit-Change-Number: 13164
Gerrit-PatchSet: 4
Gerrit-Owner: Max <suraev at alumni.ntnu.no>
Gerrit-Reviewer: Daniel Willmann <dwillmann at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Max <suraev at alumni.ntnu.no>
Gerrit-Reviewer: osmith <osmith at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190411/e95e6e5a/attachment.html>


More information about the gerrit-log mailing list