~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/benchmarks/__init__.py

  • Committer: John Arbash Meinel
  • Date: 2006-07-13 18:38:58 UTC
  • mfrom: (1863 +trunk)
  • mto: This revision was merged to the branch mainline in revision 1869.
  • Revision ID: john@arbash-meinel.com-20060713183858-ebf4aa1f9ef8bb6e
[merge] bzr.dev 1863

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
from bzrlib import bzrdir, plugin
21
21
from bzrlib.tests.TestUtil import TestLoader
22
 
from bzrlib.bzrdir import BzrDir
23
22
from bzrlib.tests.blackbox import ExternalBase
24
23
 
 
24
 
25
25
class Benchmark(ExternalBase):
26
26
 
27
27
    def make_kernel_like_tree(self, url=None):
35
35
        # we simulate this by three levels of dirs named 0-7, givin 512 dirs,
36
36
        # and 20 files each.
37
37
        if url is not None:
38
 
            b = bzrlib.bzrdir.BzrDir.create_branch_convenience(url)
39
 
            d = bzrlib.bzrdir.BzrDir.create('.')
 
38
            b = bzrdir.BzrDir.create_branch_convenience(url)
 
39
            d = bzrdir.BzrDir.create('.')
40
40
            bzrlib.branch.BranchReferenceFormat().initialize(d, b)
41
41
            d.create_workingtree()
42
42
        else:
57
57
        
58
58
        No files change are included.
59
59
        """
60
 
        tree = BzrDir.create_standalone_workingtree(directory_name)
 
60
        tree = bzrdir.BzrDir.create_standalone_workingtree(directory_name)
61
61
        tree.lock_write()
62
62
        tree.branch.lock_write()
63
63
        tree.branch.repository.lock_write()
82
82
        commit in its revision-history is a merge another commit in the other
83
83
        tree.
84
84
        """
85
 
        tree = BzrDir.create_standalone_workingtree(directory_name)
 
85
        tree = bzrdir.BzrDir.create_standalone_workingtree(directory_name)
86
86
        tree.lock_write()
87
87
        try:
88
88
            tree2 = tree.bzrdir.sprout('tree2').open_workingtree()
118
118
                   'bzrlib.benchmarks.bench_transform',
119
119
                   'bzrlib.benchmarks.bench_workingtree',
120
120
                   ]
121
 
    return TestLoader().loadTestsFromModuleNames(testmod_names)
 
121
    suite = TestLoader().loadTestsFromModuleNames(testmod_names) 
 
122
 
 
123
    # Load any benchmarks from plugins
 
124
    for name, module in plugin.all_plugins().items():
 
125
        if getattr(module, 'bench_suite', None) is not None:
 
126
            suite.addTest(module.bench_suite())
 
127
 
 
128
    return suite