summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2010-05-10 10:34:48 +0200
committerhut <hut@lavabit.com>2010-05-10 21:03:41 +0200
commita0e543f8b2adb7afb2822122d786f25b41f08ba2 (patch)
treee71bd14d825bef523c0fe08a358244b5e1a1fd8a
parent3a1e1f28fa847df5021b37d4c81eb4dfa01f5a8e (diff)
downloadranger-a0e543f8b2adb7afb2822122d786f25b41f08ba2.tar.gz
all_benchmarks: improved
-rwxr-xr-xall_benchmarks.py28
-rw-r--r--test/bm_loader.py2
2 files changed, 20 insertions, 10 deletions
diff --git a/all_benchmarks.py b/all_benchmarks.py
index abcd051e..73316658 100755
--- a/all_benchmarks.py
+++ b/all_benchmarks.py
@@ -16,6 +16,7 @@
 
 """Run all the tests inside the test/ directory as a test suite."""
 if __name__ == '__main__':
+	from re import compile
 	from test import *
 	from time import time
 	from types import FunctionType as function
@@ -25,6 +26,16 @@ if __name__ == '__main__':
 		n = int(argv[1])
 	except IndexError:
 		n = 10
+	if len(argv) > 2:
+		args = [compile(re) for re in argv[2:]]
+		def allow(name):
+			for re in args:
+				if re.search(name):
+					return True
+			else:
+				return False
+	else:
+		allow = lambda name: True
 	for key, val in vars().copy().items():
 		if key.startswith('bm_'):
 			bms.extend(v for k,v in vars(val).items() if type(v) == type)
@@ -36,11 +47,12 @@ if __name__ == '__main__':
 			t1 = time()
 			method = getattr(bmobj, attrname)
 			methodname = "{0}.{1}".format(bmobj.__class__.__name__, method.__name__)
-			try:
-				method(n)
-			except:
-				print("{0} failed!".format(methodname))
-				raise
-			else:
-				t2 = time()
-				print("{0:60}: {1:10}s".format(methodname, t2 - t1))
+			if allow(methodname):
+				try:
+					method(n)
+				except:
+					print("{0} failed!".format(methodname))
+					raise
+				else:
+					t2 = time()
+					print("{0:60}: {1:10}s".format(methodname, t2 - t1))
diff --git a/test/bm_loader.py b/test/bm_loader.py
index 154fea3d..4bfc2db9 100644
--- a/test/bm_loader.py
+++ b/test/bm_loader.py
@@ -127,7 +127,6 @@ class benchmark_load(object):
 				self.loader.work()
 
 
-@skip
 class benchmark_raw_load(object):
 	def __init__(self):
 		SettingsAware.settings = Fake()
@@ -143,7 +142,6 @@ def bm_loader(n):
 	tloader = benchmark_load(N)
 	traw = benchmark_raw_load(N)
 
-@skip
 class benchmark_load_varieties(object):
 	def bm_ls(self, n):
 		for _ in range(n):