[Lldb-commits] [lldb] r114102 - in /lldb/trunk/test: lldbtest.py settings/TestSettings.py

Johnny Chen johnny.chen at apple.com
Thu Sep 16 11:26:07 PDT 2010


Author: johnny
Date: Thu Sep 16 13:26:06 2010
New Revision: 114102

URL: http://llvm.org/viewvc/llvm-project?rev=114102&view=rev
Log:
Added a test case for the settings command which sets process.output-path and
checks that the launched process writes its standard output there.

Modified:
    lldb/trunk/test/lldbtest.py
    lldb/trunk/test/settings/TestSettings.py

Modified: lldb/trunk/test/lldbtest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest.py?rev=114102&r1=114101&r2=114102&view=diff
==============================================================================
--- lldb/trunk/test/lldbtest.py (original)
+++ lldb/trunk/test/lldbtest.py Thu Sep 16 13:26:06 2010
@@ -247,7 +247,7 @@
         cmd = kwargs.get("args")
         if cmd is None:
             cmd = popenargs[0]
-        raise CalledProcessError(retcode, cmd, output=output)
+        raise CalledProcessError(retcode, cmd)
     return output
 
 

Modified: lldb/trunk/test/settings/TestSettings.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/settings/TestSettings.py?rev=114102&r1=114101&r2=114102&view=diff
==============================================================================
--- lldb/trunk/test/settings/TestSettings.py (original)
+++ lldb/trunk/test/settings/TestSettings.py Thu Sep 16 13:26:06 2010
@@ -14,6 +14,7 @@
     @classmethod
     def classCleanup(cls):
         system(["/bin/sh", "-c", "rm output.txt"])
+        #system(["/bin/sh", "-c", "rm stdout.txt"])
 
     def test_set_prompt(self):
         """Test that 'set prompt' actually changes the prompt."""
@@ -73,6 +74,29 @@
                         output.find("argv[3] matches") > 0 and
                         output.find("Environment variable 'MY_ENV_VAR' successfully passed.") > 0)
 
+    @unittest2.expectedFailure
+    # rdar://problem/8435794
+    # settings set process.output-path does not seem to work
+    def test_set_output_path(self):
+        """Test that setting process.output-path for the launched process works."""
+        self.buildDefault()
+
+        exe = os.path.join(os.getcwd(), "a.out")
+        self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
+
+        # Set the output-path and verify it is set.
+        self.runCmd("settings set process.output-path 'stdout.txt'")
+        self.expect("settings show process.output-path",
+            startstr = "process.output-path (string) = 'stdout.txt'")
+
+        self.runCmd("run", RUN_SUCCEEDED)
+
+        # Read the output file produced by running the program.
+        output = open('stdout.txt', 'r').read()
+
+        self.assertTrue(
+            output.startswith("This message should go to standard out."))
+
 
 if __name__ == '__main__':
     import atexit





More information about the lldb-commits mailing list