From 3ef14a241afc123560e9a50d17948b040481b299 Mon Sep 17 00:00:00 2001 From: Max Date: Fri, 15 Dec 2017 20:19:10 +0100 Subject: Do not allocate already existing counter group Check that no group with the given name and index already exist before allocating it. Add corresponding test case. Change-Id: I563764af1d28043e909234ebb048239125ce6ecd Related: OS#2757 --- tests/stats/stats_test.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'tests/stats') diff --git a/tests/stats/stats_test.c b/tests/stats/stats_test.c index b302b374..35faf9a6 100644 --- a/tests/stats/stats_test.c +++ b/tests/stats/stats_test.c @@ -311,7 +311,7 @@ static void test_reporting() { struct osmo_stats_reporter *srep1, *srep2, *srep; struct osmo_stat_item_group *statg1, *statg2; - struct rate_ctr_group *ctrg1, *ctrg2, *ctrg3; + struct rate_ctr_group *ctrg1, *ctrg2, *ctrg3, *ctrg_dup; void *stats_ctx = talloc_named_const(NULL, 1, "stats test context"); int rc; @@ -327,6 +327,11 @@ static void test_reporting() OSMO_ASSERT(ctrg1 != NULL); ctrg2 = rate_ctr_group_alloc(stats_ctx, &ctrg_desc, 2); OSMO_ASSERT(ctrg2 != NULL); + + ctrg_dup = rate_ctr_group_alloc(stats_ctx, &ctrg_desc, 2); + if (ctrg_dup != NULL && ctrg2 != NULL) + printf("FAIL: successfully allocated already existing counter group!\n"); + ctrg3 = rate_ctr_group_alloc(stats_ctx, &ctrg_desc_dot, 3); OSMO_ASSERT(ctrg3 != NULL); -- cgit v1.2.3