summaryrefslogtreecommitdiffstats
path: root/lldb/test/settings/TestSettings.py
diff options
context:
space:
mode:
authorJohnny Chen <johnny.chen@apple.com>2010-09-15 22:27:29 +0000
committerJohnny Chen <johnny.chen@apple.com>2010-09-15 22:27:29 +0000
commitd5e111c2c16d0f79264546bb9ca2bae467b2a171 (patch)
treea4da2b8bf6bc96931eb25010592e1294a0136100 /lldb/test/settings/TestSettings.py
parentcb54b960b80826a3ec55349771a4a4d1dc339810 (diff)
downloadbcm5719-llvm-d5e111c2c16d0f79264546bb9ca2bae467b2a171.tar.gz
bcm5719-llvm-d5e111c2c16d0f79264546bb9ca2bae467b2a171.zip
Added two test cases to TestSettings.py which exercise the lldb's:
(lldb) settings set process.run-args A B C (lldb) settings set process.env-vars ["MY_ENV_VAR"]=YES commands. The main.cpp checks whether A, B, C is passed to main and whether the $MY_ENV_VAR env variable is defined and outputs the findings to a file. llvm-svn: 114031
Diffstat (limited to 'lldb/test/settings/TestSettings.py')
-rw-r--r--lldb/test/settings/TestSettings.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/lldb/test/settings/TestSettings.py b/lldb/test/settings/TestSettings.py
index 7d549db09d6..f18c0bc9d6e 100644
--- a/lldb/test/settings/TestSettings.py
+++ b/lldb/test/settings/TestSettings.py
@@ -39,6 +39,36 @@ class SettingsCommandTestCase(TestBase):
self.expect("settings show",
startstr = "term-width (int) = '70'")
+ @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
+ def test_with_dsym(self):
+ """Test that run-args and env-vars are passed to the launched process."""
+ self.buildDsym()
+ self.pass_run_args_and_env_vars()
+
+ def test_with_dwarf(self):
+ """Test that run-args and env-vars are passed to the launched process."""
+ self.buildDwarf()
+ self.pass_run_args_and_env_vars()
+
+ def pass_run_args_and_env_vars(self):
+ """Test that run-args and env-vars are passed to the launched process."""
+ exe = os.path.join(os.getcwd(), "a.out")
+ self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
+
+ # Set the run-args and the env-vars.
+ self.runCmd('settings set process.run-args A B C')
+ self.runCmd('settings set process.env-vars ["MY_ENV_VAR"]=YES')
+
+ self.runCmd("run", RUN_SUCCEEDED)
+
+ # Read the output file produced by running the program.
+ output = open('/tmp/output.txt', 'r').read()
+
+ self.assertTrue(output.startswith("argv[1] matches") and
+ output.find("argv[2] matches") > 0 and
+ output.find("argv[3] matches") > 0 and
+ output.find("Environment variable 'MY_ENV_VAR' successfully passed.") > 0)
+
if __name__ == '__main__':
import atexit
OpenPOWER on IntegriCloud