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

Reimplement push benchmark using clone of partial clone and rsync

Implement a new base benchmark class that is shared with incoming/outgoing benchmarks.

push benchmark use rsync with hardlinks to "reset" the clone of the partial clone at each repeat.

Use a timeout of 300 which is enough for me on mozilla repo.
parent aba709289ed3
No related branches found
No related tags found
No related merge requests found
import base64
import contextlib
import errno
import os
import os.path
import time
......@@ -137,5 +138,6 @@
def time_bundle(self, repo, n):
self._execute("bundle", "--base", ":(-%d)" % (n+1), "/tmp/bundle.bundle")
class ExchangeTimeSuite(BaseTimeTestSuite):
class BaseExchangeTimeSuite(BaseTimeTestSuite):
param_names = BaseTimeTestSuite.param_names + ['strip', 'revset']
......@@ -141,6 +143,6 @@
param_names = BaseTimeTestSuite.param_names + ['strip', 'revset']
params = BaseTrackTestSuite.params + [['last(all(), 10)'], [None, 'default']]
params = BaseTrackTestSuite.params + [['last(all(), 10)']] + [[None, 'default']]
def setup(self, repo_name, strip, revset):
self.timer = timeit.default_timer
self.sample_time = 10
......@@ -143,8 +145,8 @@
def setup(self, repo_name, strip, revset):
self.timer = timeit.default_timer
self.sample_time = 10
super(ExchangeTimeSuite, self).setup(repo_name, revset)
super(BaseExchangeTimeSuite, self).setup(repo_name)
self.clone_path = os.path.join(REPOS_DIR, '.cache', 'partial-{}-{}'.format(
repo_name, base64.b64encode(strip)))
if revset is not None:
......@@ -154,6 +156,9 @@
else:
self.rev = None
class ExchangeTimeSuite(BaseExchangeTimeSuite):
def time_incoming(self, repo_name, strip, revset):
cmd = [self.hgpath, '--cwd', self.clone_path, 'incoming', self.repo_path]
if self.rev:
......@@ -166,15 +171,32 @@
cmd.extend(['-r', self.rev])
self._single_execute(cmd)
# def track_push(self, *args, **kwargs):
# def clone_and_push():
# with self.clone_from_cache() as clone_path:
# cmd = [self.hgpath, '--cwd', self.repo_path, 'push', '-f',
# clone_path]
# if self.revset:
# cmd.extend(['-r', 'default'])
# return self._single_execute(cmd, False)
# return self._timeit(clone_and_push)
class PushPullTimeSuite(BaseExchangeTimeSuite):
timeout = 300
def setup(self, repo_name, strip, revset):
super(PushPullTimeSuite, 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)))
# XXX: This should be deleted at the end but teardown, like setup, is
# called for each repeat...
self._single_execute(['rsync', '-aH', '--delete', '{}/'.format(self.clone_path),
self.tmp_clone_path])
def time_push(self, repo_name, strip, revset):
cmd = [self.hgpath, '--cwd', self.repo_path, 'push', '-f',
self.tmp_clone_path]
if self.rev:
cmd.extend(['-r', self.rev])
self._single_execute(cmd)
# class CloneTrackSuite(BaseTrackTestSuite):
......
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