1""" 2Test lldb-vscode runInTerminal reverse request 3""" 4 5 6import unittest2 7import vscode 8from lldbsuite.test.decorators import * 9from lldbsuite.test.lldbtest import * 10from lldbsuite.test import lldbutil 11import lldbvscode_testcase 12import time 13import os 14 15 16class TestVSCode_runInTerminal(lldbvscode_testcase.VSCodeTestCaseBase): 17 18 mydir = TestBase.compute_mydir(__file__) 19 20 @skipUnlessDarwin 21 @skipIfRemote 22 def test_runInTerminal(self): 23 ''' 24 Tests the "runInTerminal" reverse request. It makes sure that the IDE can 25 launch the inferior with the correct environment variables and arguments. 26 ''' 27 program = self.getBuildArtifact("a.out") 28 source = 'main.c' 29 self.build_and_launch(program, stopOnEntry=True, runInTerminal=True, args=["foobar"], env=["FOO=bar"]) 30 breakpoint_line = line_number(source, '// breakpoint') 31 32 self.set_source_breakpoints(source, [breakpoint_line]) 33 self.continue_to_next_stop() 34 35 # We verify we actually stopped inside the loop 36 counter = int(self.vscode.get_local_variable_value('counter')) 37 self.assertTrue(counter > 0) 38 39 # We verify we were able to set the launch arguments 40 argc = int(self.vscode.get_local_variable_value('argc')) 41 self.assertEqual(argc, 2) 42 43 argv1 = self.vscode.request_evaluate('argv[1]')['body']['result'] 44 self.assertIn('foobar', argv1) 45 46 # We verify we were able to set the environment 47 env = self.vscode.request_evaluate('foo')['body']['result'] 48 self.assertIn('bar', env) 49