X-Git-Url: https://git.liburcu.org/?a=blobdiff_plain;f=tests%2Futils%2Flttngtest%2Fenvironment.py;h=74dcfb8d26cebf89c66fbd187d77e4eef1a0dcc6;hb=09a872ef0b4e1432329aa42fecc61f50e9baa367;hp=e51f5eb66da533cc36c6dde3ec2d8e235c7636fd;hpb=45ce5eede99b4bd47067cd235629291540182fb8;p=lttng-tools.git diff --git a/tests/utils/lttngtest/environment.py b/tests/utils/lttngtest/environment.py index e51f5eb66..74dcfb8d2 100644 --- a/tests/utils/lttngtest/environment.py +++ b/tests/utils/lttngtest/environment.py @@ -93,6 +93,7 @@ class _WaitTraceTestApplication: wait_before_exit=False, # type: bool wait_before_exit_file_path=None, # type: Optional[pathlib.Path] ): + self._process = None self._environment = environment # type: Environment self._iteration_count = event_count # File that the application will wait to see before tracing its events. @@ -223,7 +224,7 @@ class _WaitTraceTestApplication: return str(path) def __del__(self): - if not self._has_returned: + if self._process is not None and not self._has_returned: # This is potentially racy if the pid has been recycled. However, # we can't use pidfd_open since it is only available in python >= 3.9. self._process.kill() @@ -315,6 +316,7 @@ class _TraceTestApplication: def __init__(self, binary_path, environment): # type: (pathlib.Path, Environment) + self._process = None self._environment = environment # type: Environment self._has_returned = False @@ -341,7 +343,7 @@ class _TraceTestApplication: self._has_returned = True def __del__(self): - if not self._has_returned: + if self._process is not None and not self._has_returned: # This is potentially racy if the pid has been recycled. However, # we can't use pidfd_open since it is only available in python >= 3.9. self._process.kill() @@ -610,7 +612,7 @@ class _Environment(logger._Logger): wait_before_exit_file_path, ) - def launch_trace_test_constructor_application(self): + def launch_test_application(self, subpath): # type () -> TraceTestApplication """ Launch an application that will trace from within constructors. @@ -620,8 +622,7 @@ class _Environment(logger._Logger): / "tests" / "utils" / "testapp" - / "gen-ust-events-constructor" - / "gen-ust-events-constructor", + / subpath, self, )