summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaphael Isemann <teemperor@gmail.com>2020-08-25 08:25:58 +0200
committerJonas Devlieghere <jonas@devlieghere.com>2020-12-15 18:30:41 -0800
commit25f6bc3930b185dfb7600f95f87460de133fe155 (patch)
tree6d79d87511cc7e311630eab82fce47624da8ec7c
parent74570a7b19b8fd4a6fa718a5fb4e808ab10ca1d8 (diff)
downloadllvm-25f6bc3930b185dfb7600f95f87460de133fe155.tar.gz
[lldb] Don't depend on psutil in TestCompletion.py
psutil isn't reall a dependency of the test suite so this shouldn't be unconditionally be imported here. Instead just check for the process name by looking for the "a.out" string to get the bots green again. (cherry picked from commit 2501e911a5a174fc1a07a2a1ac687a2bf0f05ef3)
-rw-r--r--lldb/test/API/functionalities/completion/TestCompletion.py18
1 files changed, 14 insertions, 4 deletions
diff --git a/lldb/test/API/functionalities/completion/TestCompletion.py b/lldb/test/API/functionalities/completion/TestCompletion.py
index e2b003219a00..b80594b7568b 100644
--- a/lldb/test/API/functionalities/completion/TestCompletion.py
+++ b/lldb/test/API/functionalities/completion/TestCompletion.py
@@ -6,7 +6,6 @@ Test the lldb command line completion mechanism.
import os
from multiprocessing import Process
-import psutil
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
@@ -119,6 +118,18 @@ class CommandLineCompletionTestCase(TestBase):
self.complete_from_to('process ' + subcommand + ' mac',
'process ' + subcommand + ' mach-o-core')
+ def completions_contain_str(self, input, needle):
+ interp = self.dbg.GetCommandInterpreter()
+ match_strings = lldb.SBStringList()
+ num_matches = interp.HandleCompletion(input, len(input), 0, -1, match_strings)
+ found_needle = False
+ for match in match_strings:
+ if needle in match:
+ found_needle = True
+ break
+ self.assertTrue(found_needle, "Returned completions: " + "\n".join(match_strings))
+
+
@skipIfRemote
def test_common_completion_process_pid_and_name(self):
# The LLDB process itself and the process already attached to are both
@@ -136,9 +147,8 @@ class CommandLineCompletionTestCase(TestBase):
self.complete_from_to('platform process attach -p ', [str(pid)])
self.complete_from_to('platform process info ', [str(pid)])
- pname = psutil.Process(pid).name() # FIXME: psutil doesn't work for remote
- self.complete_from_to('process attach -n ', [str(pname)])
- self.complete_from_to('platform process attach -n ', [str(pname)])
+ self.completions_contain_str('process attach -n ', "a.out")
+ self.completions_contain_str('platform process attach -n ', "a.out")
def test_process_signal(self):
# The tab completion for "process signal" won't work without a running process.