[Lldb-commits] [lldb] r124198 - in /lldb/trunk/test/settings: TestSettings.py main.cpp
Johnny Chen
johnny.chen at apple.com
Tue Jan 25 09:39:43 PST 2011
Author: johnny
Date: Tue Jan 25 11:39:43 2011
New Revision: 124198
URL: http://llvm.org/viewvc/llvm-project?rev=124198&view=rev
Log:
Remove the expectedFailure decorator for the fixed bug:
rdar://problem/8435794
settings set target.process.output-path does not seem to work
Also change the test case from test_set_output_path to test_set_error_output_path
as it now exercises both setting target.process.error-path and target.process.output-path.
Modified:
lldb/trunk/test/settings/TestSettings.py
lldb/trunk/test/settings/main.cpp
Modified: lldb/trunk/test/settings/TestSettings.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/settings/TestSettings.py?rev=124198&r1=124197&r2=124198&view=diff
==============================================================================
--- lldb/trunk/test/settings/TestSettings.py (original)
+++ lldb/trunk/test/settings/TestSettings.py Tue Jan 25 11:39:43 2011
@@ -16,6 +16,7 @@
"""Cleanup the test byproducts."""
system(["/bin/sh", "-c", "rm -f output1.txt"])
system(["/bin/sh", "-c", "rm -f output2.txt"])
+ system(["/bin/sh", "-c", "rm -f stderr.txt"])
system(["/bin/sh", "-c", "rm -f stdout.txt"])
def test_set_prompt(self):
@@ -140,22 +141,25 @@
substrs = ["The host environment variable 'MY_HOST_ENV_VAR1' successfully passed.",
"The host environment variable 'MY_HOST_ENV_VAR2' successfully passed."])
- @unittest2.expectedFailure
- # rdar://problem/8435794
- # settings set target.process.output-path does not seem to work
- def test_set_output_path(self):
- """Test that setting target.process.output-path for the launched process works."""
+ def test_set_error_output_path(self):
+ """Test that setting target.process.error/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 target.process.output-path 'stdout.txt'")
- # And add a hook to restore original setting of target.process.output-path
- # later on during tearDown().
+ # Set the error-path and output-path and verify both are set.
+ self.runCmd("settings set target.process.error-path stderr.txt")
+ self.runCmd("settings set target.process.output-path stdout.txt")
+ # And add hooks to restore the original settings during tearDown().
self.addTearDownHook(
lambda: self.runCmd("settings set -r target.process.output-path"))
+ self.addTearDownHook(
+ lambda: self.runCmd("settings set -r target.process.error-path"))
+
+ self.expect("settings show target.process.error-path",
+ SETTING_MSG("target.process.error-path"),
+ startstr = "target.process.error-path (string) = 'stderr.txt'")
self.expect("settings show target.process.output-path",
SETTING_MSG("target.process.output-path"),
@@ -163,6 +167,17 @@
self.runCmd("run", RUN_SUCCEEDED)
+ # The 'stderr.txt' file should now exist.
+ self.assertTrue(os.path.isfile("stderr.txt"),
+ "'stderr.txt' exists due to target.process.error-path.")
+
+ # Read the output file produced by running the program.
+ with open('stderr.txt', 'r') as f:
+ output = f.read()
+
+ self.expect(output, exe=False,
+ startstr = "This message should go to standard error.")
+
# The 'stdout.txt' file should now exist.
self.assertTrue(os.path.isfile("stdout.txt"),
"'stdout.txt' exists due to target.process.output-path.")
Modified: lldb/trunk/test/settings/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/settings/main.cpp?rev=124198&r1=124197&r2=124198&view=diff
==============================================================================
--- lldb/trunk/test/settings/main.cpp (original)
+++ lldb/trunk/test/settings/main.cpp Tue Jan 25 11:39:43 2011
@@ -62,6 +62,7 @@
}
}
+ std::cerr << "This message should go to standard error.\n";
std::cout << "This message should go to standard out.\n";
outfile.close();
More information about the lldb-commits
mailing list