tests: enable vpp_echo to run in gdb 66/22866/3
authorDave Wallace <dwallacelf@gmail.com>
Mon, 21 Oct 2019 03:28:17 +0000 (03:28 +0000)
committerFlorin Coras <florin.coras@gmail.com>
Tue, 22 Oct 2019 16:31:03 +0000 (16:31 +0000)
- Enable vpp_echo to be run in gdb when
  running 'make test DEBUG=gdb-all'

Type: test

Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
Change-Id: I79a69b0573c01900535078d7493d52b417350815

src/plugins/hs_apps/sapi/vpp_echo.c
src/plugins/hs_apps/sapi/vpp_echo_common.h
src/plugins/quic/test/test_quic.py

index feb39f8..e460aa2 100644 (file)
@@ -394,6 +394,8 @@ echo_handle_data (echo_main_t * em, echo_session_t * s, u8 * rx_buf)
              clib_atomic_fetch_add (&em->stats.clean_count.s, 1);
            }
        }
+      ECHO_LOG (2, "%U: %U", echo_format_session, s,
+               echo_format_session_state, s->session_state);
       return;
     }
 
@@ -989,6 +991,8 @@ echo_process_opts (int argc, char **argv)
        em->tx_results_diff = 1;
       else if (unformat (a, "json"))
        em->output_json = 1;
+      else if (unformat (a, "wait-for-gdb"))
+       em->wait_for_gdb = 1;
       else if (unformat (a, "log=%d", &em->log_lvl))
        ;
       else if (unformat (a, "sclose=%U",
@@ -1029,6 +1033,16 @@ echo_process_opts (int argc, char **argv)
       em->bytes_to_receive == 0 ? ECHO_CLOSE_F_PASSIVE : ECHO_CLOSE_F_ACTIVE;
   if (em->send_stream_disconnects == ECHO_CLOSE_F_INVALID)
     em->send_stream_disconnects = default_f_active;
+
+  if (em->wait_for_gdb)
+    {
+      volatile u64 nop = 0;
+
+      clib_warning ("Waiting for gdb...");
+      while (em->wait_for_gdb)
+       nop++;
+      clib_warning ("Resuming execution (%llu)!", nop);
+    }
 }
 
 void
index f147251..411e9f5 100644 (file)
@@ -304,6 +304,7 @@ typedef struct
   data_source_t data_source;   /* Use no/dummy/mirrored data */
   u8 send_stream_disconnects;  /* actively send disconnect */
   u8 output_json;              /* Output stats as JSON */
+  volatile u8 wait_for_gdb;    /* Wait for gdb to attach */
   u8 log_lvl;                  /* Verbosity of the logging */
   int max_test_msg;            /* Limit the number of incorrect data messages */
   u32 evt_q_size;              /* Size of the vpp MQ (app<->vpp events) */
index 2a00536..7b8e81c 100644 (file)
@@ -14,9 +14,13 @@ class QUICAppWorker(Worker):
     """ QUIC Test Application Worker """
     process = None
 
-    def __init__(self, build_dir, appname, args, logger, env={}):
+    def __init__(self, build_dir, appname, args, logger, role, testcase,
+                 env={}):
         app = "%s/vpp/bin/%s" % (build_dir, appname)
         self.args = [app] + args
+        self.role = role
+        self.wait_for_gdb = 'wait-for-gdb'
+        self.testcase = testcase
         super(QUICAppWorker, self).__init__(self.args, logger, env)
 
     def run(self):
@@ -154,6 +158,7 @@ class QUICEchoIntMStreamTestCase(QUICEchoIntTestCase):
 class QUICEchoExtTestCase(QUICTestCase):
     extra_vpp_punt_config = ["session", "{", "evt_qs_memfd_seg", "}"]
     quic_setup = "default"
+    app = "vpp_echo"
 
     def setUp(self):
         super(QUICEchoExtTestCase, self).setUp()
@@ -170,14 +175,21 @@ class QUICEchoExtTestCase(QUICTestCase):
             ["server", "appns", "server", "quic-setup", self.quic_setup]
         self.client_echo_test_args = common_args + \
             ["client", "appns", "client", "quic-setup", self.quic_setup]
+        error = self.vapi.cli(
+            "quic set fifo-size 4Mb")
+        if error:
+            self.logger.critical(error)
+            self.assertNotIn("failed", error)
 
     def server(self, *args):
         _args = self.server_echo_test_args + list(args)
         self.worker_server = QUICAppWorker(
             self.build_dir,
-            "vpp_echo",
+            self.app,
             _args,
-            self.logger)
+            self.logger,
+            'server',
+            self)
         self.worker_server.start()
         self.sleep(self.pre_test_sleep)
 
@@ -186,12 +198,15 @@ class QUICEchoExtTestCase(QUICTestCase):
         # self.client_echo_test_args += "use-svm-api"
         self.worker_client = QUICAppWorker(
             self.build_dir,
-            "vpp_echo",
+            self.app,
             _args,
-            self.logger)
+            self.logger,
+            'client',
+            self)
         self.worker_client.start()
-        self.worker_client.join(self.timeout)
-        self.worker_server.join(self.timeout)
+        timeout = None if self.debug_all else self.timeout
+        self.worker_client.join(timeout)
+        self.worker_server.join(timeout)
         self.sleep(self.post_test_sleep)
 
     def validate_ext_test_results(self):