I changed the logging test to just test that logging doesn't crash and does produce output. That's

about all it is useful to test.

llvm-svn: 204284
This commit is contained in:
Jim Ingham 2014-03-19 23:55:54 +00:00
parent a7d63fc610
commit c49d0d4fe6

View File

@ -1,5 +1,5 @@
"""
Test lldb logging.
Test lldb logging. This test just makes sure logging doesn't crash, and produces some output.
"""
import os, time
@ -14,13 +14,11 @@ class LogTestCase(TestBase):
@unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
@dsym_test
def test_with_dsym (self):
self.skipTest ("This test case depends on the exact output of lldb log. Why is that useful?")
self.buildDsym ()
self.command_log_tests ("dsym")
@dwarf_test
def test_with_dwarf (self):
self.skipTest ("This test case depends on the exact output of lldb log. Why is that useful?")
self.buildDwarf ()
self.command_log_tests ("dwarf")
@ -47,59 +45,16 @@ class LogTestCase(TestBase):
self.runCmd ("bp l")
expected_log_lines = [
"Processing command: command alias bp breakpoint\n",
"HandleCommand, cmd_obj : 'command alias'\n",
"HandleCommand, revised_command_line: 'command alias bp breakpoint'\n",
"HandleCommand, wants_raw_input:'True'\n",
"HandleCommand, command line after removing command name(s): 'bp breakpoint'\n",
"HandleCommand, command succeeded\n",
"Processing command: bp set -n main\n",
"HandleCommand, cmd_obj : 'breakpoint set'\n",
"HandleCommand, revised_command_line: 'breakpoint set -n main'\n",
"HandleCommand, wants_raw_input:'False'\n",
"HandleCommand, command line after removing command name(s): '-n main'\n",
"HandleCommand, command succeeded\n",
"Processing command: bp l\n",
"HandleCommand, cmd_obj : 'breakpoint list'\n",
"HandleCommand, revised_command_line: 'breakpoint l'\n",
"HandleCommand, wants_raw_input:'False'\n",
"HandleCommand, command line after removing command name(s): ''\n",
"HandleCommand, command succeeded\n",
"Processing command: log disable lldb\n",
"HandleCommand, cmd_obj : 'log disable'\n",
"HandleCommand, revised_command_line: 'log disable lldb'\n",
"HandleCommand, wants_raw_input:'False'\n",
"HandleCommand, command line after removing command name(s): 'lldb'\n",
]
self.runCmd("log disable lldb")
self.assertTrue (os.path.isfile (log_file))
idx = 0
end = len (expected_log_lines)
f = open (log_file)
log_lines = f.readlines()
f.close ()
os.remove (log_file)
err_msg = ""
success = True
if len (log_lines) != len (expected_log_lines):
success = False
err_msg = "Wrong number of lines in log file; expected: " + repr (len (expected_log_lines)) + " found: " + repr(len (log_lines))
else:
for line1, line2 in zip (log_lines, expected_log_lines):
if line1 != line2:
success = False
err_msg = "Expected '" + line2 + "'; Found '" + line1 + "'"
break
if not success:
self.fail (err_msg)
self.assertTrue(log_lines > 0, "Something was written to the log file.")
if __name__ == '__main__':
import atexit