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