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 base64
import contextlib import contextlib
import errno
import os import os
import os.path import os.path
import time import time
...@@ -137,5 +138,6 @@ ...@@ -137,5 +138,6 @@
def time_bundle(self, repo, n): def time_bundle(self, repo, n):
self._execute("bundle", "--base", ":(-%d)" % (n+1), "/tmp/bundle.bundle") self._execute("bundle", "--base", ":(-%d)" % (n+1), "/tmp/bundle.bundle")
class ExchangeTimeSuite(BaseTimeTestSuite):
class BaseExchangeTimeSuite(BaseTimeTestSuite):
param_names = BaseTimeTestSuite.param_names + ['strip', 'revset'] param_names = BaseTimeTestSuite.param_names + ['strip', 'revset']
...@@ -141,6 +143,6 @@ ...@@ -141,6 +143,6 @@
param_names = BaseTimeTestSuite.param_names + ['strip', 'revset'] 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): def setup(self, repo_name, strip, revset):
self.timer = timeit.default_timer self.timer = timeit.default_timer
self.sample_time = 10 self.sample_time = 10
...@@ -143,8 +145,8 @@ ...@@ -143,8 +145,8 @@
def setup(self, repo_name, strip, revset): def setup(self, repo_name, strip, revset):
self.timer = timeit.default_timer self.timer = timeit.default_timer
self.sample_time = 10 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( self.clone_path = os.path.join(REPOS_DIR, '.cache', 'partial-{}-{}'.format(
repo_name, base64.b64encode(strip))) repo_name, base64.b64encode(strip)))
if revset is not None: if revset is not None:
...@@ -154,6 +156,9 @@ ...@@ -154,6 +156,9 @@
else: else:
self.rev = None self.rev = None
class ExchangeTimeSuite(BaseExchangeTimeSuite):
def time_incoming(self, repo_name, strip, revset): def time_incoming(self, repo_name, strip, revset):
cmd = [self.hgpath, '--cwd', self.clone_path, 'incoming', self.repo_path] cmd = [self.hgpath, '--cwd', self.clone_path, 'incoming', self.repo_path]
if self.rev: if self.rev:
...@@ -166,15 +171,32 @@ ...@@ -166,15 +171,32 @@
cmd.extend(['-r', self.rev]) cmd.extend(['-r', self.rev])
self._single_execute(cmd) self._single_execute(cmd)
# def track_push(self, *args, **kwargs):
# def clone_and_push(): class PushPullTimeSuite(BaseExchangeTimeSuite):
# with self.clone_from_cache() as clone_path:
# cmd = [self.hgpath, '--cwd', self.repo_path, 'push', '-f', timeout = 300
# clone_path]
# if self.revset: def setup(self, repo_name, strip, revset):
# cmd.extend(['-r', 'default']) super(PushPullTimeSuite, self).setup(repo_name, strip, revset)
# return self._single_execute(cmd, False) tmpdir = os.path.join(REPOS_DIR, '.tmp')
# return self._timeit(clone_and_push) 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): # 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