1
# Copyright (C) 2006 by Canonical Ltd
3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License as published by
5
# the Free Software Foundation; either version 2 of the License, or
6
# (at your option) any later version.
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
# GNU General Public License for more details.
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, write to the Free Software
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
"""Benchmark test suite for bzr."""
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)
45
"""Build and return a TestSuite which contains benchmark tests only."""
47
'bzrlib.benchmarks.bench_add',
48
'bzrlib.benchmarks.bench_checkout',
49
'bzrlib.benchmarks.bench_commit',
50
'bzrlib.benchmarks.bench_status',
52
return TestLoader().loadTestsFromModuleNames(testmod_names)