]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
test: Initialize timer
authorLucian Petrut <lpetrut@cloudbasesolutions.com>
Tue, 5 May 2020 09:04:44 +0000 (09:04 +0000)
committerLucian Petrut <lpetrut@cloudbasesolutions.com>
Tue, 5 Jan 2021 12:56:11 +0000 (14:56 +0200)
Some timer tests don't actually initialize the timer, for which
reason the callbacks will never be executed, leading to an infinite
loop.

This change initializes the timer, stopping it after the tests
finish.

Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
src/test/TestTimers.cc

index 0d83c6fcdd039b0afd6fd16cb02bcb8e6a32baf3..eaa78f82b6ba82681675bb5b8310bed88a86ac47 100644 (file)
@@ -255,6 +255,7 @@ int main(int argc, const char **argv)
   int ret;
   ceph::mutex safe_timer_lock = ceph::make_mutex("safe_timer_lock");
   SafeTimer safe_timer(g_ceph_context, safe_timer_lock);
+  safe_timer.init();
 
   ret = basic_timer_test <SafeTimer>(safe_timer, &safe_timer_lock);
   if (ret)
@@ -273,6 +274,7 @@ int main(int argc, const char **argv)
     goto done;
 
 done:
+  safe_timer.shutdown();
   print_status(argv[0], ret);
   return ret;
 }