Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lldb / test / API / tools / lldb-server / TestGdbRemoteCompletion.py
blob04d6abe9d88c158374bce7be55d7e7917ede0d1b
1 import tempfile
2 import gdbremote_testcase
3 from lldbsuite.test.lldbtest import *
4 from lldbsuite.test.decorators import *
5 from lldbgdbserverutils import *
8 class GdbRemoteCompletionTestCase(gdbremote_testcase.GdbRemoteTestCaseBase):
9 def init_lldb_server(self):
10 self.debug_monitor_exe = get_lldb_server_exe()
11 if not self.debug_monitor_exe:
12 self.skipTest("lldb-server exe not found")
13 port_file = tempfile.NamedTemporaryFile().name
14 commandline_args = ["platform", "--listen", "*:0", "--socket-file", port_file]
15 server = self.spawnSubprocess(
16 get_lldb_server_exe(), commandline_args, install_remote=False
18 self.assertIsNotNone(server)
19 self.stub_hostname = "localhost"
20 self.port = int(lldbutil.wait_for_file_on_target(self, port_file))
21 self.sock = self.create_socket()
22 self._server = Server(self.sock, server)
24 self.do_handshake()
26 def generate_hex_path(self, target):
27 return str(os.path.join(self.getBuildDir(), target)).encode().hex()
29 @add_test_categories(["llgs"])
30 def test_autocomplete_path(self):
31 self.build()
32 self.init_lldb_server()
34 # Test file-included completion when flag is set to 0.
35 self.test_sequence.add_log_lines(
37 "read packet: $qPathComplete:0,{}#00".format(
38 self.generate_hex_path("main")
40 "send packet: $M{},{}#00".format(
41 self.generate_hex_path("main.d"), self.generate_hex_path("main.o")
44 True,
47 # Test directory-only completion when flag is set to 1.
48 os.makedirs(os.path.join(self.getBuildDir(), "test"))
49 self.test_sequence.add_log_lines(
51 "read packet: $qPathComplete:1,{}#00".format(
52 self.generate_hex_path("tes")
54 "send packet: $M{}{}#00".format(
55 self.generate_hex_path("test"), os.path.sep.encode().hex()
56 ), # "test/" or "test\".
58 True,
61 self.expect_gdbremote_sequence()