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

Skip http benchmarks for broken revision of hgweb

hgweb is broken on some revisions of mercurial (see https://bz.mercurial-scm.org/show_bug.cgi?id=5851).
Skip http benchmark on such revisions to avoid long timeouts and hgweb process leak.

Add a 'skip' key to config.yaml with known broken revisions for given feature,
compile all revisions in repos/skip.json and use it in the benchmark code to
decide of current revision should be skipped or not.

Use asv way to skip tests in setup() and raise NotImplementedError in such cases.

$ asv run --bench time_push --show-stderr --no-pull 4.6rc0
================ =========== =================== ============ ============
--                                                         revset
------------------------------------------------ -------------------------
      repo        repo_type         strip            None       default
================ =========== =================== ============ ============
 mercurial-2017     local            same          98.9±1ms     102±1ms
 mercurial-2017     local      last(all(), 10)     127±1ms      139±10ms
 mercurial-2017     local      last(all(), 100)    190±3ms      212±2ms
 mercurial-2017     local     last(all(), 1000)    823±20ms     839±7ms
 mercurial-2017      ssh             same          325±7ms      333±10ms
 mercurial-2017      ssh       last(all(), 10)     405±30ms     383±9ms
 mercurial-2017      ssh       last(all(), 100)    468±30ms     495±20ms
 mercurial-2017      ssh      last(all(), 1000)   1.27±0.05s   1.26±0.02s
 mercurial-2017      http            same            n/a          n/a
 mercurial-2017      http      last(all(), 10)       n/a          n/a
 mercurial-2017      http      last(all(), 100)      n/a          n/a
 mercurial-2017      http     last(all(), 1000)      n/a          n/a
================ =========== =================== ============ ============
parent 8fb54719f987
No related branches found
No related tags found
No related merge requests found
......@@ -255,6 +255,9 @@
def setup(self, repo_name, repo_type, strip, revset):
super(BaseExchangeTimeSuite, self).setup(repo_name)
self._hgserve = None
if repo_type == 'http' and self.get_asv_rev() in self.get_skip()['hgweb']:
raise NotImplementedError
self.clone_path = os.path.join(REPOS_DIR, '.cache', 'partial-{}-{}'.format(
repo_name, base64.b64encode(strip)))
if revset is not None:
......@@ -268,8 +271,6 @@
if repo_type == 'http':
self._hgserve = HgWeb()
self.hgport = self._hgserve.start(self.hgpath, self.environ)
else:
self._hgserve = None
def teardown(self, *args, **kwargs):
if self._hgserve is not None:
......
from __future__ import print_function
import json
import os
import os.path
import re
......@@ -160,6 +161,18 @@
params = [REPOS]
param_names = ["repo"]
@staticmethod
def get_skip():
with open(os.path.join(REPOS_DIR, 'skip.json'), 'r') as f:
return json.load(f)
def get_asv_rev(self):
'''Return currently benchmarked mercurial revision'''
return subprocess.check_output([
self.hgpath, 'log', '--cwd', self.project_dir,
'-T', '{node|short}', '-r', '.'],
env=self.environ).strip()
def setup(self, repo_name, *args, **kwargs):
venv = os.path.abspath(os.path.join(os.path.dirname(sys.executable), ".."))
self.repo_name = repo_name
......@@ -163,8 +176,9 @@
def setup(self, repo_name, *args, **kwargs):
venv = os.path.abspath(os.path.join(os.path.dirname(sys.executable), ".."))
self.repo_name = repo_name
if os.path.isdir(os.path.join(venv, "project")):
self.project_dir = os.path.join(venv, 'project')
if os.path.isdir(self.project_dir):
# use hg in virtualenv for "asv run"
self.hgpath = os.path.join(venv, "bin", "hg")
else:
# use local hg for "asv dev"
......@@ -167,9 +181,10 @@
# use hg in virtualenv for "asv run"
self.hgpath = os.path.join(venv, "bin", "hg")
else:
# use local hg for "asv dev"
sys.path.insert(0, os.path.join(BASEDIR, 'mercurial'))
self.hgpath = os.path.join(os.path.join(BASEDIR, 'mercurial', 'hg'))
self.project_dir = os.path.join(BASEDIR, 'mercurial')
sys.path.insert(0, self.project_dir)
self.hgpath = os.path.join(os.path.join(self.project_dir, 'hg'))
self.repo_path = os.path.join(REPOS_DIR, self.repo_name)
# Use a clean environ to run command
......
......@@ -7,3 +7,11 @@
url: https://hg.mozilla.org/mozilla-central
netbeans-2017:
url: http://hg.netbeans.org/main
# a dict of "skipped" benchmarks for features known to be broken for some
# revisions
skip:
hgweb:
# https://bz.mercurial-scm.org/show_bug.cgi?id=5851
# long timeout and process leak
- 'f0a851542a05::877185de62^'
......@@ -3,6 +3,7 @@
import base64
import errno
import hglib
import json
import os
import subprocess
from os.path import isdir, join
......@@ -45,5 +46,20 @@
subprocess.check_call(['hg', '--cwd', partialdir, 'debugupdatecache'])
def generate_skip_file(config):
skip = {}
for key, revsets in config['skip'].items():
skiprev = set()
for revset in revsets:
for rev in subprocess.check_output([
'hg', 'log', '--cwd', 'mercurial',
'-r', revset, '-T', '{node|short}\n',
]).splitlines():
skiprev.add(rev)
skip[key] = list(skiprev)
with open(os.path.join('repos', 'skip.json'), 'w') as f:
json.dump(skip, f)
config = read_configuration("config.yaml")
clone_repositories(config, "repos")
......@@ -48,2 +64,3 @@
config = read_configuration("config.yaml")
clone_repositories(config, "repos")
skip = generate_skip_file(config)
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