--- a/Admin/mira.py Mon Apr 18 09:10:23 2011 +0200
+++ b/Admin/mira.py Mon Apr 18 10:00:55 2011 +0200
@@ -6,10 +6,15 @@
from os import path
from glob import glob
import subprocess
+from datetime import datetime
import re
import util
+from util import Lazy
+from mira.report import Report, Report_Content
+from mira.case import Case
+from mira.tools import tool
from mira import schedule
from mira.environment import scheduler
@@ -93,6 +98,37 @@
return summary
+@tool
+def import_isatest_log(env, conf, logfile):
+
+ """Imports isatest log file as a report."""
+
+ def the_match(pat, text, name):
+ match = re.search(pat, text)
+ if not match: raise Exception('No match found for ' + name)
+ return match.groups()
+
+ def parse_date(d):
+ return datetime.strptime(d, '%a %b %d %H:%M:%S %Z %Y')
+
+ log = util.readfile(logfile)
+
+ (begin_date, host) = the_match(r'-+ starting test -+ ([^-]*) -+ (\S*)', log, 'start tag')
+ (isabelle_version,) = the_match(r'Isabelle version: ([a-f0-9]{12})', log, 'Isabelle version')
+ (success, end_date) = the_match(r'-+ test (successful|FAILED) -+ ([^-]*) -', log, 'end tag')
+ summary = extract_isabelle_run_summary(log)
+ data = {'timing': extract_isabelle_run_timing(log)}
+ atts = {'log': Lazy.simple(log)}
+
+ content = Report_Content(summary, host, parse_date(begin_date),
+ parse_date(end_date), Lazy.simple(data), atts)
+ revision = ('Isabelle', env.repositories.get('Isabelle')[isabelle_version].hex())
+ case = Case(conf, [revision])
+
+ env.report_db.put(case, (success == 'successful'), content)
+
+
+
def isabelle_usedir(env, isa_path, isabelle_usedir_opts, base_image, dir_name):
return env.run_process('%s/bin/isabelle' % isa_path, 'usedir',