Index: scripts/slave/recipe_modules/auto_bisect/old_example.old |
diff --git a/scripts/slave/recipe_modules/auto_bisect/example.py b/scripts/slave/recipe_modules/auto_bisect/old_example.old |
similarity index 85% |
copy from scripts/slave/recipe_modules/auto_bisect/example.py |
copy to scripts/slave/recipe_modules/auto_bisect/old_example.old |
index 2619129328674d1238b073aa7d110952b3c82079..cf239531d267beeaf3acaa31af2538f0e1f33761 100644 |
--- a/scripts/slave/recipe_modules/auto_bisect/example.py |
+++ b/scripts/slave/recipe_modules/auto_bisect/old_example.old |
@@ -7,6 +7,7 @@ import json |
DEPS = [ |
'auto_bisect', |
'chromium_tests', |
+ 'depot_tools/gclient', |
'recipe_engine/json', |
'recipe_engine/path', |
'recipe_engine/properties', |
@@ -21,24 +22,35 @@ For more information about recipes, see: https://goo.gl/xKnjz6 |
def RunSteps(api): |
+ mastername = api.properties.get('mastername') |
+ buildername = api.properties.get('buildername') |
+ bot_config = api.chromium_tests.create_bot_config_object(mastername, |
+ buildername) |
+ api.chromium_tests.configure_build(bot_config) |
+ api.gclient.apply_config('perf') |
+ update_step, bot_db = api.chromium_tests.prepare_checkout(bot_config) |
+ |
+ api.auto_bisect.bot_db = bot_db |
+ |
fake_checkout_path = api.path.mkdtemp('fake_checkout') |
api.path['checkout'] = fake_checkout_path |
+ api.path.c.dynamic_paths['catapult'] = api.path['slave_build'].join( |
+ 'catapult') |
bisector = api.auto_bisect.create_bisector(api.properties['bisect_config'], |
do_not_nest_wait_for_revision=True) |
- # Request builds and tests for initial range and wait. |
bisector.good_rev.start_job() |
- bisector.bad_rev.start_job() |
- bisector.wait_for_all([bisector.good_rev, bisector.bad_rev]) |
+ if bisector.good_rev.failed: |
+ return |
- if bisector.good_rev.failed or bisector.bad_rev.failed: |
+ bisector.bad_rev.start_job() |
+ if bisector.bad_rev.failed: |
return |
assert bisector.check_improvement_direction() |
assert bisector.check_initial_confidence() |
revision_to_check = bisector.get_revision_to_eval() |
revision_to_check.start_job() |
- bisector.wait_for(revision_to_check) |
bisector.check_bisect_finished(revision_to_check) |
# Evaluate inserted DEPS-modified revisions. |
@@ -65,6 +77,7 @@ def RunSteps(api): |
bot_config = api.chromium_tests.create_bot_config_object( |
mastername, buildername) |
api.chromium_tests.configure_build(bot_config) |
+ api.gclient.c.got_revision_mapping.pop('catapult', None) |
api.chromium_tests.prepare_checkout(bot_config) |
kwargs = { |
'extra_src': 'dummy_extra_src', |
@@ -76,40 +89,24 @@ def RunSteps(api): |
def GenTests(api): |
dummy_gs_location = ('gs://chrome-perf/bisect-results/' |
'a6298e4afedbf2cd461755ea6f45b0ad64222222-test.results') |
+ bisect_script_test = _make_test( |
+ api, _get_basic_test_data(), 'basic_bisect_script') |
+ |
+ bisect_script_test += api.properties(mastername='tryserver.chromium.perf', |
+ buildername='linux_perf_bisect', |
+ slavename='dummyslave') |
+ yield bisect_script_test |
+ |
basic_test = _make_test(api, _get_basic_test_data(), 'basic') |
yield basic_test |
+ yield _make_test(api, _get_reversed_basic_test_data(), 'reversed_basic') |
+ |
invalid_config_test = api.test('invalid_config') |
invalid_config_test += api.properties( |
bisect_config=_get_config({'good_revision': 'not a valid revision'})) |
yield invalid_config_test |
- failed_build_test = _make_test( |
- api, _get_ref_range_only_test_data(), 'failed_build_test', |
- extra_config={'dummy_builds': None}) |
- failed_build_test += api.step_data('gsutil ls', retcode=1) |
- failed_build_test += api.step_data('gsutil ls (2)' , retcode=1) |
- failed_build_test += api.step_data('gsutil ls (3)' , retcode=1) |
- failed_build_test += api.step_data( |
- 'buildbucket.get', stdout=api.json.output( |
- {'build':{'status': 'COMPLETE', 'result': 'FAILED'}})) |
- yield failed_build_test |
- |
- |
- delayed_build_test = _make_test( |
- api, _get_ref_range_only_test_data(), 'delayed_build_test', |
- extra_config={'dummy_builds': None}) |
- delayed_build_test += api.step_data('gsutil ls', retcode=1) |
- delayed_build_test += api.step_data('gsutil ls (2)', retcode=1) |
- delayed_build_test += api.step_data('gsutil ls (3)', retcode=1) |
- delayed_build_test += api.step_data('gsutil ls (4)', retcode=1) |
- delayed_build_test += api.step_data('gsutil ls (5)', retcode=1) |
- delayed_build_test += api.step_data('gsutil ls (6)', retcode=1) |
- delayed_build_test += api.step_data( |
- 'buildbucket.get', stdout=api.json.output( |
- {'build':{'status': 'PENDING'}})) |
- yield delayed_build_test |
- |
missing_metric_test = _make_test( |
api, _get_ref_range_only_missing_metric_test_data(), |
'missing_metric_test') |
@@ -146,15 +143,56 @@ def GenTests(api): |
failed_data[0].pop('cl_info') |
yield _make_test(api, failed_data, 'failed_test') |
- yield _make_test(api, _get_reversed_basic_test_data(), 'reversed_basic') |
- |
- bad_git_hash_data = _get_basic_test_data() |
- bad_git_hash_data[1]['interned_hashes'] = {'003': '12345', '002': 'Bad Hash'} |
- |
- bisect_script_test = _make_test( |
- api, _get_basic_test_data(), 'basic_bisect_script') |
+ failed_build_test = _make_test( |
+ api, _get_ref_range_only_test_data(), 'failed_build_test', |
+ extra_config={'dummy_builds': None}) |
+ failed_build_test += api.step_data('gsutil ls', retcode=1) |
+ failed_build_test += api.step_data('gsutil ls (2)' , retcode=1) |
+ failed_build_test += api.step_data('gsutil ls (3)' , retcode=1) |
+ failed_build_test += api.step_data( |
+ 'fetch builder state', |
+ api.raw_io.output(json.dumps({'cachedBuilds': ['2106']}))) |
+ failed_build_test += api.step_data( |
+ 'fetch build details', |
+ api.raw_io.output(json.dumps({ |
+ 'results': 2, |
+ 'properties': [('build_archive_url', |
+ ('gs://chrome-perf/Linux Builder/full-build-linux_' |
+ 'a6298e4afedbf2cd461755ea6f45b0ad64222222.zip'))] |
+ }))) |
+ yield failed_build_test |
- yield bisect_script_test |
+ delayed_build_test = _make_test( |
+ api, _get_ref_range_only_test_data(), 'delayed_build_test', |
+ extra_config={'dummy_builds': None}) |
+ delayed_build_test += api.step_data('gsutil ls', retcode=1) |
+ delayed_build_test += api.step_data('gsutil ls (2)', retcode=1) |
+ delayed_build_test += api.step_data('gsutil ls (3)', retcode=1) |
+ delayed_build_test += api.step_data('gsutil ls (4)', retcode=1) |
+ delayed_build_test += api.step_data('gsutil ls (5)', retcode=1) |
+ delayed_build_test += api.step_data('gsutil ls (6)', retcode=1) |
+ delayed_build_test += api.step_data( |
+ 'fetch builder state', |
+ api.raw_io.output(json.dumps({'cachedBuilds': []}))) |
+ delayed_build_test += api.step_data( |
+ 'fetch builder state (2)', |
+ api.raw_io.output(json.dumps({'cachedBuilds': ['2106']}))) |
+ delayed_build_test += api.step_data( |
+ 'fetch build details', |
+ api.raw_io.output(json.dumps({ |
+ 'properties': [('build_archive_url', |
+ ('gs://chrome-perf/Linux Builder/full-build-linux_' |
+ 'a6298e4afedbf2cd461755ea6f45b0ad64222222.zip'))] |
+ }))) |
+ delayed_build_test += api.step_data( |
+ 'fetch build details (2)', |
+ api.raw_io.output(json.dumps({ |
+ 'results': 2, |
+ 'properties': [('build_archive_url', |
+ ('gs://chrome-perf/Linux Builder/full-build-linux_' |
+ 'a6298e4afedbf2cd461755ea6f45b0ad64222222.zip'))] |
+ }))) |
+ yield delayed_build_test |
def _get_ref_range_only_test_data(): |
@@ -318,8 +356,8 @@ def _make_test(api, test_data, test_name, platform='linux', extra_config=None): |
basic_test = api.test(test_name) |
basic_test += api.properties(mastername='tryserver.chromium.perf', |
buildername='linux_perf_bisect', |
- slavename='dummyslave', |
- buildnumber=123456) |
+ slavename='dummyslave') |
+ basic_test += api.auto_bisect() |
basic_test += _get_revision_range_step_data(api, test_data) |
for revision_data in test_data: |
for step_data in _get_step_data_for_revision(api, revision_data): |
@@ -356,7 +394,7 @@ def _get_revision_range_step_data(api, range_data): |
"""Adds canned output for fetch_intervening_revisions.py.""" |
min_rev = range_data[0]['hash'] |
max_rev = range_data[-1]['hash'] |
- output = [[r['hash'], 'ignored'] for r in range_data[1:]] |
+ output = [[r['hash'], 'ignored'] for r in range_data[1:-1]] |
step_name = ('Expanding revision range.for revisions %s:%s' % |
(min_rev, max_rev)) |
return api.step_data(step_name, stdout=api.json.output(output)) |
@@ -419,6 +457,9 @@ def _get_step_data_for_revision(api, revision_data, include_build_steps=True): |
step_name = 'Generating patch for %s:DEPS to %s' |
step_name %= (commit_hash, deps_rev) |
yield api.step_data(step_name, stdout=api.raw_io.output(diff_file)) |
+ if deps_rev == '003': |
+ step_name = ('gsutil Get test results for build %s') % deps_rev |
+ yield api.step_data(step_name, stdout=api.json.output(test_results)) |
if 'DEPS_change' in revision_data: |
step_name = 'Checking DEPS for ' + commit_hash |