summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--numbench/basemodule.py1
-rw-r--r--numbench/confinput/xmlinput.py15
-rw-r--r--numbench/htmlreport.py5
-rw-r--r--numbench/main.py23
-rw-r--r--numbench/report.py17
-rw-r--r--numbench/utils/btl.py10
6 files changed, 59 insertions, 12 deletions
diff --git a/numbench/basemodule.py b/numbench/basemodule.py
index b13b879..3e7beb7 100644
--- a/numbench/basemodule.py
+++ b/numbench/basemodule.py
@@ -243,7 +243,6 @@ class BaseTest:
root = self.root
testdir = self.testdir
self.files = [pjoin(testdir,f) for f in self.files]
- env = {} # TODO: remove this
if cfg.libdir[0] == '/':
libdir = root+cfg.libdir
else:
diff --git a/numbench/confinput/xmlinput.py b/numbench/confinput/xmlinput.py
index 1d04580..2a145a9 100644
--- a/numbench/confinput/xmlinput.py
+++ b/numbench/confinput/xmlinput.py
@@ -1,5 +1,5 @@
import xml.dom.minidom
-import os, portage, types
+import sys, os, portage, types
import subprocess as sp
from os.path import join as pjoin, dirname as pdirname, realpath as prealpath
@@ -102,8 +102,16 @@ def parseConf(fname):
normPkg = pu.normalize_cpv(pkg)
# Skip implementations
- # TODO: add regexp
- skip = [i.firstChild.data for i in t.getElementsByTagName('skip')]
+ skip = []
+ skipre = []
+ for s in t.getElementsByTagName('skip'):
+ if not s.hasAtribute('type') or s.getAttribute('type') == 'glob':
+ skip.append(s.firstChild.data)
+ elif s.getAttribute('type') == 'regexp':
+ skipre.append(s.firstChild.data)
+ else:
+ sys.stderr.write('Error in configuration file: skip type ' \
+ + s.getAttribute('type') + ' not supported')
# Requirements
requires = {}
@@ -128,6 +136,7 @@ def parseConf(fname):
package = pkg,
normalizedPackage = normPkg,
skip = skip,
+ skipre = skipre,
requires = requires,
dependenv = dependenv,
diff --git a/numbench/htmlreport.py b/numbench/htmlreport.py
index a42f579..33c19fa 100644
--- a/numbench/htmlreport.py
+++ b/numbench/htmlreport.py
@@ -1,5 +1,5 @@
#=====================================================
-# Copyright (C) 2011 Andrea Arteaga <andyspiros@gmail.com>
+# Copyright (C) 2011-2012 Andrea Arteaga <andyspiros@gmail.com>
#=====================================================
#
# This program is free software; you can redistribute it and/or
@@ -17,6 +17,7 @@
#
import time
from os.path import join as pjoin, basename
+from xml.sax.saxutils import escape as xmlescape
import benchconfig as cfg
@@ -81,7 +82,7 @@ h1, h2, .plot, .descr, .info {
self.content += '<div class="inputfile">Input file: ' + \
'<a href="%s">%s</a>' % (basename(inputfile), cfg.inputfile) + \
- '<pre>%s</pre></div>' % file(cfg.inputfile, 'r').read()
+ '<pre>%s</pre></div>' % xmlescape(file(cfg.inputfile, 'r').read())
self.content += '<div class="log">Logs: <a href="log">%s</a></div>' \
% cfg.logdir
diff --git a/numbench/main.py b/numbench/main.py
index 9ba9ae7..1cbb772 100644
--- a/numbench/main.py
+++ b/numbench/main.py
@@ -1,7 +1,7 @@
#! /usr/bin/env python2
#=====================================================
-# Copyright (C) 2011 Andrea Arteaga <andyspiros@gmail.com>
+# Copyright (C) 2011-2012 Andrea Arteaga <andyspiros@gmail.com>
#=====================================================
#
# This program is free software; you can redistribute it and/or
@@ -89,6 +89,8 @@ if sys.argv[2] in ('-h', '--help'):
## BEGIN THE TRUE SCRIPT
# Import the packages
+import re
+from fnmatch import fnmatch
from os.path import join as pjoin
import benchconfig as cfg, benchutils as bu, confinput
from benchprint import Print
@@ -196,8 +198,23 @@ for tn,(name,test) in enumerate(cfg.tests.items(),1):
Print("Package emerged")
# Find implementations
- # TODO: check for regexps
- impls = [i for i in mod.getImplementations(test) if not i in test['skip']]
+ impls = []
+ for i in mod.getImplementations(test):
+ skip = False
+
+ for s in test['skip']:
+ if fnmatch(i, s):
+ skip = True
+ break
+
+ for s in test['skipre']:
+ if re.search(s, i) != None:
+ skip = True
+ break
+
+ if not skip:
+ impls.append(i)
+
test['implementations'] = impls
# Test every implementation
diff --git a/numbench/report.py b/numbench/report.py
index f51905a..901723b 100644
--- a/numbench/report.py
+++ b/numbench/report.py
@@ -1,3 +1,20 @@
+#=====================================================
+# Copyright (C) 2012 Andrea Arteaga <andyspiros@gmail.com>
+#=====================================================
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
from os.path import join as pjoin, basename
import numpy as np
diff --git a/numbench/utils/btl.py b/numbench/utils/btl.py
index 9865ad5..3031eb3 100644
--- a/numbench/utils/btl.py
+++ b/numbench/utils/btl.py
@@ -208,7 +208,7 @@ def runTest(test, btlconfig):
# Many different sizes for each operation test
Print.down()
cur = 0
- tot = 1
+ tot = 100
while cur != tot:
outline = proc.stdout.readline()
# If the line is void, something gone wrong
@@ -221,8 +221,12 @@ def runTest(test, btlconfig):
# Interpret line
outline = outline.strip()
- (cur, tot) = shlex.split(outline)[-1][1:-1].split('/')
- cur = int(cur); tot = int(tot)
+ try:
+ (cur, tot) = shlex.split(outline)[-1][1:-1].split('/')
+ cur = int(cur)
+ tot = int(tot)
+ except:
+ cur += 1
Print(outline)