Proper tender fuzzing shutdown
Use trace-pc-guard in tests
Fixed tests
@@ -540,6 +540,14 @@ def _kill_process_tree(process_pid, target_pid_signal=None):
_nix_kill_process_tree(process_pid, target_pid_signal)
+def _nix_get_proc_children(pid):
+ try:
+ cmd = ["pgrep", "-P", str(pid)]
+ return [int(p) for p in subprocess.check_output(cmd).split()]
+ except Exception:
+ return []
+
+
def _nix_kill_process_tree(pid, target_pid_signal=None):
"""
Kills the process tree.
@@ -556,12 +564,7 @@ def _nix_kill_process_tree(pid, target_pid_signal=None):
try_to_send_signal(pid, signal.SIGSTOP) # Stop the process to prevent it from starting any child processes.
# Get the child process PID list.
- try:
- pgrep_command = ["pgrep", "-P", str(pid)]
- child_pids = subprocess.check_output(pgrep_command).split()
- except Exception:
- yatest_logger.debug("Process with pid {pid} does not have child processes".format(pid=pid))
- else:
+ child_pids = _nix_get_proc_children(pid)
# Stop the child processes.
for child_pid in child_pids:
try:
