brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.5 KiB · ff84cd9 Raw
60 lines · plain
1_T = require('lua_lldb_test').create_test('TestProcessAPI')2 3function _T:TestProcessLaunchSimple()4    local target = self:create_target()5    local args = { 'arg1', 'arg2', 'arg3' }6    local process = target:LaunchSimple(7        -- argv8        args,9        -- envp10        nil,11        -- working directory12        nil13    )14    assertTrue(process:IsValid())15    local stdout = process:GetSTDOUT(1000)16    assertEqual(split_lines(stdout), {self.exe, table.unpack(args)})17end18 19function _T:TestProcessLaunch()20    local target = self:create_target()21    local args = { 'arg1', 'arg2', 'arg3' }22    local error = lldb.SBError()23    local f = io.open(self.output, 'w')24    f:write()25    f:close()26    local process = target:Launch(27        -- listener28        self.debugger:GetListener(),29        -- argv30        args,31        -- envp32        nil,33        -- stdin34        nil,35        -- stdout36        self.output,37        -- stderr38        nil,39        -- working directory40        nil,41        -- launch flags42        0,43        -- stop at entry44        true,45        -- error46        error47    )48    assertTrue(error:Success())49    assertTrue(process:IsValid())50    local threads = get_stopped_threads(process, lldb.eStopReasonSignal)51    assertTrue(#threads ~= 0)52    local continue = process:Continue()53    assertTrue(continue:Success())54    local f = io.open(self.output, 'r')55    assertEqual(read_file_non_empty_lines(f), {self.exe, table.unpack(args)})56    f:close()57end58 59os.exit(_T:run())60