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

branching: merge with other head

No related branches found
No related tags found
No related merge requests found
......@@ -16,8 +16,13 @@
import urllib
import pipes
from .utils import (BaseNChangesetsTestSuite, BaseTestSuite,
median, REPOS_DIR)
from .utils import (
BaseNChangesetsTestSuite,
BaseTestSuite,
params_as_kwargs,
median,
REPOS_DIR
)
if sys.version_info[0] == 2:
import Queue as queue
......@@ -40,5 +45,9 @@
timeout = 120
def track_commit(self, *args, **kwargs):
params = BaseTestSuite.params + [("create", "update")]
param_names = BaseTestSuite.param_names + ["mode"]
@params_as_kwargs
def track_commit(self, mode, **kwargs):
timings = []
......@@ -44,2 +53,3 @@
timings = []
filename = None
......@@ -45,5 +55,12 @@
with open(os.path.join(self.repo_path, 'BABAR'), 'w') as f:
f.write("BABAR")
self.hg('status')
if mode == 'create':
with open(os.path.join(self.repo_path, 'BABAR'), 'w') as f:
f.write("BABAR")
else:
# pick filename to update
filename = self.hg('manifest').partition('\n')[0]
filename = os.path.join(self.repo_path, filename)
# Do the commits N time
......@@ -48,4 +65,4 @@
# Do the commits N time
for i in range(3):
for i in range(10):
try:
......@@ -51,2 +68,9 @@
try:
if mode == 'update':
with open(filename, 'a') as target:
target.write(
'The quick brown fox jumps over the lazy dog\n')
else:
self.hg('add', 'BABAR')
before = time.time()
......@@ -52,8 +76,8 @@
before = time.time()
self.hg('commit', '-A', '-m', 'My commit message',
self.hg('commit', '-m', 'My commit message',
'-u', '<test@octobus.net>')
after = time.time()
timings.append(after - before)
finally:
# Rollback and clean
self.hg('rollback', '--config', 'ui.rollback=true')
......@@ -54,9 +78,10 @@
'-u', '<test@octobus.net>')
after = time.time()
timings.append(after - before)
finally:
# Rollback and clean
self.hg('rollback', '--config', 'ui.rollback=true')
self.hg('debugupdatecache')
self.hg('update', '-C', '.')
return median(timings)
......
from __future__ import print_function
import json
import functools
import os
import os.path
import re
......@@ -115,6 +116,22 @@
return sum(sorted(lst)[quotient - 1:quotient + 1]) / 2.
def params_as_kwargs(f):
"""Pass in test parameters as keyword arguments.
Use as a decorator on BaseTestSuite methods
"""
@functools.wraps(f)
def wrapper(self, *args, **kwargs):
names = self.param_names
args, values = args[len(names):], args[:len(names)]
kwargs.update(zip(names, values))
return f(self, *args, **kwargs)
return wrapper
class BaseTestSuite(object):
params = [REPOS]
......
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