| OLD | NEW |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 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 copy | 5 import copy |
| 6 import logging | 6 import logging |
| 7 import time | 7 import time |
| 8 | 8 |
| 9 from common.http_client_appengine import HttpClientAppengine as HttpClient | 9 from common.http_client_appengine import HttpClientAppengine as HttpClient |
| 10 from common.pipeline_wrapper import BasePipeline | 10 from common.pipeline_wrapper import BasePipeline |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 # Make a copy of the referred request and drop or overwrite some fields. | 33 # Make a copy of the referred request and drop or overwrite some fields. |
| 34 new_request = copy.deepcopy(ref_request) | 34 new_request = copy.deepcopy(ref_request) |
| 35 new_request.name = self._GetSwarmingTaskName(ref_task_id) | 35 new_request.name = self._GetSwarmingTaskName(ref_task_id) |
| 36 new_request.parent_task_id = '' | 36 new_request.parent_task_id = '' |
| 37 new_request.user = '' | 37 new_request.user = '' |
| 38 | 38 |
| 39 # To force a fresh re-run and ignore cached result of any equivalent run. | 39 # To force a fresh re-run and ignore cached result of any equivalent run. |
| 40 new_request.idempotent = False | 40 new_request.idempotent = False |
| 41 | 41 |
| 42 # Set the gtest_filter to run the given tests only. | 42 # Set the gtest_filter to run the given tests only. |
| 43 # Remove existing test filter first. |
| 44 new_request.extra_args = [ |
| 45 a for a in new_request.extra_args if ( |
| 46 not a.startswith('--gtest_filter') and |
| 47 not a.startswith('--test-launcher-filter-file')) |
| 48 ] |
| 49 new_request.extra_args.append('--gtest_filter=%s' % ':'.join(tests)) |
| 43 new_request.extra_args.append('--gtest_repeat=%s' % iterations) | 50 new_request.extra_args.append('--gtest_repeat=%s' % iterations) |
| 44 new_request.extra_args.append('--test-launcher-retry-limit=0') | 51 new_request.extra_args.append('--test-launcher-retry-limit=0') |
| 45 new_request.extra_args = [ | 52 |
| 46 a for a in new_request.extra_args if not a.startswith('--gtest_filter') | 53 # Also rerun disabled tests. Scenario: the test was disabled before Findit |
| 47 ] | 54 # runs any analysis. One possible case: |
| 48 new_request.extra_args.append('--gtest_filter=%s' % ':'.join(tests)) | 55 # 1. A gtest became flaky on CQ, but Findit was not automatically |
| 56 # triggered to run any analysis because: |
| 57 # * the test is not flaky enough |
| 58 # * chromium-try-flakes has filed/updated too many bugs |
| 59 # 2. The test got disabled, but no culprit was identified. |
| 60 # 3. Some developer starts the investigation and requests Findit to |
| 61 # analyze the flaky test. |
| 62 # 4. Findit picks the latest Waterfall build of the matching configuration |
| 63 # for the CQ build in which the flaky test is found. |
| 64 # 5. In the picked Waterfall build, the test is already disabled. |
| 65 new_request.extra_args.append('--gtest_also_run_disabled_tests') |
| 49 | 66 |
| 50 # Remove the env setting for sharding. | 67 # Remove the env setting for sharding. |
| 51 sharding_settings = ['GTEST_SHARD_INDEX', 'GTEST_TOTAL_SHARDS'] | 68 sharding_settings = ['GTEST_SHARD_INDEX', 'GTEST_TOTAL_SHARDS'] |
| 52 new_request.env = [ | 69 new_request.env = [ |
| 53 e for e in new_request.env if e['key'] not in sharding_settings | 70 e for e in new_request.env if e['key'] not in sharding_settings |
| 54 ] | 71 ] |
| 55 | 72 |
| 56 # Reset tags for searching and monitoring. | 73 # Reset tags for searching and monitoring. |
| 57 ref_name = swarming_util.GetTagValue(ref_request.tags, 'name') | 74 ref_name = swarming_util.GetTagValue(ref_request.tags, 'name') |
| 58 new_request.tags = [] | 75 new_request.tags = [] |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 swarming_task.error = error | 203 swarming_task.error = error |
| 187 else: | 204 else: |
| 188 logging.info('A Swarming task was triggered:%s', task_id) | 205 logging.info('A Swarming task was triggered:%s', task_id) |
| 189 | 206 |
| 190 swarming_task.put() | 207 swarming_task.put() |
| 191 | 208 |
| 192 # Call the hook function after the task is triggered. | 209 # Call the hook function after the task is triggered. |
| 193 self._OnTaskTriggered() | 210 self._OnTaskTriggered() |
| 194 | 211 |
| 195 return task_id | 212 return task_id |
| OLD | NEW |