Skip to content

Commit c699eff

Browse files
committed
[lldb-dap] Fix test_exit_status_message_sigterm test.
Summary: 'test_exit_status_message_sigterm' is failing due to 'psutil' dependency introduced in PR #89405. This fix removes 'deque' dependency and checks if 'psutil' can be imported before running the test. If 'psutil' cannot be imported, it emits a warning and skips the test. Test Plan: ./bin/llvm-lit -sv /path-to-llvm-project/lldb/test/API/tools/lldb-dap/console/TestDAP_console.py --filter=tools/lldb-dap/console/TestDAP_console.py Reviewers: @jeffreytan81,@clayborg,@kusmour, @JDevlieghere,@walter-erquinigo Subscribers: Tasks: lldb-dap Tags:
1 parent cd4287b commit c699eff

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

lldb/test/API/tools/lldb-dap/console/TestDAP_console.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,15 @@
44

55
import dap_server
66
import lldbdap_testcase
7-
import psutil
8-
from collections import deque
97
from lldbsuite.test import lldbutil
108
from lldbsuite.test.decorators import *
119
from lldbsuite.test.lldbtest import *
1210

1311

14-
def get_subprocess(process_name):
15-
queue = deque([psutil.Process(os.getpid())])
12+
def get_subprocess(root_process, process_name):
13+
queue = [root_process]
1614
while queue:
17-
process = queue.popleft()
15+
process = queue.pop()
1816
if process.name() == process_name:
1917
return process
2018
queue.extend(process.children())
@@ -131,7 +129,17 @@ def test_exit_status_message_sigterm(self):
131129
process_name = (
132130
"debugserver" if platform.system() in ["Darwin"] else "lldb-server"
133131
)
134-
process = get_subprocess(process_name)
132+
133+
try:
134+
import psutil
135+
except ImportError:
136+
print(
137+
"psutil not installed, please install using 'pip install psutil'. "
138+
"Skipping test_exit_status_message_sigterm test.",
139+
file=sys.stderr,
140+
)
141+
return
142+
process = get_subprocess(psutil.Process(os.getpid()), process_name)
135143
process.terminate()
136144
process.wait()
137145

0 commit comments

Comments
 (0)