Skip to content
Snippets Groups Projects
Commit 0e1b6542 authored by Raphaël Gomès's avatar Raphaël Gomès
Browse files

Create helpers for adding unclean files in the setup phase of a benchmark

parent 4f666dff
No related branches found
No related tags found
No related merge requests found
......@@ -280,6 +280,32 @@
return worker_wrapper
def add_ignored_files(f):
"""
During the setup phase of the decorated benchmark, extracts a tarball of
ignored files made for this repository to fake a dirty working directory.
"""
@functools.wraps(f)
def wrapper(self, *args, **kwargs):
self.add_unclean_files('ignored', self.repo_name, self.repo_path)
return f(self, *args, **kwargs)
return wrapper
def add_unknown_files(f):
"""
During the setup phase of the decorated benchmark, extracts a tarball of
unknown files made for this repository to fake a dirty working directory.
"""
@functools.wraps(f)
def wrapper(self, *args, **kwargs):
self.add_unclean_files('unknown', self.repo_name, self.repo_path)
return f(self, *args, **kwargs)
return wrapper
def not_compatible_with(revset, filter_fn=None):
"""Specifies the revset wherein the command is NOT expected to work.
......@@ -834,6 +860,28 @@
# in subclasses to mirror super().setup().
pass
def add_unclean_files(self, kind, repo_name, root):
tarballs = TARBALLS_OF_UNCLEANS[repo_name]
tarball_name = tarballs.get(kind)
if tarball_name is None:
# there may not be a tarball yet, just return
return
tarball = os.path.join(REPOS_DIR,
'uncleans-tarballs',
tarball_name)
with open(self.need_update_marker_path, "w"):
pass
try:
subprocess.check_call(
["tar", "xf", tarball, '-C', root]
)
except subprocess.CalledProcessError:
msg = "Extracting failed for `%s` tarball (`%s`) for repo `%s`"
raise RuntimeError(msg % (kind, tarball, repo_name))
class BaseNChangesetsTestSuite(BaseTestSuite):
......
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