Skip to content
Snippets Groups Projects
Commit 33157c0c authored by Philippe Pepiot's avatar Philippe Pepiot
Browse files

Add clone benchmarks

Using --pull to avoid hardlinks (most frequent use case).
Only benchmark mercurial-2017 repo for now, others are too big and will timeout.
parent 1413a71a
No related branches found
No related tags found
No related merge requests found
......@@ -206,8 +206,7 @@
self._single_execute(cmd, expected_return_code=1 if strip == "same" else 0)
# class CloneTrackSuite(BaseTrackTestSuite):
# param_names = BaseTrackTestSuite.param_names + ['single_rev', 'revset']
# params = BaseTrackTestSuite.params + [[True, False]] + [['default~10']]
class CloneTimeSuite(BaseExchangeTimeSuite):
# skip other repos since they are too big
params = [['mercurial-2017'], ['same'], [None, 'default']]
......@@ -213,9 +212,3 @@
# def track_clone(self, repo_name, single_rev, revset):
# revset = 'default' if single_rev else None
# def clone():
# with self.clone(revset=revset) as (_, clone_time):
# return clone_time
# return self._timeit(clone)
timeout = 300
......@@ -221,6 +214,13 @@
# def _identify_id(self, revset):
# rev = subprocess.check_output([
# self.hgpath, '--cwd', self.repo_path, 'identify', '-i', "-r", revset], env=self.environ)
# return rev.strip()
def setup(self, repo_name, strip, revset):
super(CloneTimeSuite, self).setup(repo_name, strip, revset)
tmpdir = os.path.join(REPOS_DIR, '.tmp')
try:
os.makedirs(tmpdir)
except OSError as exc:
if exc.errno != errno.EEXIST:
raise
self.tmp_clone_path = os.path.join(tmpdir, 'clone-{}'.format(
os.path.basename(self.clone_path)))
shutil.rmtree(self.tmp_clone_path, ignore_errors=True)
......@@ -226,14 +226,10 @@
# @contextlib.contextmanager
# def clone(self, revset=None):
# try:
# clone_path = os.path.join(self.tempdir, 'clone')
# cmd = [self.hgpath, '--cwd', self.repo_path,
# 'clone', '--noupdate', '.', clone_path]
# if revset is not None:
# rev = self._identify_id(revset)
# cmd.extend(['-r', rev])
# clone_time = self._single_execute(cmd)
# yield clone_path, clone_time
# finally:
# shutil.rmtree(clone_path)
def teardown(self, repo_name, strip, revset):
shutil.rmtree(self.tmp_clone_path, ignore_errors=True)
def time_clone(self, repo_name, strip, revset):
cmd = [self.hgpath, 'clone', '--pull', self.clone_path,
self.tmp_clone_path]
if self.rev:
cmd.extend(['-r', self.rev])
self._single_execute(cmd)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment