Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 # found in the LICENSE file. | |
| 4 | |
| 5 import json | |
| 6 | |
| 7 DEPS = [ | |
| 8 'auto_bisect', | |
| 9 'path', | |
| 10 'properties', | |
| 11 'raw_io', | |
| 12 ] | |
| 13 | |
| 14 | |
| 15 def GenSteps(api): | |
| 16 # This would ordinarily be done by | |
| 17 # api.chromium_tests.sync_and_configure_build | |
|
qyearsley
2015/02/22 20:37:55
# This would ordinarily be done by
# `api.chromium
RobertoCN
2015/02/24 20:01:14
Yes. Changing the comment to make it more clear.
| |
| 18 fake_checkout_path = api.path.mkdtemp('fake_checkout') | |
| 19 api.path['checkout'] = fake_checkout_path | |
| 20 #Create a bisector | |
|
qyearsley
2015/02/22 20:37:55
Space after "#".
RobertoCN
2015/02/24 20:01:14
Done.
| |
| 21 bisector = api.auto_bisect.create_bisector(api.properties['bisect_config']) | |
| 22 # Request builds | |
| 23 bisector.good_rev.start_job() | |
| 24 bisector.bad_rev.start_job() | |
| 25 # Wait for builds and tests to finish | |
| 26 bisector.wait_for_all([bisector.good_rev, bisector.bad_rev]) | |
| 27 | |
| 28 # TODO(robertocn): Add examples for the following operations | |
| 29 # Check improvement direction | |
| 30 # Check regression confidence | |
| 31 # Get revisions to check | |
| 32 # Check if bisect is finished | |
| 33 # Abort unnecesary jobs | |
| 34 # Print results | |
| 35 | |
| 36 | |
| 37 def GenTests(api): | |
| 38 yield _basic_test(api) | |
| 39 | |
| 40 | |
| 41 def _basic_test(api): | |
| 42 test_data = [ | |
| 43 { | |
| 44 'hash': 'a6298e4afedbf2cd461755ea6f45b0ad64222222', | |
| 45 'commit_pos': '314015', | |
|
qyearsley
2015/02/22 20:37:55
Indentation alignment.
RobertoCN
2015/02/24 20:01:14
Done.
| |
| 46 'test_results': {'results':{ | |
| 47 'mean': 20, | |
| 48 'std_err': 1, | |
| 49 'values': [19, 20, 21], | |
| 50 }} | |
| 51 }, | |
| 52 { | |
| 53 'hash': '00316c9ddfb9d7b4e1ed2fff9fe6d964d2111111', | |
| 54 'commit_pos': '314016', | |
| 55 'test_results': {'results':{ | |
| 56 'mean': 15, | |
| 57 'std_err': 1, | |
| 58 'values': [14, 15, 16], | |
| 59 }} | |
| 60 }, | |
| 61 ] | |
|
qyearsley
2015/02/22 20:37:55
Indentation alignment.
RobertoCN
2015/02/24 20:01:14
Done.
| |
| 62 basic_test = api.test('basic') | |
| 63 for revision_data in test_data: | |
| 64 for step_data in _get_step_data_for_revision(api, revision_data): | |
| 65 basic_test += step_data | |
| 66 basic_test += api.properties(bisect_config=_get_default_config()) | |
| 67 return basic_test | |
| 68 | |
| 69 | |
| 70 def _get_default_config(): | |
| 71 example_config = { | |
| 72 'test_type':'perf', | |
| 73 'command': | |
| 74 ('src/tools/perf/run_benchmark -v --browser=release smoothness.' | |
|
qyearsley
2015/02/22 20:37:55
Indent 4 spaces.
RobertoCN
2015/02/24 20:01:14
Done.
| |
| 75 'tough_scrolling_cases'), | |
| 76 'good_revision': '314015', | |
| 77 'bad_revision': '314016', | |
| 78 'metric': 'mean_input_event_latency/mean_input_event_latency', | |
| 79 'repeat_count': '2', | |
| 80 'max_time_minutes': '5', | |
| 81 'truncate_percent': '0', | |
| 82 'bug_id': '', | |
| 83 'gs_bucket': 'chrome-perf', | |
| 84 'builder_host': 'master4.golo.chromium.org', | |
| 85 'builder_port': '8341', | |
| 86 'dummy_builds': 'True', | |
| 87 } | |
| 88 return example_config | |
| 89 | |
| 90 | |
| 91 def _get_step_data_for_revision(api, revision_data, include_build_steps=True): | |
| 92 """Generator that produces step patches for fake results.""" | |
| 93 commit_pos = revision_data['commit_pos'] | |
| 94 commit_hash = revision_data['hash'] | |
| 95 test_results = revision_data['test_results'] | |
| 96 | |
| 97 step_name ='resolving commit_pos ' + commit_pos | |
| 98 yield api.step_data(step_name, stdout=api.raw_io.output('hash:' + | |
| 99 commit_hash)) | |
| 100 | |
| 101 step_name ='resolving hash ' + commit_hash | |
| 102 commit_pos_str = 'refs/heads/master@{#%s}' % commit_pos | |
| 103 yield api.step_data(step_name, stdout=api.raw_io.output(commit_pos_str)) | |
| 104 | |
| 105 if include_build_steps: | |
| 106 step_name ='gsutil Get test results for build ' + commit_hash | |
| 107 yield api.step_data(step_name, stdout=api.raw_io.output(json.dumps( | |
| 108 test_results))) | |
| 109 | |
| 110 step_name = 'Get test status for build ' + commit_hash | |
| 111 yield api.step_data(step_name, stdout=api.raw_io.output('Complete')) | |
| 112 | |
| 113 step_name ='gsutil Get test status url for build ' + commit_hash | |
| 114 yield api.step_data(step_name, stdout=api.raw_io.output('dummy/url')) | |
| 115 | |
| OLD | NEW |