~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/benchmarks/__init__.py

  • Committer: Jelmer Vernooij
  • Date: 2006-06-13 13:24:40 UTC
  • mfrom: (1767 +trunk)
  • mto: (1769.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 1770.
  • Revision ID: jelmer@samba.org-20060613132440-24e222a86f948f60
[merge] bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 
18
18
"""Benchmark test suite for bzr."""
19
19
 
 
20
import bzrlib
20
21
from bzrlib.tests import TestLoader
21
22
from bzrlib.tests.blackbox import ExternalBase
22
23
 
23
24
class Benchmark(ExternalBase):
24
25
 
25
 
    def make_kernel_like_tree(self):
26
 
        """Setup a temporary tree roughly like a kernel tree."""
 
26
    def make_kernel_like_tree(self, url=None):
 
27
        """Setup a temporary tree roughly like a kernel tree.
 
28
        
 
29
        :param url: Creat the kernel like tree as a lightweight checkout
 
30
        of a new branch created at url.
 
31
        """
27
32
        # a kernel tree has ~10000 and 500 directory, with most files around 
28
33
        # 3-4 levels deep. 
29
34
        # we simulate this by three levels of dirs named 0-7, givin 512 dirs,
30
35
        # and 20 files each.
31
 
        self.run_bzr('init')
 
36
        if url is not None:
 
37
            b = bzrlib.bzrdir.BzrDir.create_branch_convenience(url)
 
38
            d = bzrlib.bzrdir.BzrDir.create('.')
 
39
            bzrlib.branch.BranchReferenceFormat().initialize(d, b)
 
40
            d.create_workingtree()
 
41
        else:
 
42
            self.run_bzr('init')
32
43
        files = []
33
44
        for outer in range(8):
34
45
            files.append("%s/" % outer)
45
56
    """Build and return a TestSuite which contains benchmark tests only."""
46
57
    testmod_names = [ \
47
58
                   'bzrlib.benchmarks.bench_add',
 
59
                   'bzrlib.benchmarks.bench_bench',
48
60
                   'bzrlib.benchmarks.bench_checkout',
49
61
                   'bzrlib.benchmarks.bench_commit',
 
62
                   'bzrlib.benchmarks.bench_rocks',
 
63
                   'bzrlib.benchmarks.bench_osutils',
50
64
                   'bzrlib.benchmarks.bench_status',
51
65
                   'bzrlib.benchmarks.bench_transform',
 
66
                   'bzrlib.benchmarks.bench_workingtree',
52
67
                   ]
53
68
    return TestLoader().loadTestsFromModuleNames(testmod_names)