18
18
"""Benchmark test suite for bzr."""
20
20
from bzrlib.tests import TestLoader
21
from bzrlib.tests.blackbox import ExternalBase
23
class Benchmark(ExternalBase):
25
def make_kernel_like_tree(self):
26
"""Setup a temporary tree roughly like a kernel tree."""
27
# a kernel tree has ~10000 and 500 directory, with most files around
29
# we simulate this by three levels of dirs named 0-7, givin 512 dirs,
33
for outer in range(8):
34
files.append("%s/" % outer)
35
for middle in range(8):
36
files.append("%s/%s/" % (outer, middle))
37
for inner in range(8):
38
prefix = "%s/%s/%s/" % (outer, middle, inner)
40
files.extend([prefix + str(foo) for foo in range(20)])
41
self.build_tree(files)
24
45
"""Build and return a TestSuite which contains benchmark tests only."""
25
46
testmod_names = [ \
26
47
'bzrlib.benchmarks.bench_add',
48
'bzrlib.benchmarks.bench_checkout',
49
'bzrlib.benchmarks.bench_commit',
50
'bzrlib.benchmarks.bench_status',
51
'bzrlib.benchmarks.bench_transform',
28
53
return TestLoader().loadTestsFromModuleNames(testmod_names)