]> rtime.felk.cvut.cz Git - wvtest.git/blobdiff - tools/wvperf2html.py
Put the definition of prefix to a variable
[wvtest.git] / tools / wvperf2html.py
index 26fb4330c4da46f1d289dc0ac0c3583af55d93e9..c3f37d0a19c41cd85ac12144fc624f60fd46f5a3 100755 (executable)
@@ -8,6 +8,15 @@ import string
 import time
 import numpy as np
 
+re_prefix = "\([0-9]+\) (?:#   )?"
+re_date = re.compile('^Date: (.*)')
+re_testing = re.compile('^('+re_prefix+')?\s*Testing "(.*)" in (.*):\s*$')
+re_commit = re.compile('.*(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}).*, commit: (.*)')
+re_commithash = re.compile('([0-9a-f]{7})(-dirty)? \(')
+re_assertion = re.compile('^('+re_prefix+')?!\s*(.*?)\s+(\S+)\s*$')
+re_perf =  re.compile('^('+re_prefix+')?!\s*(.*?)\s+PERF:\s*(.*?)\s+(\S+)\s*$')
+re_perfaxis = re.compile('axis="([^"]+)"')
+
 class Axis:
     def __init__(self, name=None, units=None):
         self.name = name
@@ -214,14 +223,6 @@ class Graphs(dict):
 graphs = Graphs()
 commits = {}
 
-re_date = re.compile('^Date: (.*)')
-re_testing = re.compile('^(\([0-9]+\) (#   )?)?\s*Testing "(.*)" in (.*):\s*$')
-re_commit = re.compile('.*(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}).*, commit: (.*)')
-re_commithash = re.compile('([0-9a-f]{7})(-dirty)? \(')
-re_check = re.compile('^(\([0-9]+\) (#   )?)?!\s*(.*?)\s+(\S+)\s*$')
-re_perf =  re.compile('^(\([0-9]+\) (#   )?)?!\s*(.*?)\s+PERF:\s*(.*?)\s+(\S+)\s*$')
-re_perfaxis = re.compile('axis="([^"]+)"')
-
 date = time.localtime(time.time())
 
 for line in sys.stdin.readlines():
@@ -234,8 +235,8 @@ for line in sys.stdin.readlines():
 
     match = re_testing.match(line)
     if match:
-        what = match.group(3)
-        where = match.group(4)
+        what = match.group(2)
+        where = match.group(3)
 
         match = re_commit.match(what)
         if match:
@@ -261,7 +262,7 @@ for line in sys.stdin.readlines():
 
     match = re_perf.match(line)
     if match:
-        perfstr = match.group(4)
+        perfstr = match.group(3)
         perf = perfstr.split()
         col = perf[0]
         try:
@@ -273,7 +274,7 @@ for line in sys.stdin.readlines():
             if '=' in units: units = None
         except:
             units = None
-        if match.group(5) != "ok":
+        if match.group(4) != "ok":
             val=None
 
         graph.addValue(date, col, val, units)