From 90fc10db0b9ef1f3e2292c2456578977d62e010a Mon Sep 17 00:00:00 2001 From: "d.kovalenko" Date: Wed, 16 Sep 2026 19:33:53 +0300 Subject: [PATCH 1/2] test_get_process_children__with_three_children is updated Check of cmdline is added. --- tests/test_os_ops_common.py | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/tests/test_os_ops_common.py b/tests/test_os_ops_common.py index 50a9ef2..7f37156 100644 --- a/tests/test_os_ops_common.py +++ b/tests/test_os_ops_common.py @@ -2911,9 +2911,9 @@ def test_get_process_children__with_three_children( script = ( "import time, os, subprocess; " "s = str(os.getpid()); " - "p1 = subprocess.Popen('exec sleep 60', shell=True, stdout=subprocess.PIPE); " - "p2 = subprocess.Popen('exec sleep 60', shell=True, stdout=subprocess.PIPE); " - "p3 = subprocess.Popen('exec sleep 60', shell=True, stdout=subprocess.PIPE); " + "p1 = subprocess.Popen(['sleep', '60'], shell=False, stdout=subprocess.PIPE); " + "p2 = subprocess.Popen(['sleep', '60'], shell=False, stdout=subprocess.PIPE); " + "p3 = subprocess.Popen(['sleep', '60'], shell=False, stdout=subprocess.PIPE); " "s += ':' + str(p1.pid) + ':' + str(p2.pid) + ':' + str(p3.pid); " "print(s, flush=True); " "time.sleep(60)" @@ -2954,6 +2954,29 @@ def test_get_process_children__with_three_children( assert actual_child_pids == expected_child_pids + for i in range(len(childs)): + child_cmdline = childs[i].cmdline() + + logging.info("child cmdline: {}".format( + child_cmdline, + )) + assert type(child_cmdline) is list + + if child_cmdline == ["sleep", "60"]: + pass + elif child_cmdline == ['/usr/bin/coreutils', '--coreutils-prog-shebang=sleep', '/usr/bin/sleep', '60']: + # Rocky Linux + pass + elif child_cmdline == ['/bin/sh', '-c', 'exec sleep 60']: + # Rocky Linux 10 (GitHub CI) + pass + else: + logging.error("Unknown child[{}] cmdline {}".format( + i, + child_cmdline, + )) + continue + p.terminate() p.wait() return From e8d93dc1d8f8e2948bf08531d15f3ff17846c38c Mon Sep 17 00:00:00 2001 From: "d.kovalenko" Date: Wed, 16 Sep 2026 19:35:08 +0300 Subject: [PATCH 2/2] test_get_process_children__xxx are updated Check of parent_pid is added. --- tests/test_os_ops_common.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/test_os_ops_common.py b/tests/test_os_ops_common.py index 7f37156..7f983c9 100644 --- a/tests/test_os_ops_common.py +++ b/tests/test_os_ops_common.py @@ -2860,6 +2860,8 @@ def test_get_process_children__with_child( logging.info(f"Parent PID from stdout: {parent_pid}") logging.info(f"Expected Child PID from stdout: {expected_child_pid}") + assert parent_pid == p1.pid + # A short pause to ensure registration in the OS # time.sleep(0.5) @@ -2943,6 +2945,8 @@ def test_get_process_children__with_three_children( # A short pause to ensure registration in the OS # time.sleep(0.5) + assert parent_pid == p.pid + childs = os_ops.get_process_children(parent_pid) assert childs is not None