Skip to content

Test target api #1673

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 18, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions lldb/test/API/python_api/target/TestTargetAPI.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,16 +154,23 @@ def test_read_memory(self):
@add_test_categories(['pyapi'])
@skipIfWindows # stdio manipulation unsupported on Windows
@skipIfRemote # stdio manipulation unsupported on remote iOS devices<rdar://problem/54581135>
@skipIfReproducer # stdout not captured by reproducers
@skipIf(oslist=["linux"], archs=["arm", "aarch64"])
@no_debug_info_test
def test_launch_simple(self):
d = {'EXE': 'b.out'}
self.build(dictionary=d)
self.setTearDownCleanup(dictionary=d)
target = self.create_simple_target('b.out')

# Set the debugger to synchronous mode so we only continue after the
# process has exited.
self.dbg.SetAsync(False)

process = target.LaunchSimple(
['foo', 'bar'], ['baz'], self.get_process_working_directory())
self.runCmd("run")
process.Continue()
self.assertEqual(process.GetState(), lldb.eStateExited)
output = process.GetSTDOUT(9999)
self.assertIn('arg: foo', output)
self.assertIn('arg: bar', output)
Expand All @@ -173,15 +180,17 @@ def test_launch_simple(self):
self.runCmd("setting set target.env-vars bar=baz")
process = target.LaunchSimple(None, None,
self.get_process_working_directory())
self.runCmd("run")
process.Continue()
self.assertEqual(process.GetState(), lldb.eStateExited)
output = process.GetSTDOUT(9999)
self.assertIn('arg: foo', output)
self.assertIn('env: bar=baz', output)

self.runCmd("settings set target.disable-stdio true")
process = target.LaunchSimple(
None, None, self.get_process_working_directory())
self.runCmd("run")
process.Continue()
self.assertEqual(process.GetState(), lldb.eStateExited)
output = process.GetSTDOUT(9999)
self.assertEqual(output, "")

Expand Down