6
6
7
7
import os
8
8
from multiprocessing import Process
9
- import psutil
10
9
import lldb
11
10
from lldbsuite .test .decorators import *
12
11
from lldbsuite .test .lldbtest import *
@@ -119,6 +118,18 @@ def test_process_plugin_completion(self):
119
118
self .complete_from_to ('process ' + subcommand + ' mac' ,
120
119
'process ' + subcommand + ' mach-o-core' )
121
120
121
+ def completions_contain_str (self , input , needle ):
122
+ interp = self .dbg .GetCommandInterpreter ()
123
+ match_strings = lldb .SBStringList ()
124
+ num_matches = interp .HandleCompletion (input , len (input ), 0 , - 1 , match_strings )
125
+ found_needle = False
126
+ for match in match_strings :
127
+ if needle in match :
128
+ found_needle = True
129
+ break
130
+ self .assertTrue (found_needle , "Returned completions: " + "\n " .join (match_strings ))
131
+
132
+
122
133
@skipIfRemote
123
134
def test_common_completion_process_pid_and_name (self ):
124
135
# The LLDB process itself and the process already attached to are both
@@ -136,9 +147,8 @@ def test_common_completion_process_pid_and_name(self):
136
147
self .complete_from_to ('platform process attach -p ' , [str (pid )])
137
148
self .complete_from_to ('platform process info ' , [str (pid )])
138
149
139
- pname = psutil .Process (pid ).name () # FIXME: psutil doesn't work for remote
140
- self .complete_from_to ('process attach -n ' , [str (pname )])
141
- self .complete_from_to ('platform process attach -n ' , [str (pname )])
150
+ self .completions_contain_str ('process attach -n ' , "a.out" )
151
+ self .completions_contain_str ('platform process attach -n ' , "a.out" )
142
152
143
153
def test_process_signal (self ):
144
154
# The tab completion for "process signal" won't work without a running process.
0 commit comments