]> git.ipfire.org Git - thirdparty/collectd.git/commitdiff
gpu_sysman: log which metric is not found in test
authorEero Tamminen <eero.t.tamminen@intel.com>
Fri, 16 Sep 2022 11:56:52 +0000 (14:56 +0300)
committerMatthias Runge <mrunge@matthias-runge.de>
Tue, 8 Nov 2022 12:24:36 +0000 (13:24 +0100)
Signed-off-by: Eero Tamminen <eero.t.tamminen@intel.com>
src/gpu_sysman_test.c

index c50c456d6d5cb0adc69b14bcfe0f3860b029c699..235a44c73a505508411acaa362c3aabdb772b2ee 100644 (file)
@@ -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;
 }