Change in osmo-bts[master]: measurement: fix unit-test test_lchan_meas_process_measurement

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

dexter gerrit-no-reply at lists.osmocom.org
Thu Sep 6 16:11:14 UTC 2018


dexter has uploaded this change for review. ( https://gerrit.osmocom.org/10815


Change subject: measurement: fix unit-test test_lchan_meas_process_measurement
......................................................................

measurement: fix unit-test test_lchan_meas_process_measurement

The unit test that tests lchan_meas_process_measurement() only inputs
test data to lchan_meas_process_measurement() but it is not checked if
the interval end could be detected or not.

- Add a return code to lchan_meas_process_measurement()
- Ensure that the return code is checked in the unit-test

Change-Id: I9e00ce683e8c44528804f65181dbfed9e85e3aed
Related: OS#2975
---
M include/osmo-bts/measurement.h
M src/common/measurement.c
M tests/meas/meas_test.c
3 files changed, 8 insertions(+), 5 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/15/10815/1

diff --git a/include/osmo-bts/measurement.h b/include/osmo-bts/measurement.h
index a2367c8..4f04ffa 100644
--- a/include/osmo-bts/measurement.h
+++ b/include/osmo-bts/measurement.h
@@ -8,7 +8,7 @@
 
 int lchan_meas_check_compute(struct gsm_lchan *lchan, uint32_t fn);
 
-void lchan_meas_process_measurement(struct gsm_lchan *lchan, struct bts_ul_meas *ulm, uint32_t fn);
+int lchan_meas_process_measurement(struct gsm_lchan *lchan, struct bts_ul_meas *ulm, uint32_t fn);
 
 void lchan_meas_reset(struct gsm_lchan *lchan);
 
diff --git a/src/common/measurement.c b/src/common/measurement.c
index 2af8bda..de3a82f 100644
--- a/src/common/measurement.c
+++ b/src/common/measurement.c
@@ -732,13 +732,13 @@
  * l1sap.c every time a measurement indication is received. It collects the
  * measurement samples and automatically detects the end oft the measurement
  * interval. */
-void lchan_meas_process_measurement(struct gsm_lchan *lchan, struct bts_ul_meas *ulm, uint32_t fn)
+int lchan_meas_process_measurement(struct gsm_lchan *lchan, struct bts_ul_meas *ulm, uint32_t fn)
 {
 	uint32_t fn_missed_end;
 	bool missed_end;
 
 	lchan_new_ul_meas(lchan, ulm, fn);
-	lchan_meas_check_compute(lchan, fn);
+	return lchan_meas_check_compute(lchan, fn);
 }
 
 /* Reset all measurement related struct members to their initial values. This
diff --git a/tests/meas/meas_test.c b/tests/meas/meas_test.c
index 8f50479..d4f3fe6 100644
--- a/tests/meas/meas_test.c
+++ b/tests/meas/meas_test.c
@@ -315,6 +315,7 @@
 	unsigned int fn = 0;
 	unsigned int fn104;
 	struct bts_ul_meas ulm;
+	int rc;
 
 	printf("\n\n");
 	printf("===========================================================\n");
@@ -347,7 +348,8 @@
 		if (dropouts == false || i % 4) {
 			if (ulm.is_sub == 1)
 				printf("(now adding SUB measurement sample %u)\n", fn);
-			lchan_meas_process_measurement(lchan, &ulm, fn);
+			rc = lchan_meas_process_measurement(lchan, &ulm, fn);
+			OSMO_ASSERT(rc == 0);
 		} else if (ulm.is_sub == 1)
 			printf("(leaving out SUB measurement sample for frame number %u)\n", fn);
 		else
@@ -363,7 +365,8 @@
 		if (fn % 104 == 39 && no_sacch == false) {
 			printf("(now adding SUB measurement sample for SACCH block at frame number %u)\n", fn);
 			ulm.is_sub = 1;
-			lchan_meas_process_measurement(lchan, &ulm, fn - 1);
+			rc = lchan_meas_process_measurement(lchan, &ulm, fn - 1);
+			OSMO_ASSERT(rc);
 		} else if (fn % 104 == 39 && no_sacch == true)
 			printf("(leaving out SUB measurement sample for SACCH block at frame number %u)\n", fn);
 	}

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

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I9e00ce683e8c44528804f65181dbfed9e85e3aed
Gerrit-Change-Number: 10815
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180906/82f17634/attachment.htm>


More information about the gerrit-log mailing list