~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/benchmarks/__init__.py

  • Committer: Martin Pool
  • Date: 2006-06-20 05:32:16 UTC
  • mfrom: (1797 +trunk)
  • mto: This revision was merged to the branch mainline in revision 1798.
  • Revision ID: mbp@sourcefrog.net-20060620053216-817857d7ca3e9d1f
[merge] bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 
20
20
import bzrlib
21
21
from bzrlib.tests.TestUtil import TestLoader
 
22
from bzrlib.bzrdir import BzrDir
22
23
from bzrlib.tests.blackbox import ExternalBase
23
24
 
24
25
class Benchmark(ExternalBase):
51
52
                    files.extend([prefix + str(foo) for foo in range(20)])
52
53
        self.build_tree(files)
53
54
 
 
55
    def make_many_commit_tree(self, directory_name='.'):
 
56
        """Create a tree with an egregious number of commits.
 
57
        
 
58
        No files change are included.
 
59
        """
 
60
        tree = BzrDir.create_standalone_workingtree(directory_name)
 
61
        tree.lock_write()
 
62
        tree.branch.lock_write()
 
63
        tree.branch.repository.lock_write()
 
64
        try:
 
65
            for i in xrange(1000):
 
66
                tree.commit('no-changes commit %d' % i)
 
67
        finally:
 
68
            try:
 
69
                try:
 
70
                    tree.branch.repository.unlock()
 
71
                finally:
 
72
                    tree.branch.unlock()
 
73
            finally:
 
74
                tree.unlock()
 
75
        return tree
 
76
 
54
77
 
55
78
def test_suite():
56
79
    """Build and return a TestSuite which contains benchmark tests only."""
60
83
                   'bzrlib.benchmarks.bench_checkout',
61
84
                   'bzrlib.benchmarks.bench_commit',
62
85
                   'bzrlib.benchmarks.bench_inventory',
 
86
                   'bzrlib.benchmarks.bench_log',
63
87
                   'bzrlib.benchmarks.bench_osutils',
64
88
                   'bzrlib.benchmarks.bench_rocks',
65
89
                   'bzrlib.benchmarks.bench_status',