Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lldb / test / API / lua_api / TestProcessAPI.lua
blobaa788ba7411550c81c0265eae81b1b07c99cbc53
1 _T = require('lua_lldb_test').create_test('TestProcessAPI')
3 function _T:TestProcessLaunchSimple()
4 local target = self:create_target()
5 local args = { 'arg1', 'arg2', 'arg3' }
6 local process = target:LaunchSimple(
7 -- argv
8 args,
9 -- envp
10 nil,
11 -- working directory
12 nil
14 assertTrue(process:IsValid())
15 local stdout = process:GetSTDOUT(1000)
16 assertEquals(split_lines(stdout), {self.exe, table.unpack(args)})
17 end
19 function _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 -- listener
28 self.debugger:GetListener(),
29 -- argv
30 args,
31 -- envp
32 nil,
33 -- stdin
34 nil,
35 -- stdout
36 self.output,
37 -- stderr
38 nil,
39 -- working directory
40 nil,
41 -- launch flags
43 -- stop at entry
44 true,
45 -- error
46 error
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 assertEquals(read_file_non_empty_lines(f), {self.exe, table.unpack(args)})
56 f:close()
57 end
59 os.exit(_T:run())