X-Git-Url: https://git.liburcu.org/?a=blobdiff_plain;f=tests%2Futils%2Flttngtest%2Flttng.py;h=3598cc940ba5bf3c686d314aa5d80d9fbd5c4273;hb=45ce5eede99b4bd47067cd235629291540182fb8;hp=3f1c48547d9e51d362171bf979c7ae1e840a76e3;hpb=6a871bbe6177568f748d1a9f580fa981bc75171c;p=lttng-tools.git diff --git a/tests/utils/lttngtest/lttng.py b/tests/utils/lttngtest/lttng.py index 3f1c48547..3598cc940 100644 --- a/tests/utils/lttngtest/lttng.py +++ b/tests/utils/lttngtest/lttng.py @@ -525,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)) @@ -668,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)