| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import hashlib | 5 import hashlib |
| 6 import os | |
| 7 import struct | 6 import struct |
| 8 import sys | |
| 9 from recipe_engine import recipe_test_api | 7 from recipe_engine import recipe_test_api |
| 10 | 8 |
| 11 | 9 |
| 12 class BotUpdateTestApi(recipe_test_api.RecipeTestApi): | 10 class BotUpdateTestApi(recipe_test_api.RecipeTestApi): |
| 13 def output_json(self, master, builder, slave, root, first_sln, | 11 def output_json(self, root, first_sln, revision_mapping, fail_patch=False, |
| 14 revision_mapping, fail_patch=False, | |
| 15 output_manifest=False, fixed_revisions=None): | 12 output_manifest=False, fixed_revisions=None): |
| 16 """Deterministically synthesize json.output test data for gclient's | 13 """Deterministically synthesize json.output test data for gclient's |
| 17 --output-json option. | 14 --output-json option. |
| 18 """ | 15 """ |
| 19 output = { | 16 output = { |
| 20 'did_run': True, | 17 'did_run': True, |
| 21 'patch_failure': False | 18 'patch_failure': False |
| 22 } | 19 } |
| 23 | 20 |
| 24 properties = { | 21 properties = { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 def gen_revision(project): | 61 def gen_revision(project): |
| 65 """Hash project to bogus deterministic git hash values.""" | 62 """Hash project to bogus deterministic git hash values.""" |
| 66 h = hashlib.sha1(project) | 63 h = hashlib.sha1(project) |
| 67 return h.hexdigest() | 64 return h.hexdigest() |
| 68 | 65 |
| 69 @staticmethod | 66 @staticmethod |
| 70 def gen_commit_position(project): | 67 def gen_commit_position(project): |
| 71 """Hash project to bogus deterministic Cr-Commit-Position values.""" | 68 """Hash project to bogus deterministic Cr-Commit-Position values.""" |
| 72 h = hashlib.sha1(project) | 69 h = hashlib.sha1(project) |
| 73 return struct.unpack('!I', h.digest()[:4])[0] % 300000 | 70 return struct.unpack('!I', h.digest()[:4])[0] % 300000 |
| OLD | NEW |