Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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 from collections import defaultdict | 5 from collections import defaultdict |
| 6 import json | 6 import json |
| 7 | 7 |
| 8 from recipe_engine.config import Dict | 8 from recipe_engine.config import Dict |
| 9 from recipe_engine.config import List | 9 from recipe_engine.config import List |
| 10 from recipe_engine.config import Single | 10 from recipe_engine.config import Single |
| 11 from recipe_engine.recipe_api import Property | 11 from recipe_engine.recipe_api import Property |
| 12 | 12 |
| 13 | 13 |
| 14 DEPS = [ | 14 DEPS = [ |
| 15 'adb', | 15 'adb', |
| 16 'buildbucket', | |
| 16 'depot_tools/bot_update', | 17 'depot_tools/bot_update', |
| 17 'chromium', | 18 'chromium', |
| 18 'chromium_android', | 19 'chromium_android', |
| 19 'chromium_tests', | 20 'chromium_tests', |
| 20 'commit_position', | 21 'commit_position', |
| 21 'findit', | 22 'findit', |
| 22 'depot_tools/gclient', | 23 'depot_tools/gclient', |
| 23 'isolate', | 24 'isolate', |
| 24 'recipe_engine/json', | 25 'recipe_engine/json', |
| 25 'recipe_engine/path', | 26 'recipe_engine/path', |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 38 'target_mastername': Property( | 39 'target_mastername': Property( |
| 39 kind=str, help='The target master to match compile config to.'), | 40 kind=str, help='The target master to match compile config to.'), |
| 40 'target_testername': Property( | 41 'target_testername': Property( |
| 41 kind=str, | 42 kind=str, |
| 42 help='The target tester to match test config to. If the tests are run ' | 43 help='The target tester to match test config to. If the tests are run ' |
| 43 'on a builder, just treat the builder as a tester.'), | 44 'on a builder, just treat the builder as a tester.'), |
| 44 'good_revision': Property( | 45 'good_revision': Property( |
| 45 kind=str, help='The last known good revision.'), | 46 kind=str, help='The last known good revision.'), |
| 46 'bad_revision': Property( | 47 'bad_revision': Property( |
| 47 kind=str, help='The first known good revision.'), | 48 kind=str, help='The first known good revision.'), |
| 48 'tests': Property( | 49 'buildbucket': Property( |
|
stgao
2016/05/20 18:53:46
How about keeping both "tests" and "buildbucket" o
chanli
2016/05/20 21:07:37
Good idea. Done.
| |
| 49 kind=Dict(value_type=list), | 50 help='The buildbucket property in which we can find build id.' |
| 50 help='The failed tests, the test name should be full name, e.g.: {' | 51 'We need to use build id to get tests.'), |
| 51 ' "browser_tests": [' | |
| 52 ' "suite.test1", "suite.test2"' | |
| 53 ' ]' | |
| 54 '}'), | |
| 55 'use_analyze': Property( | 52 'use_analyze': Property( |
| 56 kind=Single(bool, empty_val=False, required=False), default=True, | 53 kind=Single(bool, empty_val=False, required=False), default=True, |
| 57 help='Use analyze to skip commits that do not affect tests.'), | 54 help='Use analyze to skip commits that do not affect tests.'), |
| 58 'suspected_revisions': Property( | 55 'suspected_revisions': Property( |
| 59 kind=List(basestring), default=[], | 56 kind=List(basestring), default=[], |
| 60 help='A list of suspected revisions from heuristic analysis.'), | 57 help='A list of suspected revisions from heuristic analysis.'), |
| 61 } | 58 } |
| 62 | 59 |
| 63 | 60 |
| 64 class TestResult(object): | 61 class TestResult(object): |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 181 if step in failed_tests_dict: | 178 if step in failed_tests_dict: |
| 182 for test in tests: | 179 for test in tests: |
| 183 if test not in failed_tests_dict[step]: | 180 if test not in failed_tests_dict[step]: |
| 184 reduced_dict[step].append(test) | 181 reduced_dict[step].append(test) |
| 185 else: | 182 else: |
| 186 reduced_dict[step].extend(tests) | 183 reduced_dict[step].extend(tests) |
| 187 return reduced_dict | 184 return reduced_dict |
| 188 | 185 |
| 189 | 186 |
| 190 def RunSteps(api, target_mastername, target_testername, good_revision, | 187 def RunSteps(api, target_mastername, target_testername, good_revision, |
| 191 bad_revision, tests, use_analyze, suspected_revisions): | 188 bad_revision, buildbucket, use_analyze, suspected_revisions): |
|
lijeffrey
2016/05/20 20:47:55
nit: rename this buildbucket_data or something sim
chanli
2016/05/20 21:07:37
I'll leave it as is since this property is passed
| |
| 189 | |
| 190 buildbucket_json = json.loads(buildbucket) | |
| 191 build_id = buildbucket_json['build']['id'] | |
| 192 get_build_result = api.buildbucket.get_build(build_id) | |
| 193 tests = json.loads( | |
| 194 get_build_result.stdout['build']['parameters_json']).get( | |
| 195 'additional_parameters', {}).get('tests') | |
|
lijeffrey
2016/05/20 20:47:55
if you rename this to 'build_parameters' like Shuo
chanli
2016/05/20 21:07:38
Done.
| |
| 196 | |
| 192 assert tests, 'No failed tests were specified.' | 197 assert tests, 'No failed tests were specified.' |
| 193 | 198 |
| 194 # Figure out which builder configuration we should match for compile config. | 199 # Figure out which builder configuration we should match for compile config. |
| 195 # Sometimes, the builder itself runs the tests and there is no tester. In | 200 # Sometimes, the builder itself runs the tests and there is no tester. In |
| 196 # such cases, just treat the builder as a "tester". Thus, we default to | 201 # such cases, just treat the builder as a "tester". Thus, we default to |
| 197 # the target tester. | 202 # the target tester. |
| 198 tester_config = api.chromium_tests.builders.get( | 203 tester_config = api.chromium_tests.builders.get( |
| 199 target_mastername).get('builders', {}).get(target_testername) | 204 target_mastername).get('builders', {}).get(target_testername) |
| 200 target_buildername = (tester_config.get('parent_buildername') or | 205 target_buildername = (tester_config.get('parent_buildername') or |
| 201 target_testername) | 206 target_testername) |
| (...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 966 'notice': [ | 971 'notice': [ |
| 967 { | 972 { |
| 968 'infra_status': { | 973 'infra_status': { |
| 969 'ping_status_code': 408, | 974 'ping_status_code': 408, |
| 970 }, | 975 }, |
| 971 }, | 976 }, |
| 972 ], | 977 ], |
| 973 }), | 978 }), |
| 974 retcode=1) | 979 retcode=1) |
| 975 ) | 980 ) |
| OLD | NEW |