aboutsummaryrefslogtreecommitdiff
path: root/lldb/test/API/python_api
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/test/API/python_api')
-rw-r--r--lldb/test/API/python_api/target/TestTargetAPI.py32
-rw-r--r--lldb/test/API/python_api/target/main.c15
2 files changed, 43 insertions, 4 deletions
diff --git a/lldb/test/API/python_api/target/TestTargetAPI.py b/lldb/test/API/python_api/target/TestTargetAPI.py
index 0167547..f6b349b 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)
diff --git a/lldb/test/API/python_api/target/main.c b/lldb/test/API/python_api/target/main.c
index 7724fa7..0949c15 100644
--- a/lldb/test/API/python_api/target/main.c
+++ b/lldb/test/API/python_api/target/main.c
@@ -36,17 +36,24 @@ int c(int val)
return val + 3;
}
-int main (int argc, char const *argv[])
+int main (int argc, char const *argv[], char** env)
{
// Set a break at entry to main.
int A1 = a(1); // a(1) -> b(1) -> c(1)
printf("a(1) returns %d\n", A1);
-
+
int B2 = b(2); // b(2) -> c(2)
printf("b(2) returns %d\n", B2);
-
+
int A3 = a(3); // a(3) -> c(3)
printf("a(3) returns %d\n", A3);
-
+
+ for (int i = 1; i < argc; i++) {
+ printf("arg: %s\n", argv[i]);
+ }
+
+ while (*env)
+ printf("env: %s\n", *env++);
+
return 0;
}