Chromium Code Reviews| Index: scripts/slave/recipe_modules/auto_bisect/perf_revision_state.py |
| diff --git a/scripts/slave/recipe_modules/auto_bisect/perf_revision_state.py b/scripts/slave/recipe_modules/auto_bisect/perf_revision_state.py |
| index 695463249b90f4965ab76335668cf0a729048b19..cfd73446597f6247c0a6f291a83e4466b6160fb2 100644 |
| --- a/scripts/slave/recipe_modules/auto_bisect/perf_revision_state.py |
| +++ b/scripts/slave/recipe_modules/auto_bisect/perf_revision_state.py |
| @@ -3,6 +3,7 @@ |
| # found in the LICENSE file. |
| import json |
| +import tempfile |
| import uuid |
| from . import revision_state |
| @@ -16,6 +17,7 @@ class PerfRevisionState(revision_state.RevisionState): |
| self.values = [] |
| self.mean_value = None |
| self.std_err = None |
| + self._test_config = None |
| def test_info(self): |
| """Returns a dictionary with information that describes this test. |
| @@ -45,16 +47,26 @@ class PerfRevisionState(revision_state.RevisionState): |
| else: |
| self.bad = True |
| + def _put_diff_file(self): |
|
qyearsley
2015/02/22 20:37:55
1. This might be improved with a docstring or a di
RobertoCN
2015/02/24 20:01:14
Diff is the name of a tool to find and list differ
|
| + api = self.bisector.api |
| + file_name = tempfile.gettempdir() + build_name + '.diff' |
| + api.file.write('Saving diff patch for ' + self.revision_string, |
| + file_name, self.deps_patch) |
| + return file_name |
| + |
| def _request_build(self): |
| """Posts a request to buildbot to build this revision and archive it.""" |
| # TODO: Rewrite using the trigger module. |
| - # TODO: Send a diff patch when appropriate |
| api = self.bisector.api |
| bot_name = self.bisector.get_builder_bot_for_this_platform() |
| if self.bisector.dummy_builds: |
| self.build_job_name = self.commit_hash + '-build' |
| else: |
| self.build_job_name = uuid.uuid4().hex |
| + if self.needs_patch: |
| + self.patch_file = self._put_diff_file(build_job_name) |
| + else: |
| + self.patch_file = '/dev/null' |
| try_cmd = [ |
| 'try', |
| '--bot=%s' % bot_name, |
| @@ -62,10 +74,17 @@ class PerfRevisionState(revision_state.RevisionState): |
| '--name=%s' % self.build_job_name, |
| '--svn_repo=%s' % api.SVN_REPO_URL, |
| '--diff', |
| - '/dev/null', |
| + self.patch_file, |
| ] |
| - api.m.git(*try_cmd, name='Requesting build for %s via git try.' |
| - % str(self.commit_hash)) |
| + try: |
| + api.m.git(*try_cmd, name='Requesting build for %s via git try.' |
| + % str(self.commit_hash)) |
| + finally: |
| + if self.patch_file != '/dev/null': |
| + try: |
| + api.step('cleaning up patch', 'rm', self.patch_file) |
| + except api.step.StepFailure: |
| + print 'Could not clean up ' + self.patch_file |
| def _get_bisect_config_for_tester(self): |
| """Copies the key-value pairs required by a tester bot to a new dict.""" |