diff options
author | hut <hut@lavabit.com> | 2010-05-10 10:34:48 +0200 |
---|---|---|
committer | hut <hut@lavabit.com> | 2010-05-10 21:03:41 +0200 |
commit | a0e543f8b2adb7afb2822122d786f25b41f08ba2 (patch) | |
tree | e71bd14d825bef523c0fe08a358244b5e1a1fd8a /all_benchmarks.py | |
parent | 3a1e1f28fa847df5021b37d4c81eb4dfa01f5a8e (diff) | |
download | ranger-a0e543f8b2adb7afb2822122d786f25b41f08ba2.tar.gz |
all_benchmarks: improved
Diffstat (limited to 'all_benchmarks.py')
-rwxr-xr-x | all_benchmarks.py | 28 |
1 files changed, 20 insertions, 8 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)) |