tests: Add mechanism to start relayd in python testing environment
[lttng-tools.git] / tests / utils / lttngtest / lttng.py
index 76c60b5b0f08b4f563474e514e3e76389d68f169..3598cc940ba5bf3c686d314aa5d80d9fbd5c4273 100644 (file)
@@ -499,9 +499,11 @@ class _Session(lttngctl.Session):
                 session_name=self.name,
                 domain_name=domain_option_name,
                 channel_name=channel_name,
-                buffer_sharing_policy="--buffers-uid"
-                if buffer_sharing_policy == lttngctl.BufferSharingPolicy.PerUID
-                else "--buffers-pid",
+                buffer_sharing_policy=(
+                    "--buffers-uid"
+                    if buffer_sharing_policy == lttngctl.BufferSharingPolicy.PerUID
+                    else "--buffers-pid"
+                ),
             )
         )
         return _Channel(self._client, channel_name, domain, self)
@@ -523,6 +525,10 @@ class _Session(lttngctl.Session):
         # type: () -> None
         self._client._run_cmd("stop '{session_name}'".format(session_name=self.name))
 
+    def clear(self):
+        # type: () -> None
+        self._client._run_cmd("clear '{session_name}'".format(session_name=self.name))
+
     def destroy(self):
         # type: () -> None
         self._client._run_cmd("destroy '{session_name}'".format(session_name=self.name))
@@ -666,20 +672,24 @@ class LTTngClient(logger._Logger, lttngctl.Controller):
         else:
             return out.decode("utf-8")
 
-    def create_session(self, name=None, output=None):
-        # type: (Optional[str], Optional[lttngctl.SessionOutputLocation]) -> lttngctl.Session
+    def create_session(self, name=None, output=None, live=False):
+        # type: (Optional[str], Optional[lttngctl.SessionOutputLocation], bool) -> lttngctl.Session
         name = name if name else lttngctl.Session._generate_name()
 
         if isinstance(output, lttngctl.LocalSessionOutputLocation):
             output_option = "--output '{output_path}'".format(output_path=output.path)
+        elif isinstance(output, lttngctl.NetworkSessionOutputLocation):
+            output_option = "--set-url '{}'".format(output.url)
         elif output is None:
             output_option = "--no-output"
         else:
             raise TypeError("LTTngClient only supports local or no output")
 
         self._run_cmd(
-            "create '{session_name}' {output_option}".format(
-                session_name=name, output_option=output_option
+            "create '{session_name}' {output_option} {live_option}".format(
+                session_name=name,
+                output_option=output_option,
+                live_option="--live" if live else "",
             )
         )
         return _Session(self, name, output)
This page took 0.023675 seconds and 4 git commands to generate.