| OLD | NEW |
| (Empty) | |
| 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 |
| 3 # found in the LICENSE file. |
| 4 |
| 5 from recipe_engine import recipe_api |
| 6 from recipe_engine.types import freeze |
| 7 |
| 8 DEPS = [ |
| 9 'archive', |
| 10 'chromedriver', |
| 11 'chromium', |
| 12 'chromium_android', |
| 13 'commit_position', |
| 14 'depot_tools/bot_update', |
| 15 'depot_tools/gclient', |
| 16 'recipe_engine/platform', |
| 17 'recipe_engine/properties', |
| 18 'recipe_engine/raw_io', |
| 19 'recipe_engine/step', |
| 20 ] |
| 21 |
| 22 BUILDERS = freeze({ |
| 23 'Android ChromeDriver Tests Example': { |
| 24 # Whether or not to update the test results log (Android only). |
| 25 'update_test_log': True, |
| 26 'android_packages': [ |
| 27 'chrome_shell', |
| 28 'chrome_stable', |
| 29 'chrome_beta', |
| 30 'chromedriver_webview_shell', |
| 31 ], |
| 32 }, |
| 33 }) |
| 34 |
| 35 def RunSteps(api): |
| 36 buildername = api.properties['buildername'] |
| 37 builder = BUILDERS[buildername] |
| 38 android_packages = builder.get('android_packages') |
| 39 update_test_log = builder.get('update_test_log') |
| 40 |
| 41 api.chromium.set_config('chromium') |
| 42 api.gclient.set_config('chromium') |
| 43 api.bot_update.ensure_checkout(force=True) |
| 44 platform = api.chromedriver.get_chromedriver_platform(bool(android_packages)) |
| 45 |
| 46 commit_position = api.commit_position.parse_revision( |
| 47 api.properties['got_revision_cp']) |
| 48 |
| 49 if platform == 'android': |
| 50 api.chromedriver.download_prebuilts() |
| 51 |
| 52 passed = True |
| 53 try: |
| 54 api.chromedriver.run_all_tests(android_packages=android_packages, |
| 55 archive_server_logs=True) |
| 56 except api.step.StepFailure: |
| 57 passed = False |
| 58 |
| 59 if platform == 'android': |
| 60 if update_test_log: |
| 61 api.chromedriver.update_test_results_log( |
| 62 platform, commit_position, passed) |
| 63 |
| 64 def GenTests(api): |
| 65 |
| 66 sanitize = lambda s: ''.join(c if c.isalnum() else '_' for c in s) |
| 67 |
| 68 yield ( |
| 69 api.test('%s_basic' % sanitize('Android ChromeDriver')) + |
| 70 api.properties.generic( |
| 71 buildername='Android ChromeDriver Tests Example', |
| 72 slavename='slavename') + |
| 73 api.properties( |
| 74 parent_build_archive_url='gs://test-domain/test-archive.zip', |
| 75 got_revision_cp='refs/heads/master@{#3333333333}')) |
| 76 |
| 77 yield ( |
| 78 api.test('%s_test_failure' % sanitize('Android ChromeDriver')) + |
| 79 api.properties.generic( |
| 80 buildername='Android ChromeDriver Tests Example', |
| 81 slavename='slavename') + |
| 82 api.properties( |
| 83 parent_build_archive_url='gs://test-domain/test-archive.zip', |
| 84 got_revision_cp='refs/heads/master@{#3333333333}') + |
| 85 api.step_data('java_tests(chrome_stable)', retcode=1)) |
| 86 |
| 87 yield ( |
| 88 api.test('%s_commit_already_in_logs' % sanitize('Android ChromeDriver')) + |
| 89 api.properties.generic( |
| 90 buildername='Android ChromeDriver Tests Example', |
| 91 slavename='slavename') + |
| 92 api.properties( |
| 93 parent_build_archive_url='gs://test-domain/test-archive.zip', |
| 94 got_revision_cp='refs/heads/master@{#3333333333}') + |
| 95 api.step_data('Download Test Results Log.read results log file', |
| 96 api.raw_io.output('{"3333333333": true}'))) |
| 97 |
| 98 yield ( |
| 99 api.test('%s_download_logs_failure' % sanitize('Android ChromeDriver')) + |
| 100 api.properties.generic( |
| 101 buildername='Android ChromeDriver Tests Example', |
| 102 slavename='slavename') + |
| 103 api.properties( |
| 104 parent_build_archive_url='gs://test-domain/test-archive.zip', |
| 105 got_revision_cp='refs/heads/master@{#3333333333}') + |
| 106 api.step_data( |
| 107 'Download Test Results Log.gsutil download results log', retcode=1)) |
| OLD | NEW |