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.

llvm-svn: 124198
This commit is contained in:
Johnny Chen 2011-01-25 17:39:43 +00:00
parent 85f240c788
commit 93b0c8b2aa
2 changed files with 25 additions and 9 deletions

View File

@ -16,6 +16,7 @@ class SettingsCommandTestCase(TestBase):
"""Cleanup the test byproducts.""" """Cleanup the test byproducts."""
system(["/bin/sh", "-c", "rm -f output1.txt"]) system(["/bin/sh", "-c", "rm -f output1.txt"])
system(["/bin/sh", "-c", "rm -f output2.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"]) system(["/bin/sh", "-c", "rm -f stdout.txt"])
def test_set_prompt(self): def test_set_prompt(self):
@ -140,22 +141,25 @@ class SettingsCommandTestCase(TestBase):
substrs = ["The host environment variable 'MY_HOST_ENV_VAR1' successfully passed.", substrs = ["The host environment variable 'MY_HOST_ENV_VAR1' successfully passed.",
"The host environment variable 'MY_HOST_ENV_VAR2' successfully passed."]) "The host environment variable 'MY_HOST_ENV_VAR2' successfully passed."])
@unittest2.expectedFailure def test_set_error_output_path(self):
# rdar://problem/8435794 """Test that setting target.process.error/output-path for the launched process works."""
# 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."""
self.buildDefault() self.buildDefault()
exe = os.path.join(os.getcwd(), "a.out") exe = os.path.join(os.getcwd(), "a.out")
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Set the output-path and verify it is set. # Set the error-path and output-path and verify both are set.
self.runCmd("settings set target.process.output-path 'stdout.txt'") self.runCmd("settings set target.process.error-path stderr.txt")
# And add a hook to restore original setting of target.process.output-path self.runCmd("settings set target.process.output-path stdout.txt")
# later on during tearDown(). # And add hooks to restore the original settings during tearDown().
self.addTearDownHook( self.addTearDownHook(
lambda: self.runCmd("settings set -r target.process.output-path")) 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", self.expect("settings show target.process.output-path",
SETTING_MSG("target.process.output-path"), SETTING_MSG("target.process.output-path"),
@ -163,6 +167,17 @@ class SettingsCommandTestCase(TestBase):
self.runCmd("run", RUN_SUCCEEDED) 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. # The 'stdout.txt' file should now exist.
self.assertTrue(os.path.isfile("stdout.txt"), self.assertTrue(os.path.isfile("stdout.txt"),
"'stdout.txt' exists due to target.process.output-path.") "'stdout.txt' exists due to target.process.output-path.")

View File

@ -62,6 +62,7 @@ main(int argc, char const *argv[])
} }
} }
std::cerr << "This message should go to standard error.\n";
std::cout << "This message should go to standard out.\n"; std::cout << "This message should go to standard out.\n";
outfile.close(); outfile.close();