Files
clang-p2996/lldb/test/API/tools/lldb-vscode/runInTerminal/TestVSCode_runInTerminal.py
Walter Erquinigo 132e57bc59 Retry of D84974
- Fix a small issue caused by a conflicting name (GetObject) on Windows.
  The fix was to rename the internal GetObject function to
  GetNextFunction.
2020-09-14 10:44:13 -07:00

49 lines
1.6 KiB
Python

"""
Test lldb-vscode runInTerminal reverse request
"""
import unittest2
import vscode
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
import lldbvscode_testcase
import time
import os
class TestVSCode_runInTerminal(lldbvscode_testcase.VSCodeTestCaseBase):
mydir = TestBase.compute_mydir(__file__)
@skipUnlessDarwin
@skipIfRemote
def test_runInTerminal(self):
'''
Tests the "runInTerminal" reverse request. It makes sure that the IDE can
launch the inferior with the correct environment variables and arguments.
'''
program = self.getBuildArtifact("a.out")
source = 'main.c'
self.build_and_launch(program, stopOnEntry=True, runInTerminal=True, args=["foobar"], env=["FOO=bar"])
breakpoint_line = line_number(source, '// breakpoint')
self.set_source_breakpoints(source, [breakpoint_line])
self.continue_to_next_stop()
# We verify we actually stopped inside the loop
counter = int(self.vscode.get_local_variable_value('counter'))
self.assertTrue(counter > 0)
# We verify we were able to set the launch arguments
argc = int(self.vscode.get_local_variable_value('argc'))
self.assertEqual(argc, 2)
argv1 = self.vscode.request_evaluate('argv[1]')['body']['result']
self.assertIn('foobar', argv1)
# We verify we were able to set the environment
env = self.vscode.request_evaluate('foo')['body']['result']
self.assertIn('bar', env)