From 7551168cba20eabcc6bad6afd35cf19ca0d541c6 Mon Sep 17 00:00:00 2001 From: Martin Winter Date: Wed, 30 Aug 2017 17:06:35 -0700 Subject: [PATCH] lib: Use SIGTERM for killing daemons first and only SIGBUS (7) if the daemons fail to exit. - This allows daemons to free up memory and avoid false memory leak reports Signed-off-by: Martin Winter --- tests/topotests/lib/topotest.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/topotests/lib/topotest.py b/tests/topotests/lib/topotest.py index 2020e43874..4093c85e2d 100644 --- a/tests/topotests/lib/topotest.py +++ b/tests/topotests/lib/topotest.py @@ -522,6 +522,13 @@ class Router(Node): # Stop Running Quagga or FRR Daemons rundaemons = self.cmd('ls -1 /var/run/%s/*.pid' % self.routertype) if rundaemons is not None: + for d in StringIO.StringIO(rundaemons): + daemonpid = self.cmd('cat %s' % d.rstrip()).rstrip() + if (daemonpid.isdigit() and pid_exists(int(daemonpid))): + self.cmd('kill -TERM %s' % daemonpid) + self.waitOutput() + sleep(2) + # 2nd round of kill if daemons didn't exist for d in StringIO.StringIO(rundaemons): daemonpid = self.cmd('cat %s' % d.rstrip()).rstrip() if (daemonpid.isdigit() and pid_exists(int(daemonpid))): -- 2.39.5