~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/benchmarks/__init__.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2006-05-19 06:14:38 UTC
  • mfrom: (1704.2.23 bzr.mbp.integration)
  • Revision ID: pqm@pqm.ubuntu.com-20060519061438-6300caf3926c3cff
(mbp) small fixes

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
"""Benchmark test suite for bzr."""
19
19
 
20
20
from bzrlib.tests import TestLoader
21
 
from bzrlib.tests.blackbox import ExternalBase
22
 
 
23
 
class Benchmark(ExternalBase):
24
 
 
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 
28
 
        # 3-4 levels deep. 
29
 
        # we simulate this by three levels of dirs named 0-7, givin 512 dirs,
30
 
        # and 20 files each.
31
 
        self.run_bzr('init')
32
 
        files = []
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)
39
 
                    files.append(prefix)
40
 
                    files.extend([prefix + str(foo) for foo in range(20)])
41
 
        self.build_tree(files)
42
21
 
43
22
 
44
23
def test_suite():
45
24
    """Build and return a TestSuite which contains benchmark tests only."""
46
25
    testmod_names = [ \
47
26
                   'bzrlib.benchmarks.bench_add',
48
 
                   'bzrlib.benchmarks.bench_checkout',
49
 
                   'bzrlib.benchmarks.bench_commit',
50
 
                   'bzrlib.benchmarks.bench_status',
51
 
                   'bzrlib.benchmarks.bench_transform',
52
 
                   'bzrlib.benchmarks.bench_workingtree',
53
27
                   ]
54
28
    return TestLoader().loadTestsFromModuleNames(testmod_names)