# HG changeset patch # User Pierre-Yves David <pierre-yves.david@octobus.net> # Date 1556453626 -7200 # Sun Apr 28 14:13:46 2019 +0200 # Node ID 631ac20986344c4736551919a5b1494fd452147d # Parent 4998bff404541941fa0df3a4bb6c48f4f098cbef benchmark: migrate discovery benchmarks to roles The existing discovery test are now using the new roles information. To keep the compatibility witht he older class structure. We are using the `benchmark_name` feature to keep the same name. We'll probably want to use the very same feature to rename all test later into something more sensible. However, as a side effect, this means we are dropping the "same" variant of the subset/super set test. So ASV will be confused by the params value change... <sigh>. Important note: for this discovery to work, benchmark now needs to be have an upgraded reference. diff --git a/benchmarks/basic_commands.py b/benchmarks/basic_commands.py --- a/benchmarks/basic_commands.py +++ b/benchmarks/basic_commands.py @@ -370,28 +370,43 @@ ) -class DiscoveryTimeSuite(BaseExchangeTimeSuite): +class BaseDiscoveryTimeSuite(BaseExchangeTimeSuite): # debugdiscovery does not support revset argument params = BaseTestSuite.params + [ ['local', 'ssh', 'http'], STRIP_VARIANTS_LIST, [None]] + def _track_discovery(self, *args, **kwargs): + data = self.role_data.get(kwargs['strip'], {}) + data = data.get(self.repo_name) + if data is None: + raise NotImplementedError("no roles data for this partials' key") + source = self.repo_path_from_id(data['source']) + target = self.repo_path_from_id(data['target']) + return self.perfext('perfdiscovery', '--repository', source, target) + +@setup_role +class DiscoverySubsetTimeSuite(BaseDiscoveryTimeSuite): + role_action = 'discovery' + role_subtype = 'subset' + @params_as_kwargs @not_broken_hgweb def track_discovery_subset(self, *args, **kwargs): - """Local repository is a subset of remote.""" - # self.hg() passes self.repo_path through --cwd, we override - # that with -R - return self.perfext('perfdiscovery', - '--repository', self.clone_path, - self.repo_path) + return self._track_discovery(self, *args, **kwargs) + track_discovery_subset.benchmark_name = 'basic_commands.DiscoveryTimeSuite.track_discovery_subset' + +@setup_role +class DiscoverySupersetTimeSuite(BaseDiscoveryTimeSuite): + role_action = 'discovery' + role_subtype = 'superset' @params_as_kwargs @not_broken_hgweb def track_discovery_superset(self, *args, **kwargs): - """Local repository is a superset of remote.""" - return self.perfext('perfdiscovery', self.clone_path) + return self._track_discovery(self, *args, **kwargs) + track_discovery_superset.benchmark_name = 'basic_commands.DiscoveryTimeSuite.track_discovery_superset' class UnbundleTimeSuite(BaseExchangeTimeSuite):