Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(283)

Side by Side Diff: scripts/slave/recipe_modules/bot_update/test_api.py

Issue 1151423002: Move recipe engine to third_party/recipe_engine. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: Moved field_composer_test with its buddies Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
6 import struct 7 import struct
8 import sys
9
10 sys.path.append(
11 os.path.dirname( # scripts
12 os.path.dirname( # slave
13 os.path.dirname( # recipe_modules
14 os.path.dirname(__file__))))) # bot_update
7 15
8 from slave import bot_update 16 from slave import bot_update
9 from slave import recipe_test_api 17 from recipe_engine import recipe_test_api
10 18
11 19
12 class BotUpdateTestApi(recipe_test_api.RecipeTestApi): 20 class BotUpdateTestApi(recipe_test_api.RecipeTestApi):
13 def output_json(self, master, builder, slave, root, first_sln, 21 def output_json(self, master, builder, slave, root, first_sln,
14 revision_mapping, git_mode, force=False, fail_patch=False, 22 revision_mapping, git_mode, force=False, fail_patch=False,
15 output_manifest=False): 23 output_manifest=False):
16 """Deterministically synthesize json.output test data for gclient's 24 """Deterministically synthesize json.output test data for gclient's
17 --output-json option. 25 --output-json option.
18 """ 26 """
19 active = bot_update.check_valid_host(master, builder, slave) or force 27 active = bot_update.check_valid_host(master, builder, slave) or force
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 return self.m.json.output(output) 75 return self.m.json.output(output)
68 76
69 @staticmethod 77 @staticmethod
70 def gen_revision(project, GIT_MODE): 78 def gen_revision(project, GIT_MODE):
71 """Hash project to bogus deterministic revision values.""" 79 """Hash project to bogus deterministic revision values."""
72 h = hashlib.sha1(project) 80 h = hashlib.sha1(project)
73 if GIT_MODE: 81 if GIT_MODE:
74 return h.hexdigest() 82 return h.hexdigest()
75 else: 83 else:
76 return struct.unpack('!I', h.digest()[:4])[0] % 300000 84 return struct.unpack('!I', h.digest()[:4])[0] % 300000
OLDNEW
« no previous file with comments | « scripts/slave/recipe_modules/bot_update/resources/__init__.py ('k') | scripts/slave/recipe_modules/buildbot/api.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698