diff options
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test')
-rw-r--r-- | lldb/packages/Python/lldbsuite/test/dotest.py | 20 | ||||
-rw-r--r-- | lldb/packages/Python/lldbsuite/test/lldbtest.py | 6 | ||||
-rw-r--r-- | lldb/packages/Python/lldbsuite/test/test_categories.py | 2 | ||||
-rw-r--r-- | lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py (renamed from lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py) | 8 | ||||
-rw-r--r-- | lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py (renamed from lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py) | 104 |
5 files changed, 70 insertions, 70 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/dotest.py b/lldb/packages/Python/lldbsuite/test/dotest.py index a27d8cf..a639714 100644 --- a/lldb/packages/Python/lldbsuite/test/dotest.py +++ b/lldb/packages/Python/lldbsuite/test/dotest.py @@ -485,15 +485,15 @@ def setupSysPath(): os.environ["LLDB_SRC"] = lldbsuite.lldb_root pluginPath = os.path.join(scriptPath, "plugins") - toolsLLDBVSCode = os.path.join(scriptPath, "tools", "lldb-vscode") + toolsLLDBDAP = os.path.join(scriptPath, "tools", "lldb-dap") toolsLLDBServerPath = os.path.join(scriptPath, "tools", "lldb-server") intelpt = os.path.join(scriptPath, "tools", "intelpt") # Insert script dir, plugin dir and lldb-server dir to the sys.path. sys.path.insert(0, pluginPath) - # Adding test/tools/lldb-vscode to the path makes it easy to - # "import lldb_vscode_testcase" from the VSCode tests - sys.path.insert(0, toolsLLDBVSCode) + # Adding test/tools/lldb-dap to the path makes it easy to + # "import lldb_dap_testcase" from the DAP tests + sys.path.insert(0, toolsLLDBDAP) # Adding test/tools/lldb-server to the path makes it easy # to "import lldbgdbserverutils" from the lldb-server tests sys.path.insert(0, toolsLLDBServerPath) @@ -538,15 +538,15 @@ def setupSysPath(): lldbDir = os.path.dirname(lldbtest_config.lldbExec) - lldbVSCodeExec = os.path.join(lldbDir, "lldb-vscode") - if is_exe(lldbVSCodeExec): - os.environ["LLDBVSCODE_EXEC"] = lldbVSCodeExec + lldbDAPExec = os.path.join(lldbDir, "lldb-dap") + if is_exe(lldbDAPExec): + os.environ["LLDBDAP_EXEC"] = lldbDAPExec else: - if not configuration.shouldSkipBecauseOfCategories(["lldb-vscode"]): + if not configuration.shouldSkipBecauseOfCategories(["lldb-dap"]): print( - "The 'lldb-vscode' executable cannot be located. The lldb-vscode tests can not be run as a result." + "The 'lldb-dap' executable cannot be located. The lldb-dap tests can not be run as a result." ) - configuration.skip_categories.append("lldb-vscode") + configuration.skip_categories.append("lldb-dap") lldbPythonDir = None # The directory that contains 'lldb/__init__.py' diff --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py b/lldb/packages/Python/lldbsuite/test/lldbtest.py index c8670b2..6d736a5 100644 --- a/lldb/packages/Python/lldbsuite/test/lldbtest.py +++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py @@ -801,10 +801,10 @@ class Base(unittest2.TestCase): else: self.libcxxPath = None - if "LLDBVSCODE_EXEC" in os.environ: - self.lldbVSCodeExec = os.environ["LLDBVSCODE_EXEC"] + if "LLDBDAP_EXEC" in os.environ: + self.lldbDAPExec = os.environ["LLDBDAP_EXEC"] else: - self.lldbVSCodeExec = None + self.lldbDAPExec = None self.lldbOption = " ".join("-o '" + s + "'" for s in self.setUpCommands()) diff --git a/lldb/packages/Python/lldbsuite/test/test_categories.py b/lldb/packages/Python/lldbsuite/test/test_categories.py index 3883c4d..3f8de17 100644 --- a/lldb/packages/Python/lldbsuite/test/test_categories.py +++ b/lldb/packages/Python/lldbsuite/test/test_categories.py @@ -31,7 +31,7 @@ all_categories = { "libc++": "Test for libc++ data formatters", "libstdcxx": "Test for libstdcxx data formatters", "lldb-server": "Tests related to lldb-server", - "lldb-vscode": "Visual Studio Code debug adaptor tests", + "lldb-dap": "Tests for the Debug Adaptor Protocol with lldb-dap", "llgs": "Tests for the gdb-server functionality of lldb-server", "objc": "Tests related to the Objective-C programming language support", "pyapi": "Tests related to the Python API", diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py index 5ee0800..ca11f34 100644 --- a/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py +++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py @@ -1013,7 +1013,7 @@ class DebugCommunication(object): # self.recv.close() -class DebugAdaptor(DebugCommunication): +class DebugAdaptorServer(DebugCommunication): def __init__( self, executable=None, port=None, init_commands=[], log_file=None, env=None ): @@ -1024,7 +1024,7 @@ class DebugAdaptor(DebugCommunication): adaptor_env.update(env) if log_file: - adaptor_env["LLDBVSCODE_LOG"] = log_file + adaptor_env["LLDBDAP_LOG"] = log_file self.process = subprocess.Popen( [executable], stdin=subprocess.PIPE, @@ -1048,7 +1048,7 @@ class DebugAdaptor(DebugCommunication): return -1 def terminate(self): - super(DebugAdaptor, self).terminate() + super(DebugAdaptorServer, self).terminate() if self.process is not None: self.process.terminate() self.process.wait() @@ -1364,7 +1364,7 @@ def main(): "using the --port option" ) return - dbg = DebugAdaptor(executable=options.vscode_path, port=options.port) + dbg = DebugAdaptorServer(executable=options.vscode_path, port=options.port) if options.debug: raw_input('Waiting for debugger to attach pid "%i"' % (dbg.get_pid())) if options.replay: diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py index 8cd4e84..3094b66 100644 --- a/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py +++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py @@ -1,29 +1,29 @@ import os import time -import vscode +import dap_server from lldbsuite.test.lldbtest import * -class VSCodeTestCaseBase(TestBase): +class DAPTestCaseBase(TestBase): NO_DEBUG_INFO_TESTCASE = True - def create_debug_adaptor(self, lldbVSCodeEnv=None): + def create_debug_adaptor(self, lldbDAPEnv=None): """Create the Visual Studio Code debug adaptor""" self.assertTrue( - is_exe(self.lldbVSCodeExec), "lldb-vscode must exist and be executable" + is_exe(self.lldbDAPExec), "lldb-dap must exist and be executable" ) - log_file_path = self.getBuildArtifact("vscode.txt") - self.vscode = vscode.DebugAdaptor( - executable=self.lldbVSCodeExec, + log_file_path = self.getBuildArtifact("dap.txt") + self.dap_server = dap_server.DebugAdaptorServer( + executable=self.lldbDAPExec, init_commands=self.setUpCommands(), log_file=log_file_path, - env=lldbVSCodeEnv, + env=lldbDAPEnv, ) - def build_and_create_debug_adaptor(self, lldbVSCodeEnv=None): + def build_and_create_debug_adaptor(self, lldbDAPEnv=None): self.build() - self.create_debug_adaptor(lldbVSCodeEnv) + self.create_debug_adaptor(lldbDAPEnv) def set_source_breakpoints(self, source_path, lines, data=None): """Sets source breakpoints and returns an array of strings containing @@ -32,7 +32,7 @@ class VSCodeTestCaseBase(TestBase): Each object in data is 1:1 mapping with the entry in lines. It contains optional location/hitCondition/logMessage parameters. """ - response = self.vscode.request_setBreakpoints(source_path, lines, data) + response = self.dap_server.request_setBreakpoints(source_path, lines, data) if response is None: return [] breakpoints = response["body"]["breakpoints"] @@ -46,7 +46,7 @@ class VSCodeTestCaseBase(TestBase): and returns an array of strings containing the breakpoint IDs ("1", "2") for each breakpoint that was set. """ - response = self.vscode.request_setFunctionBreakpoints( + response = self.dap_server.request_setFunctionBreakpoints( functions, condition=condition, hitCondition=hitCondition ) if response is None: @@ -70,7 +70,7 @@ class VSCodeTestCaseBase(TestBase): "breakpoint_ids" should be a list of breakpoint ID strings (["1", "2"]). The return value from self.set_source_breakpoints() or self.set_function_breakpoints() can be passed to this function""" - stopped_events = self.vscode.wait_for_stopped() + stopped_events = self.dap_server.wait_for_stopped() for stopped_event in stopped_events: if "body" in stopped_event: body = stopped_event["body"] @@ -83,7 +83,7 @@ class VSCodeTestCaseBase(TestBase): # Descriptions for breakpoints will be in the form # "breakpoint 1.1", so look for any description that matches # ("breakpoint 1.") in the description field as verification - # that one of the breakpoint locations was hit. VSCode doesn't + # that one of the breakpoint locations was hit. DAP doesn't # allow breakpoints to have multiple locations, but LLDB does. # So when looking at the description we just want to make sure # the right breakpoint matches and not worry about the actual @@ -100,7 +100,7 @@ class VSCodeTestCaseBase(TestBase): reason is 'exception' and that the description matches 'expected_description' """ - stopped_events = self.vscode.wait_for_stopped() + stopped_events = self.dap_server.wait_for_stopped() for stopped_event in stopped_events: if "body" in stopped_event: body = stopped_event["body"] @@ -150,7 +150,7 @@ class VSCodeTestCaseBase(TestBase): def get_stackFrames_and_totalFramesCount( self, threadId=None, startFrame=None, levels=None, dump=False ): - response = self.vscode.request_stackTrace( + response = self.dap_server.request_stackTrace( threadId=threadId, startFrame=startFrame, levels=levels, dump=dump ) if response: @@ -185,16 +185,16 @@ class VSCodeTestCaseBase(TestBase): return ("", 0) def get_stdout(self, timeout=0.0): - return self.vscode.get_output("stdout", timeout=timeout) + return self.dap_server.get_output("stdout", timeout=timeout) def get_console(self, timeout=0.0): - return self.vscode.get_output("console", timeout=timeout) + return self.dap_server.get_output("console", timeout=timeout) def collect_console(self, duration): - return self.vscode.collect_output("console", duration=duration) + return self.dap_server.collect_output("console", duration=duration) def get_local_as_int(self, name, threadId=None): - value = self.vscode.get_local_variable_value(name, threadId=threadId) + value = self.dap_server.get_local_variable_value(name, threadId=threadId) if value.startswith("0x"): return int(value, 16) elif value.startswith("0"): @@ -204,48 +204,48 @@ class VSCodeTestCaseBase(TestBase): def set_local(self, name, value, id=None): """Set a top level local variable only.""" - return self.vscode.request_setVariable(1, name, str(value), id=id) + return self.dap_server.request_setVariable(1, name, str(value), id=id) def set_global(self, name, value, id=None): """Set a top level global variable only.""" - return self.vscode.request_setVariable(2, name, str(value), id=id) + return self.dap_server.request_setVariable(2, name, str(value), id=id) def stepIn(self, threadId=None, waitForStop=True): - self.vscode.request_stepIn(threadId=threadId) + self.dap_server.request_stepIn(threadId=threadId) if waitForStop: - return self.vscode.wait_for_stopped() + return self.dap_server.wait_for_stopped() return None def stepOver(self, threadId=None, waitForStop=True): - self.vscode.request_next(threadId=threadId) + self.dap_server.request_next(threadId=threadId) if waitForStop: - return self.vscode.wait_for_stopped() + return self.dap_server.wait_for_stopped() return None def stepOut(self, threadId=None, waitForStop=True): - self.vscode.request_stepOut(threadId=threadId) + self.dap_server.request_stepOut(threadId=threadId) if waitForStop: - return self.vscode.wait_for_stopped() + return self.dap_server.wait_for_stopped() return None def continue_to_next_stop(self): - self.vscode.request_continue() - return self.vscode.wait_for_stopped() + self.dap_server.request_continue() + return self.dap_server.wait_for_stopped() def continue_to_breakpoints(self, breakpoint_ids): - self.vscode.request_continue() + self.dap_server.request_continue() self.verify_breakpoint_hit(breakpoint_ids) def continue_to_exception_breakpoint(self, filter_label): - self.vscode.request_continue() + self.dap_server.request_continue() self.assertTrue( self.verify_stop_exception_info(filter_label), 'verify we got "%s"' % (filter_label), ) def continue_to_exit(self, exitCode=0): - self.vscode.request_continue() - stopped_events = self.vscode.wait_for_stopped() + self.dap_server.request_continue() + stopped_events = self.dap_server.wait_for_stopped() self.assertEquals( len(stopped_events), 1, "stopped_events = {}".format(stopped_events) ) @@ -266,10 +266,10 @@ class VSCodeTestCaseBase(TestBase): memoryReference = stackFrames[0]["instructionPointerReference"] self.assertIsNotNone(memoryReference) - if memoryReference not in self.vscode.disassembled_instructions: - self.vscode.request_disassemble(memoryReference=memoryReference) + if memoryReference not in self.dap_server.disassembled_instructions: + self.dap_server.request_disassemble(memoryReference=memoryReference) - return self.vscode.disassembled_instructions[memoryReference] + return self.dap_server.disassembled_instructions[memoryReference] def attach( self, @@ -289,22 +289,22 @@ class VSCodeTestCaseBase(TestBase): sourceMap=None, sourceInitFile=False, ): - """Build the default Makefile target, create the VSCode debug adaptor, + """Build the default Makefile target, create the DAP debug adaptor, and attach to the process. """ - # Make sure we disconnect and terminate the VSCode debug adaptor even + # Make sure we disconnect and terminate the DAP debug adaptor even # if we throw an exception during the test case. def cleanup(): if disconnectAutomatically: - self.vscode.request_disconnect(terminateDebuggee=True) - self.vscode.terminate() + self.dap_server.request_disconnect(terminateDebuggee=True) + self.dap_server.terminate() # Execute the cleanup function during test case tear down. self.addTearDownHook(cleanup) # Initialize and launch the program - self.vscode.request_initialize(sourceInitFile) - response = self.vscode.request_attach( + self.dap_server.request_initialize(sourceInitFile) + response = self.dap_server.request_attach( program=program, pid=pid, waitFor=waitFor, @@ -352,21 +352,21 @@ class VSCodeTestCaseBase(TestBase): enableAutoVariableSummaries=False, enableSyntheticChildDebugging=False, ): - """Sending launch request to vscode""" + """Sending launch request to dap""" - # Make sure we disconnect and terminate the VSCode debug adapter, + # Make sure we disconnect and terminate the DAP debug adapter, # if we throw an exception during the test case def cleanup(): if disconnectAutomatically: - self.vscode.request_disconnect(terminateDebuggee=True) - self.vscode.terminate() + self.dap_server.request_disconnect(terminateDebuggee=True) + self.dap_server.terminate() # Execute the cleanup function during test case tear down. self.addTearDownHook(cleanup) # Initialize and launch the program - self.vscode.request_initialize(sourceInitFile) - response = self.vscode.request_launch( + self.dap_server.request_initialize(sourceInitFile) + response = self.dap_server.request_launch( program, args=args, cwd=cwd, @@ -422,14 +422,14 @@ class VSCodeTestCaseBase(TestBase): runInTerminal=False, disconnectAutomatically=True, postRunCommands=None, - lldbVSCodeEnv=None, + lldbDAPEnv=None, enableAutoVariableSummaries=False, enableSyntheticChildDebugging=False, ): - """Build the default Makefile target, create the VSCode debug adaptor, + """Build the default Makefile target, create the DAP debug adaptor, and launch the process. """ - self.build_and_create_debug_adaptor(lldbVSCodeEnv) + self.build_and_create_debug_adaptor(lldbDAPEnv) self.assertTrue(os.path.exists(program), "executable must exist") return self.launch( |