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