summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2017-10-03 17:46:14 +0800
committerHarald Welte <laforge@gnumonks.org>2017-10-24 16:00:45 +0000
commitae510dc4a743e981b40fc5e1fdb4c109f2425e27 (patch)
tree76af91250b31b14196c965fe1fc8bc130931728d /tests
parent8c4f5457aa185bc9d74b6962aaafdd263ea6af56 (diff)
rate_ctr: Enforce counter (and ctr_group) names are valid identifiers
As rate counters are automatically exposed on the CTRL interface, we need to make sure they don't contain special characters such as '.' which are not permitted/supported by CTRL. In order to be able to run old versions of osmocom programs with libosmocore versions after this commit, we introduce some special name mangling: Any '.' in the names are replaced with ':' during counter group registration, if valid identifiers can be obtained this way. Change-Id: Ifc6ac824f5dae9a848bb4a5d067c64a69eb40b56
Diffstat (limited to 'tests')
-rw-r--r--tests/gb/gprs_ns_test.c2
-rw-r--r--tests/stats/stats_test.ok84
2 files changed, 43 insertions, 43 deletions
diff --git a/tests/gb/gprs_ns_test.c b/tests/gb/gprs_ns_test.c
index 0bbf9432..fac3c36f 100644
--- a/tests/gb/gprs_ns_test.c
+++ b/tests/gb/gprs_ns_test.c
@@ -261,7 +261,7 @@ static void dump_rate_ctr_group(FILE *stream, const char *prefix,
for (i = 0; i < ctrg->desc->num_ctr; i++) {
struct rate_ctr *ctr = &ctrg->ctr[i];
- if (ctr->current && !strchr(ctrg->desc->ctr_desc[i].name, '.'))
+ if (ctr->current && !strchr(ctrg->desc->ctr_desc[i].name, ':'))
fprintf(stream, " %s%s: %llu%s",
prefix, ctrg->desc->ctr_desc[i].description,
(long long)ctr->current,
diff --git a/tests/stats/stats_test.ok b/tests/stats/stats_test.ok
index a0c001b9..cb9daf22 100644
--- a/tests/stats/stats_test.ok
+++ b/tests/stats/stats_test.ok
@@ -2,14 +2,14 @@ Start test: test_reporting
test1: open
test2: open
report (initial):
- test2: counter p= g=ctr-test.one i=2 n=ctr.a v=0 d=0
- test1: counter p= g=ctr-test.one i=2 n=ctr.a v=0 d=0
- test2: counter p= g=ctr-test.one i=2 n=ctr.b v=0 d=0
- test1: counter p= g=ctr-test.one i=2 n=ctr.b v=0 d=0
- test2: counter p= g=ctr-test.one i=1 n=ctr.a v=0 d=0
- test1: counter p= g=ctr-test.one i=1 n=ctr.a v=0 d=0
- test2: counter p= g=ctr-test.one i=1 n=ctr.b v=0 d=0
- test1: counter p= g=ctr-test.one i=1 n=ctr.b v=0 d=0
+ test2: counter p= g=ctr-test:one i=2 n=ctr:a v=0 d=0
+ test1: counter p= g=ctr-test:one i=2 n=ctr:a v=0 d=0
+ test2: counter p= g=ctr-test:one i=2 n=ctr:b v=0 d=0
+ test1: counter p= g=ctr-test:one i=2 n=ctr:b v=0 d=0
+ test2: counter p= g=ctr-test:one i=1 n=ctr:a v=0 d=0
+ test1: counter p= g=ctr-test:one i=1 n=ctr:a v=0 d=0
+ test2: counter p= g=ctr-test:one i=1 n=ctr:b v=0 d=0
+ test1: counter p= g=ctr-test:one i=1 n=ctr:b v=0 d=0
test2: item p= g=test.one i=2 n=item.a v=-1 u=ma
test1: item p= g=test.one i=2 n=item.a v=-1 u=ma
test2: item p= g=test.one i=2 n=item.b v=-1 u=kb
@@ -19,19 +19,19 @@ report (initial):
test2: item p= g=test.one i=1 n=item.b v=-1 u=kb
test1: item p= g=test.one i=1 n=item.b v=-1 u=kb
report (srep1 global):
- test2: counter p= g=ctr-test.one i=2 n=ctr.a v=0 d=0
- test2: counter p= g=ctr-test.one i=2 n=ctr.b v=0 d=0
- test2: counter p= g=ctr-test.one i=1 n=ctr.a v=0 d=0
- test2: counter p= g=ctr-test.one i=1 n=ctr.b v=0 d=0
+ test2: counter p= g=ctr-test:one i=2 n=ctr:a v=0 d=0
+ test2: counter p= g=ctr-test:one i=2 n=ctr:b v=0 d=0
+ test2: counter p= g=ctr-test:one i=1 n=ctr:a v=0 d=0
+ test2: counter p= g=ctr-test:one i=1 n=ctr:b v=0 d=0
test2: item p= g=test.one i=2 n=item.a v=-1 u=ma
test2: item p= g=test.one i=2 n=item.b v=-1 u=kb
test2: item p= g=test.one i=1 n=item.a v=-1 u=ma
test2: item p= g=test.one i=1 n=item.b v=-1 u=kb
report (srep1 peer):
- test2: counter p= g=ctr-test.one i=2 n=ctr.a v=0 d=0
- test2: counter p= g=ctr-test.one i=2 n=ctr.b v=0 d=0
- test2: counter p= g=ctr-test.one i=1 n=ctr.a v=0 d=0
- test2: counter p= g=ctr-test.one i=1 n=ctr.b v=0 d=0
+ test2: counter p= g=ctr-test:one i=2 n=ctr:a v=0 d=0
+ test2: counter p= g=ctr-test:one i=2 n=ctr:b v=0 d=0
+ test2: counter p= g=ctr-test:one i=1 n=ctr:a v=0 d=0
+ test2: counter p= g=ctr-test:one i=1 n=ctr:b v=0 d=0
test2: item p= g=test.one i=2 n=item.a v=-1 u=ma
test1: item p= g=test.one i=2 n=item.a v=-1 u=ma
test2: item p= g=test.one i=2 n=item.b v=-1 u=kb
@@ -41,14 +41,14 @@ report (srep1 peer):
test2: item p= g=test.one i=1 n=item.b v=-1 u=kb
test1: item p= g=test.one i=1 n=item.b v=-1 u=kb
report (srep1 subscriber):
- test2: counter p= g=ctr-test.one i=2 n=ctr.a v=0 d=0
- test1: counter p= g=ctr-test.one i=2 n=ctr.a v=0 d=0
- test2: counter p= g=ctr-test.one i=2 n=ctr.b v=0 d=0
- test1: counter p= g=ctr-test.one i=2 n=ctr.b v=0 d=0
- test2: counter p= g=ctr-test.one i=1 n=ctr.a v=0 d=0
- test1: counter p= g=ctr-test.one i=1 n=ctr.a v=0 d=0
- test2: counter p= g=ctr-test.one i=1 n=ctr.b v=0 d=0
- test1: counter p= g=ctr-test.one i=1 n=ctr.b v=0 d=0
+ test2: counter p= g=ctr-test:one i=2 n=ctr:a v=0 d=0
+ test1: counter p= g=ctr-test:one i=2 n=ctr:a v=0 d=0
+ test2: counter p= g=ctr-test:one i=2 n=ctr:b v=0 d=0
+ test1: counter p= g=ctr-test:one i=2 n=ctr:b v=0 d=0
+ test2: counter p= g=ctr-test:one i=1 n=ctr:a v=0 d=0
+ test1: counter p= g=ctr-test:one i=1 n=ctr:a v=0 d=0
+ test2: counter p= g=ctr-test:one i=1 n=ctr:b v=0 d=0
+ test1: counter p= g=ctr-test:one i=1 n=ctr:b v=0 d=0
test2: item p= g=test.one i=2 n=item.a v=-1 u=ma
test1: item p= g=test.one i=2 n=item.a v=-1 u=ma
test2: item p= g=test.one i=2 n=item.b v=-1 u=kb
@@ -59,49 +59,49 @@ report (srep1 subscriber):
test1: item p= g=test.one i=1 n=item.b v=-1 u=kb
report (srep2 disabled):
test2: close
- test1: counter p= g=ctr-test.one i=2 n=ctr.a v=0 d=0
- test1: counter p= g=ctr-test.one i=2 n=ctr.b v=0 d=0
- test1: counter p= g=ctr-test.one i=1 n=ctr.a v=0 d=0
- test1: counter p= g=ctr-test.one i=1 n=ctr.b v=0 d=0
+ test1: counter p= g=ctr-test:one i=2 n=ctr:a v=0 d=0
+ test1: counter p= g=ctr-test:one i=2 n=ctr:b v=0 d=0
+ test1: counter p= g=ctr-test:one i=1 n=ctr:a v=0 d=0
+ test1: counter p= g=ctr-test:one i=1 n=ctr:b v=0 d=0
test1: item p= g=test.one i=2 n=item.a v=-1 u=ma
test1: item p= g=test.one i=2 n=item.b v=-1 u=kb
test1: item p= g=test.one i=1 n=item.a v=-1 u=ma
test1: item p= g=test.one i=1 n=item.b v=-1 u=kb
report (srep2 enabled, no flush forced):
test2: open
- test2: counter p= g=ctr-test.one i=2 n=ctr.a v=0 d=0
- test2: counter p= g=ctr-test.one i=2 n=ctr.b v=0 d=0
- test2: counter p= g=ctr-test.one i=1 n=ctr.a v=0 d=0
- test2: counter p= g=ctr-test.one i=1 n=ctr.b v=0 d=0
+ test2: counter p= g=ctr-test:one i=2 n=ctr:a v=0 d=0
+ test2: counter p= g=ctr-test:one i=2 n=ctr:b v=0 d=0
+ test2: counter p= g=ctr-test:one i=1 n=ctr:a v=0 d=0
+ test2: counter p= g=ctr-test:one i=1 n=ctr:b v=0 d=0
test2: item p= g=test.one i=2 n=item.a v=-1 u=ma
test2: item p= g=test.one i=2 n=item.b v=-1 u=kb
test2: item p= g=test.one i=1 n=item.a v=-1 u=ma
test2: item p= g=test.one i=1 n=item.b v=-1 u=kb
report (should be empty):
report (group 1, counter 1 update):
- test2: counter p= g=ctr-test.one i=1 n=ctr.a v=1 d=1
- test1: counter p= g=ctr-test.one i=1 n=ctr.a v=1 d=1
+ test2: counter p= g=ctr-test:one i=1 n=ctr:a v=1 d=1
+ test1: counter p= g=ctr-test:one i=1 n=ctr:a v=1 d=1
report (group 1, item 1 update):
test2: item p= g=test.one i=1 n=item.a v=10 u=ma
test1: item p= g=test.one i=1 n=item.a v=10 u=ma
report (remove statg1, ctrg1):
- test2: counter p= g=ctr-test.one i=2 n=ctr.a v=0 d=0
- test1: counter p= g=ctr-test.one i=2 n=ctr.a v=0 d=0
- test2: counter p= g=ctr-test.one i=2 n=ctr.b v=0 d=0
- test1: counter p= g=ctr-test.one i=2 n=ctr.b v=0 d=0
+ test2: counter p= g=ctr-test:one i=2 n=ctr:a v=0 d=0
+ test1: counter p= g=ctr-test:one i=2 n=ctr:a v=0 d=0
+ test2: counter p= g=ctr-test:one i=2 n=ctr:b v=0 d=0
+ test1: counter p= g=ctr-test:one i=2 n=ctr:b v=0 d=0
test2: item p= g=test.one i=2 n=item.a v=-1 u=ma
test1: item p= g=test.one i=2 n=item.a v=-1 u=ma
test2: item p= g=test.one i=2 n=item.b v=-1 u=kb
test1: item p= g=test.one i=2 n=item.b v=-1 u=kb
report (remove srep1):
test1: close
- test2: counter p= g=ctr-test.one i=2 n=ctr.a v=0 d=0
- test2: counter p= g=ctr-test.one i=2 n=ctr.b v=0 d=0
+ test2: counter p= g=ctr-test:one i=2 n=ctr:a v=0 d=0
+ test2: counter p= g=ctr-test:one i=2 n=ctr:b v=0 d=0
test2: item p= g=test.one i=2 n=item.a v=-1 u=ma
test2: item p= g=test.one i=2 n=item.b v=-1 u=kb
report (remove statg2):
- test2: counter p= g=ctr-test.one i=2 n=ctr.a v=0 d=0
- test2: counter p= g=ctr-test.one i=2 n=ctr.b v=0 d=0
+ test2: counter p= g=ctr-test:one i=2 n=ctr:a v=0 d=0
+ test2: counter p= g=ctr-test:one i=2 n=ctr:b v=0 d=0
report (remove srep2):
test2: close
report (remove ctrg2, should be empty):