From: Eero Tamminen Date: Fri, 16 Sep 2022 11:56:52 +0000 (+0300) Subject: gpu_sysman: log which metric is not found in test X-Git-Tag: 6.0.0-rc0~103 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=91d94b6a10fd6239aa29efa84996ea51d8aa3e5e;p=thirdparty%2Fcollectd.git gpu_sysman: log which metric is not found in test Signed-off-by: Eero Tamminen --- diff --git a/src/gpu_sysman_test.c b/src/gpu_sysman_test.c index c50c456d6..235a44c73 100644 --- a/src/gpu_sysman_test.c +++ b/src/gpu_sysman_test.c @@ -725,8 +725,8 @@ static double get_value(metric_type_t type, value_t value) { int plugin_dispatch_metric_family(metric_family_t const *fam) { assert(fam && fam->name && fam->metric.num && fam->metric.ptr); - char name[128]; bool found = false; + char name[128] = "\0"; metric_t *metric = fam->metric.ptr; for (size_t m = 0; m < fam->metric.num; m++) { @@ -749,7 +749,11 @@ int plugin_dispatch_metric_family(metric_family_t const *fam) { } } } - assert(found); + if (!found) { + fprintf(stderr, "ERROR: found no '%s' metrics\n(e.g '%s')\n", fam->name, + name); + exit(1); + } return 0; }