Add support to the parser and server job for logging the result of an exception
when it is raised within the server control file and not inside of a job.
Currently these exceptions are only logged into the debug/ logs and not into
the status log (and thus not into the database). 

It adds support by logging an INFO message with a special job_abort_reason
field when a server job fails with an exception, and the parser then
special-cases these info lines (much like it already does with kernel version
INFO lines) and updates the SERVER_JOB entry. 

Unfortunately this can't easily be done with a "normal" status log entry since
when a failure occurs outside of a test the special SERVER_JOB entry is the
only place where this reason information actually belongs, but the parser has
no existing mechanism for modifying this entry (since it's automatically
generated by the parser, rather than being generated in response to a specific
log). Adding this (relatively small) special case seemed more practical than
either adding yet another special entry or trying to perform a major
restructuring of the parser.

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

--- autotest/server/server_job.py       2010-06-16 16:17:38.000000000 -0700
+++ autotest/server/server_job.py       2010-09-09 14:01:55.000000000 -0700
@@ -542,10 +542,12 @@
 
                 # no error occured, so we don't need to collect crashinfo
                 collect_crashinfo = False
-            except:
+            except Exception, e:
                 try:
                     logging.exception(
                             'Exception escaped control file, job aborting:')
+                    self.record('INFO', None, None, str(e),
+                                {'job_abort_reason': str(e)})
                 except:
                     pass # don't let logging exceptions here interfere
                 raise
--- autotest/tko/parsers/version_1.py   2010-05-04 11:03:15.000000000 -0700
+++ autotest/tko/parsers/version_1.py   2010-09-09 14:01:55.000000000 -0700
@@ -285,9 +285,14 @@
                 subdir_stack.append(line.subdir)
                 continue
             elif line.type == "INFO":
+                fields = line.optional_fields
                 # update the current kernel if one is defined in the info
-                if "kernel" in line.optional_fields:
+                if "kernel" in fields:
                     current_kernel = line.get_kernel()
+                # update the SERVER_JOB reason if one was logged for an abort
+                if "job_abort_reason" in fields:
+                    running_job.reason = fields["job_abort_reason"]
+                    new_tests.append(running_job)
                 continue
             elif line.type == "STATUS":
                 # update the stacks
@@ -385,7 +390,7 @@
 
         # the job is finished, produce the final SERVER_JOB entry and exit
         final_job = test.parse_test(self.job, "----", "SERVER_JOB",
-                                    self.job.exit_status(), "",
+                                    self.job.exit_status(), running_job.reason,
                                     current_kernel,
                                     self.job.started_time,
                                     self.job.finished_time,
_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to