diff options
author | Max <msuraev@sysmocom.de> | 2017-12-15 20:19:10 +0100 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2017-12-17 20:12:34 +0000 |
commit | 3ef14a241afc123560e9a50d17948b040481b299 (patch) | |
tree | f3e74b415dd9a8f232f6bce0e08e3364c59fd3db /tests | |
parent | 62e40855c2b1b50627dba5b187be8869e2cb2054 (diff) |
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
Diffstat (limited to 'tests')
-rw-r--r-- | tests/stats/stats_test.c | 7 |
1 files changed, 6 insertions, 1 deletions
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); |