summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjadmanski <jadmanski@592f7852-d20e-0410-864c-8624ca9c26a4>2010-09-14 14:25:30 +0000
committerjadmanski <jadmanski@592f7852-d20e-0410-864c-8624ca9c26a4>2010-09-14 14:25:30 +0000
commit75f5edc9a44a242dba558f581b4a7bfc72f2b099 (patch)
tree5466f67bcaf7d9572902d2c81eb29d7408ba9def
parentd6dc2b64ac08b40c410dfa911b1f077a92ae8e56 (diff)
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 <jadmanski@google.com> git-svn-id: svn://test.kernel.org/autotest/trunk@4785 592f7852-d20e-0410-864c-8624ca9c26a4
-rw-r--r--server/server_job.py4
-rw-r--r--tko/parsers/version_1.py9
2 files changed, 10 insertions, 3 deletions
diff --git a/server/server_job.py b/server/server_job.py
index 757257ff..6ef59deb 100644
--- a/server/server_job.py
+++ b/server/server_job.py
@@ -542,10 +542,12 @@ class base_server_job(base_job.base_job):
# 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
diff --git a/tko/parsers/version_1.py b/tko/parsers/version_1.py
index e231fd1b..111f7efa 100644
--- a/tko/parsers/version_1.py
+++ b/tko/parsers/version_1.py
@@ -285,9 +285,14 @@ class parser(base.parser):
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 @@ class parser(base.parser):
# 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,