Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
Poulpe
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
octobus
Poulpe
Commits
0e1b6542
Commit
0e1b6542
authored
5 years ago
by
Raphaël Gomès
Browse files
Options
Downloads
Patches
Plain Diff
Create helpers for adding unclean files in the setup phase of a benchmark
parent
4f666dff
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
benchmarks/utils/__init__.py
+48
-0
48 additions, 0 deletions
benchmarks/utils/__init__.py
with
48 additions
and
0 deletions
benchmarks/utils/__init__.py
+
48
−
0
View file @
0e1b6542
...
...
@@ -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
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment