summaryrefslogtreecommitdiff
path: root/lldb/test/API/python_api/target/TestTargetAPI.py
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2020-08-05 09:34:18 -0700
committerJonas Devlieghere <jonas@devlieghere.com>2020-08-05 10:08:28 -0700
commit882d8e60dd40c01c74b4e16b02cf7ca02e846434 (patch)
tree6a112715088ab4b6b968b9b5b65dcd751f1d62de /lldb/test/API/python_api/target/TestTargetAPI.py
parent3169d920ccd16ec3c3e1bf5d91595b70a5278045 (diff)
[lldb] Make SBTarget::LaunchSimple start form the target's LaunchInfo
Currently SBTarget::LaunchSimple creates a new LaunchInfo which means it ignores any target properties that have been set. Instead, it should start from the target's LaunchInfo and populated the specified fields. Differential revision: https://reviews.llvm.org/D85235
Diffstat (limited to 'lldb/test/API/python_api/target/TestTargetAPI.py')
-rw-r--r--lldb/test/API/python_api/target/TestTargetAPI.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/lldb/test/API/python_api/target/TestTargetAPI.py b/lldb/test/API/python_api/target/TestTargetAPI.py
index 016754720c8c..f6b349bd6a3d 100644
--- a/lldb/test/API/python_api/target/TestTargetAPI.py
+++ b/lldb/test/API/python_api/target/TestTargetAPI.py
@@ -150,6 +150,38 @@ class TargetAPITestCase(TestBase):
self.assertTrue(error.Success(), "Make sure memory read succeeded")
self.assertEqual(len(content), 1)
+
+ @add_test_categories(['pyapi'])
+ def test_launch_simple(self):
+ d = {'EXE': 'b.out'}
+ self.build(dictionary=d)
+ self.setTearDownCleanup(dictionary=d)
+ target = self.create_simple_target('b.out')
+
+ process = target.LaunchSimple(
+ ['foo', 'bar'], ['baz'], self.get_process_working_directory())
+ self.runCmd("run")
+ output = process.GetSTDOUT(9999)
+ self.assertIn('arg: foo', output)
+ self.assertIn('arg: bar', output)
+ self.assertIn('env: baz', output)
+
+ self.runCmd("setting set target.run-args foo")
+ self.runCmd("setting set target.env-vars bar=baz")
+ process = target.LaunchSimple(None, None,
+ self.get_process_working_directory())
+ self.runCmd("run")
+ 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")
+ output = process.GetSTDOUT(9999)
+ self.assertEqual(output, "")
+
def create_simple_target(self, fn):
exe = self.getBuildArtifact(fn)
target = self.dbg.CreateTarget(exe)