]> git.puffer.fish Git - matthieu/frr.git/commitdiff
topogen: implement memory leak test call
authorRafael Zalamena <rzalamena@gmail.com>
Thu, 22 Jun 2017 18:55:42 +0000 (15:55 -0300)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Wed, 28 Nov 2018 01:22:11 +0000 (20:22 -0500)
This is a shortcut for the memory leak test, it should be used in the
new tests in order to avoid boilerplate code.

tests/topotests/lib/topogen.py

index 08bff0fa167ee718d9e3a1598597a95da3d289d5..e87b6bd0a7c93521bd4644495921b9fe92845683 100644 (file)
@@ -411,6 +411,22 @@ class TopoRouter(TopoGear):
 
         return res
 
+    def report_memory_leaks(self, testname):
+        """
+        Runs the router memory leak check test. Has the following parameter:
+        testname: the test file name for identification
+
+        NOTE: to run this you must have the environment variable
+        TOPOTESTS_CHECK_MEMLEAK set to the appropriated path.
+        """
+        memleak_file = os.environ.get('TOPOTESTS_CHECK_MEMLEAK')
+        if memleak_file is None:
+            print "SKIPPED check on Memory leaks: Disabled (TOPOTESTS_CHECK_MEMLEAK undefined)"
+            return
+
+        self.tgen.net[self.name].stopRouter()
+        self.tgen.net[self.name].report_memory_leaks(memleak_file, testname)
+
 class TopoSwitch(TopoGear):
     """
     Switch abstraction. Has the following properties: