make test: save + dump VPP api trace log; VPP-640 99/5399/5
authorDave Wallace <dwallacelf@gmail.com>
Thu, 16 Feb 2017 16:25:26 +0000 (11:25 -0500)
committerDamjan Marion <dmarion.lists@gmail.com>
Sun, 19 Feb 2017 13:51:11 +0000 (13:51 +0000)
Change-Id: I20aacc927f2b04f42b0a7220c4283560b4d2a359
Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
test/framework.py

index beed180..90e0574 100644 (file)
@@ -142,6 +142,7 @@ class VppTestCase(unittest.TestCase):
             debug_cli = "cli-listen localhost:5002"
         cls.vpp_cmdline = [cls.vpp_bin,
                            "unix", "{", "nodaemon", debug_cli, "}",
+                           "api-trace", "{", "on", "}",
                            "api-segment", "{", "prefix", cls.shm_prefix, "}"]
         if cls.plugin_path is not None:
             cls.vpp_cmdline.extend(["plugin_path", cls.plugin_path])
@@ -336,6 +337,16 @@ class VppTestCase(unittest.TestCase):
             self.logger.info(self.vapi.ppcli("show error"))
             self.logger.info(self.vapi.ppcli("show run"))
             self.registry.remove_vpp_config(self.logger)
+            # Save/Dump VPP api trace log
+            api_trace = "vpp_api_trace.%s.log" % self._testMethodName
+            tmp_api_trace = "/tmp/%s" % api_trace
+            vpp_api_trace_log = "%s/%s" % (self.tempdir, api_trace)
+            self.logger.info(self.vapi.ppcli("api trace save %s" % api_trace))
+            self.logger.info("Moving %s to %s\n" % (tmp_api_trace,
+                                                    vpp_api_trace_log))
+            os.rename(tmp_api_trace, vpp_api_trace_log)
+            self.logger.info(self.vapi.ppcli("api trace dump %s" %
+                                             vpp_api_trace_log))
 
     def setUp(self):
         """ Clear trace before running each test"""