Fix a bug in the base_job logging where it indents all lines of logs
instead of just the "real" status lines. This causes extra non-status
lines to look like status lines to the parser, which then falls over
trying to parse them. This is a regression from the pre-refactored
code.

Signed-off-by: John Admanski <[email protected]>

--- autotest/client/common_lib/base_job.py      2010-07-15 14:25:48.000000000 
-0700
+++ autotest/client/common_lib/base_job.py      2010-07-15 14:25:48.000000000 
-0700
@@ -596,22 +596,6 @@
         self.subdir_filename = subdir_filename
         self._record_hook = record_hook
 
-    @staticmethod
-    def _indent_multiline_text(multiline_string, num_tabs):
-        """Indents all the lines of a multiline block of text.
-
-        @param multiline_string: A string to indent
-        @param num_tabs: The number of tabs to prepend to each line
-
-        @return: A copy of multiline_string with each line prepended with
-            num_tabs hard tabs.
-        """
-        prefix = '\t' * num_tabs
-        # indent every line after the first
-        indented = multiline_string.rstrip('\n').replace('\n', '\n' + prefix)
-        # stick an indent on the first line as well
-        return prefix + indented
-
 
     def render_entry(self, log_entry):
         """Render a status_log_entry as it would be written to a log file.
@@ -625,7 +609,7 @@
             indent = self._indenter.indent - 1
         else:
             indent = self._indenter.indent
-        return self._indent_multiline_text(log_entry.render(), indent)
+        return '\t' * indent + log_entry.render().rstrip('\n')
 
 
     def record_entry(self, log_entry, log_in_subdir=True):
--- autotest/client/common_lib/base_job_unittest.py     2010-07-15 
14:25:48.000000000 -0700
+++ autotest/client/common_lib/base_job_unittest.py     2010-07-15 
14:25:48.000000000 -0700
@@ -1228,7 +1228,7 @@
         self.logger.record_entry(self.make_dummy_entry('LINE4', end=True))
 
         expected_log = ('LINE1\n  blah\nLINE2\n'
-                        '\tLINE3\n\t  blah\n\t  two\nLINE4\n')
+                        '\tLINE3\n  blah\n  two\nLINE4\n')
         self.assertEqual(expected_log, open('status').read())
_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to