2 Test the lldb command line takes a filename with single quote chars.
5 from __future__ import print_function
10 from lldbsuite.test.decorators import *
11 from lldbsuite.test.lldbtest import *
12 from lldbsuite.test import lldbutil
15 class SingleQuoteInCommandLineTestCase(TestBase):
17 mydir = TestBase.compute_mydir(__file__)
18 myexe = "path with '09/a.out"
21 def classCleanup(cls):
22 """Cleanup the test byproducts."""
24 os.remove("child_send.txt")
25 os.remove("child_read.txt")
31 hostoslist=["windows"],
32 bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
34 def test_lldb_invocation_with_single_quote_in_filename(self):
35 """Test that 'lldb my_file_name' works where my_file_name is a string with a single quote char in it."""
38 system([["cp", "a.out", "\"%s\"" % self.myexe]])
40 # The default lldb prompt.
43 # So that the child gets torn down after the test.
44 self.child = pexpect.spawn(
46 (lldbtest_config.lldbExec, self.lldbOption, self.myexe))
49 # Turn on logging for input/output to/from the child.
50 with open('child_send.txt', 'w') as f_send:
51 with open('child_read.txt', 'w') as f_read:
52 child.logfile_send = f_send
53 child.logfile_read = f_read
55 child.expect_exact(prompt)
57 child.send("help watchpoint")
59 child.expect_exact(prompt)
61 # Now that the necessary logging is done, restore logfile to None to
62 # stop further logging.
63 child.logfile_send = None
64 child.logfile_read = None
66 with open('child_send.txt', 'r') as fs:
68 print("\n\nContents of child_send.txt:")
70 with open('child_read.txt', 'r') as fr:
71 from_child = fr.read()
73 print("\n\nContents of child_read.txt:")
76 self.expect(from_child, exe=False,
77 substrs=["Current executable set to"])