]> rtime.felk.cvut.cz Git - can-benchmark.git/blobdiff - gw-tests/genhtml/genhtml.py
Allow multiple graphs per test
[can-benchmark.git] / gw-tests / genhtml / genhtml.py
index b4d2d36dc39ea3bf86deedf8bc89792d1ee7f614..cd4985b9c6d0613bc67225cfee2372ea6f442a88 100755 (executable)
@@ -5,6 +5,7 @@ import dircache;
 import sys;
 import urllib
 import traceback
+import glob
 
 class DimValue(object):
     def __new__(cls, dim, value):
@@ -142,14 +143,18 @@ class Test(object):
         self.values = values
         self.tests = tests
     def printThumbLink(self, file):
-        thumb = self.path+'/thumb'
-        try:
-            imgs = [img for img in dircache.listdir(thumb)]
-        except OSError:
-            imgs = [ self.name + ".png" ]
+#         try:
+#             imgs = [img for img in dircache.listdir(thumb)]
+#         except OSError:
+#             imgs = [ self.name + ".png" ]
+        imgs = [ 'tgraph.png' ]
         for img in imgs:
-            print >>file, "<a href='%s/results.html'><img src='%s/thumb/%s'></a>" % \
+            print >>file, "<a href='%s/results.html'><img src='%s/%s'></a>" % \
                   (urllib.quote(self.path), urllib.quote(self.path), img)
+    def fullImgLink(self, pngName):
+        return "<div><a href='%s'><img src='%s' /></a></div>" % \
+               (pngName[:-4]+".pdf", pngName)
+        
     def generateHtml(self):
         html = open(os.path.join(self.path, 'results.html'), "w")
        title = "CAN gateway timing analysis"
@@ -182,10 +187,20 @@ class Test(object):
             print >>html, "<tr><th>%s</th><td>" % d, " ".join(links), "</td></tr>"
 
         print >>html, "</table></div>"
-        print >>html, "<div><a href='%s'><img src='%s' /></a></div>" % (self.name+".pdf", self.name+".png")
+        print >>html, self.fullImgLink("graph.png")
         print >>html, "<a href='./'>Raw data</a><br />"
         print >>html, "<a href='%s'>Script source</a><br />" % (cdup+self.name+".sh.html")
         print >>html, "<a href='%s'>Back to top</a><br />" % cdup
+
+        cwd = os.getcwd()
+        os.chdir(self.path)
+        additionalImgs = glob.glob("graph?*.png")
+        if additionalImgs:
+            print "XXX"
+            print >>html, "<h2>Additional graphs</h2>"
+        for i in additionalImgs:
+            print >>html, self.fullImgLink(i)
+        os.chdir(cwd)
         
         html.close()