diff options
Diffstat (limited to 'packages/Python/lldbsuite/test/functionalities/single-quote-in-filename-to-lldb/TestSingleQuoteInFilename.py')
-rw-r--r-- | packages/Python/lldbsuite/test/functionalities/single-quote-in-filename-to-lldb/TestSingleQuoteInFilename.py | 44 |
1 files changed, 20 insertions, 24 deletions
diff --git a/packages/Python/lldbsuite/test/functionalities/single-quote-in-filename-to-lldb/TestSingleQuoteInFilename.py b/packages/Python/lldbsuite/test/functionalities/single-quote-in-filename-to-lldb/TestSingleQuoteInFilename.py index ad08c6a9e9528..984e802fdaa08 100644 --- a/packages/Python/lldbsuite/test/functionalities/single-quote-in-filename-to-lldb/TestSingleQuoteInFilename.py +++ b/packages/Python/lldbsuite/test/functionalities/single-quote-in-filename-to-lldb/TestSingleQuoteInFilename.py @@ -10,7 +10,7 @@ import lldb from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil - +import six class SingleQuoteInCommandLineTestCase(TestBase): @@ -35,7 +35,10 @@ class SingleQuoteInCommandLineTestCase(TestBase): """Test that 'lldb my_file_name' works where my_file_name is a string with a single quote char in it.""" import pexpect self.buildDefault() - system([["cp", "a.out", "\"%s\"" % self.myexe]]) + lldbutil.mkdir_p(self.getBuildArtifact("path with '09")) + system([["cp", + self.getBuildArtifact("a.out"), + "\"%s\"" % self.getBuildArtifact(self.myexe)]]) # The default lldb prompt. prompt = "(lldb) " @@ -43,35 +46,28 @@ class SingleQuoteInCommandLineTestCase(TestBase): # So that the child gets torn down after the test. self.child = pexpect.spawn( '%s %s "%s"' % - (lldbtest_config.lldbExec, self.lldbOption, self.myexe)) + (lldbtest_config.lldbExec, self.lldbOption, + self.getBuildArtifact(self.myexe))) child = self.child child.setecho(True) - # Turn on logging for input/output to/from the child. - with open('child_send.txt', 'w') as f_send: - with open('child_read.txt', 'w') as f_read: - child.logfile_send = f_send - child.logfile_read = f_read - - child.expect_exact(prompt) + child.logfile_send = send = six.StringIO() + child.logfile_read = read = six.StringIO() + child.expect_exact(prompt) - child.send("help watchpoint") - child.sendline('') - child.expect_exact(prompt) + child.send("help watchpoint") + child.sendline('') + child.expect_exact(prompt) # Now that the necessary logging is done, restore logfile to None to # stop further logging. child.logfile_send = None child.logfile_read = None - with open('child_send.txt', 'r') as fs: - if self.TraceOn(): - print("\n\nContents of child_send.txt:") - print(fs.read()) - with open('child_read.txt', 'r') as fr: - from_child = fr.read() - if self.TraceOn(): - print("\n\nContents of child_read.txt:") - print(from_child) + if self.TraceOn(): + print("\n\nContents of send") + print(send.getvalue()) + print("\n\nContents of read") + print(read.getvalue()) - self.expect(from_child, exe=False, - substrs=["Current executable set to"]) + self.expect(read.getvalue(), exe=False, + substrs=["Current executable set to"]) |