aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilipp Maier <pmaier@sysmocom.de>2018-09-06 17:21:02 +0200
committerHarald Welte <laforge@gnumonks.org>2018-09-13 14:27:12 +0000
commit27a86005f34e5ccc2f31aadefec916ffb4476d17 (patch)
tree42f0b91cc49508fb8d3e6b9ac35e4d399a4fc124
parentc78759055a223b9f48bdfd5523a9825e16cf0658 (diff)
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
-rw-r--r--include/osmo-bts/measurement.h2
-rw-r--r--src/common/measurement.c4
-rw-r--r--tests/meas/meas_test.c7
3 files changed, 8 insertions, 5 deletions
diff --git a/include/osmo-bts/measurement.h b/include/osmo-bts/measurement.h
index a2367c83..4f04ffa2 100644
--- a/include/osmo-bts/measurement.h
+++ b/include/osmo-bts/measurement.h
@@ -8,7 +8,7 @@ int lchan_new_ul_meas(struct gsm_lchan *lchan, struct bts_ul_meas *ulm, uint32_t
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 8d1babd3..33b1c115 100644
--- a/src/common/measurement.c
+++ b/src/common/measurement.c
@@ -706,10 +706,10 @@ int lchan_meas_check_compute(struct gsm_lchan *lchan, uint32_t fn)
* l1sap.c every time a measurement indication is received. It collects the
* measurement samples and automatically detects the end of 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)
{
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 8f504795..d4f3fe68 100644
--- a/tests/meas/meas_test.c
+++ b/tests/meas/meas_test.c
@@ -315,6 +315,7 @@ void test_lchan_meas_process_measurement(bool no_sacch, bool dropouts)
unsigned int fn = 0;
unsigned int fn104;
struct bts_ul_meas ulm;
+ int rc;
printf("\n\n");
printf("===========================================================\n");
@@ -347,7 +348,8 @@ void test_lchan_meas_process_measurement(bool no_sacch, bool dropouts)
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 @@ void test_lchan_meas_process_measurement(bool no_sacch, bool dropouts)
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);
}