Skip to content
Snippets Groups Projects
Commit 913ecc44eedc authored by Pierre-Yves David's avatar Pierre-Yves David :octopus:
Browse files

benchmark: introduce a mechanism to use modern perf.py from older node

This is very useful when a benchmark are recenty introduced but is compatible
with a larger range of revision.
parent 6cd2159c45cd
No related branches found
No related tags found
No related merge requests found
......@@ -37,6 +37,8 @@
else:
REPOS_DIR = os.path.join(BASEDIR, "repos")
PERFEXTSDIR = os.path.join(BASEDIR, "perfexts")
FORMAT_VARIANT_PREFIX = "repo-format"
......@@ -494,5 +496,32 @@
raise
raise
def _getperfext(self, version):
"""given a mercurial-core node (or None) return a path to perfext
If a mecurial-core node is provided, the path will point to a file with
the perf.py content at that revision.
"""
if version is None:
return os.path.join(self.project_dir, 'contrib', 'perf.py')
filename = 'perf-%s.py' % version
extpath = os.path.join(PERFEXTSDIR, filename)
if not os.path.exists(extpath):
# XXX this is a bit fragile because if anything goes wrong, we create and empty file
with open(extpath, 'wb') as f:
subprocess.check_call(
[ 'hg',
'--cwd',
os.path.join(BASEDIR, 'mercurial'),
'cat',
'--rev',
version,
'contrib/perf.py',
],
stdout=f
)
return extpath
def _perfext(self, command, *args, **kwargs):
"""Use contrib/perf.py extension from mercurial to get data"""
......@@ -497,6 +526,8 @@
def _perfext(self, command, *args, **kwargs):
"""Use contrib/perf.py extension from mercurial to get data"""
perfpath = os.path.join(self.project_dir, 'contrib', 'perf.py')
kwargs = kwargs.copy()
perfextversion = kwargs.pop('perfextversion', None)
perfpath = self._getperfext(perfextversion)
kwargs.setdefault('stderr', subprocess.STDOUT)
try:
return self.safe_hg(
......
directory caching "perf.py" extension at different point of the Mercurial history.
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