[MERGED] osmo-pcu[master]: Fix tests after rate_ctr change

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/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Mon Dec 18 22:58:29 UTC 2017


Harald Welte has submitted this change and it was merged.

Change subject: Fix tests after rate_ctr change
......................................................................


Fix tests after rate_ctr change

Recent change lin libosmocore disallow registering rate_ctr with the
same name and indexing multiple times. To accommodate to this check if
rate counters arealready allocated (by static allocator of BTS singleton
for example) and register rate counter with different index.

This fixes the tests for now but eventually we'll remove the BTS singleton
which will allow us to remove this hack.

Change-Id: I7c552ce653b44ec3a31049641728926adc07361d
Related: OS#2757
---
M src/bts.cpp
1 file changed, 9 insertions(+), 1 deletion(-)

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



diff --git a/src/bts.cpp b/src/bts.cpp
index 341c9d4..e17399a 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -218,8 +218,16 @@
 		}
 	}
 
-	m_ratectrs = rate_ctr_group_alloc(tall_pcu_ctx, &bts_ctrg_desc, 0);
+	/* The static allocator might have already registered the counter group.
+	   If this happens and we still called explicitly (in tests/* for example)
+	   than just allocate the group with different index.
+	   This shall be removed once weget rid of BTS singleton */
+	if (rate_ctr_get_group_by_name_idx(bts_ctrg_desc.group_name_prefix, 0))
+		m_ratectrs = rate_ctr_group_alloc(tall_pcu_ctx, &bts_ctrg_desc, 1);
+	else
+		m_ratectrs = rate_ctr_group_alloc(tall_pcu_ctx, &bts_ctrg_desc, 0);
 	OSMO_ASSERT(m_ratectrs);
+
 	m_statg = osmo_stat_item_group_alloc(tall_pcu_ctx, &bts_statg_desc, 0);
 	OSMO_ASSERT(m_statg);
 }

-- 
To view, visit https://gerrit.osmocom.org/5487
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I7c552ce653b44ec3a31049641728926adc07361d
Gerrit-PatchSet: 2
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>



More information about the gerrit-log mailing list