| Index: scripts/slave/recipe_modules/chromedriver/example.py
|
| diff --git a/scripts/slave/recipe_modules/chromedriver/example.py b/scripts/slave/recipe_modules/chromedriver/example.py
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..fa3532c909a3dbd607efe4153a10da6ce7d6ce4e
|
| --- /dev/null
|
| +++ b/scripts/slave/recipe_modules/chromedriver/example.py
|
| @@ -0,0 +1,350 @@
|
| +# Copyright 2016 The Chromium Authors. All rights reserved.
|
| +# Use of this source code is governed by a BSD-style license that can be
|
| +# found in the LICENSE file.
|
| +
|
| +from recipe_engine import recipe_api
|
| +from recipe_engine.types import freeze
|
| +
|
| +DEPS = [
|
| + 'archive',
|
| + 'chromedriver',
|
| + 'chromium',
|
| + 'chromium_android',
|
| + 'commit_position',
|
| + 'depot_tools/bot_update',
|
| + 'depot_tools/gclient',
|
| + 'recipe_engine/platform',
|
| + 'recipe_engine/properties',
|
| + 'recipe_engine/raw_io',
|
| +]
|
| +
|
| +BUILDERS = freeze({
|
| + 'Android ChromeDriver Tests Example': {
|
| + # Whether or not to update the test results log (Android only).
|
| + 'update_log': True,
|
| + 'android_packages': [
|
| + 'chrome_shell',
|
| + 'chrome_stable',
|
| + 'chrome_beta',
|
| + 'chromedriver_webview_shell',
|
| + ],
|
| + },
|
| + 'Linux ChromeDriver Tests Example': {},
|
| + 'Mac ChromeDriver Tests Example': {},
|
| + 'Windows ChromeDriver Tests Example': {},
|
| +})
|
| +
|
| +def RunSteps(api):
|
| + buildername = api.properties['buildername']
|
| + builder = BUILDERS[buildername]
|
| + android_packages = builder.get('android_packages')
|
| + update_log = builder.get('update_log')
|
| +
|
| + api.chromium.set_config('chromium')
|
| + api.gclient.set_config('chromium')
|
| + api.bot_update.ensure_checkout(force=True)
|
| + platform = api.chromedriver.get_chromedriver_platform(bool(android_packages))
|
| +
|
| + commit_position = api.commit_position.parse_revision(
|
| + api.properties['got_revision_cp'])
|
| +
|
| + if platform == 'android':
|
| + api.chromedriver.download_prebuilts()
|
| + else:
|
| + if platform == 'linux64':
|
| + api.chromedriver.archive_prebuilts(commit_position)
|
| +
|
| + passed = api.chromedriver.run_all_tests(android_packages=android_packages)
|
| + api.chromedriver.archive_server_logs()
|
| +
|
| + if platform == 'android':
|
| + if update_log:
|
| + api.chromedriver.update_test_results_log(
|
| + platform, commit_position, passed)
|
| + elif passed:
|
| + api.chromedriver.archive_good_build(platform, commit_position)
|
| + api.chromedriver.maybe_release(platform)
|
| +
|
| +def GenTests(api):
|
| +
|
| + sanitize = lambda s: ''.join(c if c.isalnum() else '_' for c in s)
|
| +
|
| + yield (
|
| + api.test('%s_basic' % sanitize('Android ChromeDriver')) +
|
| + api.properties.generic(
|
| + buildername='Android ChromeDriver Tests Example',
|
| + slavename='slavename') +
|
| + api.properties(
|
| + parent_build_archive_url='gs://test-domain/test-archive.zip',
|
| + got_revision_cp='refs/heads/master@{#3333333333}'))
|
| +
|
| + yield (
|
| + api.test('%s_basic' % sanitize('Linux64 ChromeDriver')) +
|
| + api.properties.generic(
|
| + buildername='Linux ChromeDriver Tests Example',
|
| + slavename='slavename') +
|
| + api.properties(
|
| + parent_build_archive_url='gs://test-domain/test-archive.zip',
|
| + got_revision='4f4b02f6b7fa20a3a25682c457bbc8ad589c8a00',
|
| + got_revision_cp='refs/heads/master@{#3333333333}') +
|
| + api.platform('linux', 64) +
|
| + api.step_data('read version file', api.raw_io.output('9.99')) +
|
| + api.step_data('gsutil list chromedriver versions', retcode=1) +
|
| + api.step_data('gsutil check latest release', api.raw_io.stream_output(
|
| + '9.98', stream='stdout')) +
|
| + api.step_data('read results log file', api.raw_io.output(
|
| + '{"2222222222": true, "4444444444": false, "6666666666": true}')) +
|
| + api.step_data('gsutil list release candidates', api.raw_io.stream_output(
|
| + 'test/dir/chromedriver_linux64_9.99.2222222222.zip\n' # Passed tests.
|
| + 'test/dir/chromedriver_linux64_9.99.3333333333.zip\n' # No test data.
|
| + 'test/dir/chromedriver_linux64_9.99.4444444444.zip\n', # Failed tests.
|
| + stream='stdout')))
|
| +
|
| + yield (
|
| + api.test('%s_basic' % sanitize('Linux32 ChromeDriver')) +
|
| + api.properties.generic(
|
| + buildername='Linux ChromeDriver Tests Example',
|
| + slavename='slavename') +
|
| + api.properties(
|
| + parent_build_archive_url='gs://test-domain/test-archive.zip',
|
| + got_revision='4f4b02f6b7fa20a3a25682c457bbc8ad589c8a00',
|
| + got_revision_cp='refs/heads/master@{#3333333333}') +
|
| + api.platform('linux', 32) +
|
| + api.step_data('read version file', api.raw_io.output('9.99')) +
|
| + api.step_data('gsutil list chromedriver versions', retcode=1) +
|
| + api.step_data('gsutil check latest release', api.raw_io.stream_output(
|
| + '9.98', stream='stdout')) +
|
| + api.step_data('read results log file', api.raw_io.output(
|
| + '{"2222222222": true, "4444444444": false, "6666666666": true}')) +
|
| + api.step_data('gsutil list release candidates', api.raw_io.stream_output(
|
| + 'test/dir/chromedriver_linux32_9.99.2222222222.zip\n' # Passed tests.
|
| + 'test/dir/chromedriver_linux32_9.99.3333333333.zip\n' # No test data.
|
| + 'test/dir/chromedriver_linux32_9.99.4444444444.zip\n', # Failed tests.
|
| + stream='stdout')))
|
| +
|
| + yield (
|
| + api.test('%s_basic' % sanitize('Windows ChromeDriver')) +
|
| + api.properties.generic(
|
| + buildername='Windows ChromeDriver Tests Example',
|
| + slavename='slavename') +
|
| + api.properties(
|
| + parent_build_archive_url='gs://test-domain/test-archive.zip',
|
| + got_revision='4f4b02f6b7fa20a3a25682c457bbc8ad589c8a00',
|
| + got_revision_cp='refs/heads/master@{#3333333333}') +
|
| + api.platform('win', 32) +
|
| + api.step_data('read version file', api.raw_io.output('9.99')) +
|
| + api.step_data('gsutil list chromedriver versions', retcode=1) +
|
| + api.step_data('gsutil check latest release', api.raw_io.stream_output(
|
| + '9.98', stream='stdout')) +
|
| + api.step_data('read results log file', api.raw_io.output(
|
| + '{"2222222222": true, "4444444444": false, "6666666666": true}')) +
|
| + api.step_data('gsutil list release candidates', api.raw_io.stream_output(
|
| + 'test/dir/chromedriver_win32_9.99.2222222222.zip\n' # Passed tests.
|
| + 'test/dir/chromedriver_win32_9.99.3333333333.zip\n' # No test data.
|
| + 'test/dir/chromedriver_win32_9.99.4444444444.zip\n', # Failed tests.
|
| + stream='stdout')))
|
| +
|
| + yield (
|
| + api.test('%s_basic' % sanitize('Mac ChromeDriver')) +
|
| + api.properties.generic(
|
| + buildername='Mac ChromeDriver Tests Example',
|
| + slavename='slavename') +
|
| + api.properties(
|
| + parent_build_archive_url='gs://test-domain/test-archive.zip',
|
| + got_revision='4f4b02f6b7fa20a3a25682c457bbc8ad589c8a00',
|
| + got_revision_cp='refs/heads/master@{#3333333333}') +
|
| + api.platform('mac', 32) +
|
| + api.step_data('read version file', api.raw_io.output('9.99')) +
|
| + api.step_data('gsutil list chromedriver versions', retcode=1) +
|
| + api.step_data('gsutil check latest release', api.raw_io.stream_output(
|
| + '9.98', stream='stdout')) +
|
| + api.step_data('read results log file', api.raw_io.output(
|
| + '{"2222222222": true, "4444444444": false, "6666666666": true}')) +
|
| + api.step_data('gsutil list release candidates', api.raw_io.stream_output(
|
| + 'test/dir/chromedriver_mac32_9.99.2222222222.zip\n' # Passed tests.
|
| + 'test/dir/chromedriver_mac32_9.99.3333333333.zip\n' # No test data.
|
| + 'test/dir/chromedriver_mac32_9.99.4444444444.zip\n', # Failed tests.
|
| + stream='stdout')))
|
| +
|
| + yield (
|
| + api.test('%s_commit_revision_exists' % sanitize('Linux64 ChromeDriver')) +
|
| + api.properties.generic(
|
| + buildername='Linux ChromeDriver Tests Example',
|
| + slavename='slavename') +
|
| + api.properties(
|
| + parent_build_archive_url='gs://test-domain/test-archive.zip',
|
| + got_revision_cp='refs/heads/master@{#4444444444}') +
|
| + api.platform('linux', 64) +
|
| + api.step_data('read version file', api.raw_io.output('9.99')) +
|
| + api.step_data('gsutil list chromedriver versions', retcode=1) +
|
| + api.step_data('gsutil check latest release', api.raw_io.stream_output(
|
| + '9.98', stream='stdout')) +
|
| + api.step_data('read results log file', api.raw_io.output(
|
| + '{"2222222222": true, "4444444444": false, "6666666666": true}')) +
|
| + api.step_data('gsutil list release candidates', api.raw_io.stream_output(
|
| + 'test/dir/chromedriver_linux64_9.99.2222222222.zip\n' # Passed tests.
|
| + 'test/dir/chromedriver_linux64_9.99.3333333333.zip\n' # No test data.
|
| + 'test/dir/chromedriver_linux64_9.99.4444444444.zip\n', # Failed tests.
|
| + stream='stdout')))
|
| +
|
| + yield (
|
| + api.test('%s_is_latest_release' % sanitize('Linux64 ChromeDriver')) +
|
| + api.properties.generic(
|
| + buildername='Linux ChromeDriver Tests Example',
|
| + slavename='slavename') +
|
| + api.properties(
|
| + parent_build_archive_url='gs://test-domain/test-archive.zip',
|
| + got_revision='4f4b02f6b7fa20a3a25682c457bbc8ad589c8a00',
|
| + got_revision_cp='refs/heads/master@{#3333333333}') +
|
| + api.platform('linux', 64) +
|
| + api.step_data('gsutil list chromedriver versions', retcode=1) +
|
| + api.step_data('read version file', api.raw_io.output('9.99')) +
|
| + api.step_data('gsutil check latest release', api.raw_io.stream_output(
|
| + '9.99', stream='stdout')) +
|
| + api.step_data('read results log file', api.raw_io.output(
|
| + '{"2222222222": true, "4444444444": false, "6666666666": true}')) +
|
| + api.step_data('gsutil list release candidates', api.raw_io.stream_output(
|
| + 'test/dir/chromedriver_linux64_9.99.2222222222.zip\n' # Passed tests.
|
| + 'test/dir/chromedriver_linux64_9.99.3333333333.zip\n' # No test data.
|
| + 'test/dir/chromedriver_linux64_9.99.4444444444.zip\n', # Failed tests.
|
| + stream='stdout')))
|
| +
|
| + yield (
|
| + api.test('%s_was_already_released' % sanitize('Linux64 ChromeDriver')) +
|
| + api.properties.generic(
|
| + buildername='Linux ChromeDriver Tests Example',
|
| + slavename='slavename') +
|
| + api.properties(
|
| + parent_build_archive_url='gs://test-domain/test-archive.zip',
|
| + got_revision='4f4b02f6b7fa20a3a25682c457bbc8ad589c8a00',
|
| + got_revision_cp='refs/heads/master@{#3333333333}') +
|
| + api.platform('linux', 64) +
|
| + api.step_data('read version file', api.raw_io.output('9.99')) +
|
| + api.step_data('gsutil list chromedriver versions', retcode=0))
|
| +
|
| + yield (
|
| + api.test('%s_test_failures' % sanitize('Linux64 ChromeDriver')) +
|
| + api.properties.generic(
|
| + buildername='Linux ChromeDriver Tests Example',
|
| + slavename='slavename') +
|
| + api.properties(
|
| + parent_build_archive_url='gs://test-domain/test-archive.zip',
|
| + got_revision='4f4b02f6b7fa20a3a25682c457bbc8ad589c8a00',
|
| + got_revision_cp='refs/heads/master@{#3333333333}') +
|
| + api.platform('linux', 64) +
|
| + api.step_data('gsutil get latest revision', api.raw_io.stream_output(
|
| + '123456', stream='stdout')) +
|
| + api.step_data('java_tests(v123456)', retcode=1) +
|
| + api.step_data('chromedriver_tests', retcode=1))
|
| +
|
| + yield (
|
| + api.test('%s_test_failures' % sanitize('Android ChromeDriver')) +
|
| + api.properties.generic(
|
| + buildername='Android ChromeDriver Tests Example',
|
| + slavename='slavename') +
|
| + api.properties(
|
| + parent_build_archive_url='gs://test-domain/test-archive.zip',
|
| + got_revision='4f4b02f6b7fa20a3a25682c457bbc8ad589c8a00',
|
| + got_revision_cp='refs/heads/master@{#3333333333}') +
|
| + api.platform('linux', 64) +
|
| + api.step_data('read results log file', api.raw_io.output(
|
| + '{"2222222222": true, "4444444444": false, "6666666666": true}')) +
|
| + api.step_data('java_tests(chrome_shell)', retcode=1))
|
| +
|
| + yield (
|
| + api.test('%s_download_chrome_failure' % sanitize('Linux64 ChromeDriver')) +
|
| + api.properties.generic(
|
| + buildername='Linux ChromeDriver Tests Example',
|
| + slavename='slavename') +
|
| + api.properties(
|
| + parent_build_archive_url='gs://test-domain/test-archive.zip',
|
| + got_revision='4f4b02f6b7fa20a3a25682c457bbc8ad589c8a00',
|
| + got_revision_cp='refs/heads/master@{#3333333333}') +
|
| + api.platform('linux', 64) +
|
| + api.step_data('read version file', api.raw_io.output('9.99')) +
|
| + api.step_data('gsutil list chromedriver versions', retcode=1) +
|
| + api.step_data('read results log file', api.raw_io.output(
|
| + '{"2222222222": true, "4444444444": false, "6666666666": true}')) +
|
| + api.step_data('gsutil list release candidates', api.raw_io.stream_output(
|
| + 'test/dir/chromedriver_linux64_9.99.2222222222.zip\n' # Passed tests.
|
| + 'test/dir/chromedriver_linux64_9.99.3333333333.zip\n' # No test data.
|
| + 'test/dir/chromedriver_linux64_9.99.4444444444.zip\n', # Failed tests.
|
| + stream='stdout')) +
|
| + api.step_data('gsutil download chrome', retcode=1))
|
| +
|
| + yield (
|
| + api.test('%s_update_test_notes' % sanitize('Linux64 ChromeDriver')) +
|
| + api.properties.generic(
|
| + buildername='Linux ChromeDriver Tests Example',
|
| + slavename='slavename') +
|
| + api.properties(
|
| + parent_build_archive_url='gs://test-domain/test-archive.zip',
|
| + got_revision='4f4b02f6b7fa20a3a25682c457bbc8ad589c8a00',
|
| + got_revision_cp='refs/heads/master@{#3333333333}') +
|
| + api.platform('linux', 64) +
|
| + api.step_data('read version file', api.raw_io.output('9.99')) +
|
| + api.step_data('gsutil list chromedriver versions', retcode=1) +
|
| + api.step_data('gsutil check latest release', api.raw_io.stream_output(
|
| + '9.98', stream='stdout')) +
|
| + api.step_data('read results log file', api.raw_io.output(
|
| + '{"2222222222": true, "4444444444": false, "6666666666": true}')) +
|
| + api.step_data('gsutil list release candidates', api.raw_io.stream_output(
|
| + 'test/dir/chromedriver_linux64_9.99.2222222222.zip\n' # Passed tests.
|
| + 'test/dir/chromedriver_linux64_9.99.3333333333.zip\n' # No test data.
|
| + 'test/dir/chromedriver_linux64_9.99.4444444444.zip\n', # Failed tests.
|
| + stream='stdout')) +
|
| + api.step_data('gsutil list version notes', retcode=1))
|
| +
|
| + yield (
|
| + api.test('%s_write_test_notes' % sanitize('Linux64 ChromeDriver')) +
|
| + api.properties.generic(
|
| + buildername='Linux ChromeDriver Tests Example',
|
| + slavename='slavename') +
|
| + api.properties(
|
| + parent_build_archive_url='gs://test-domain/test-archive.zip',
|
| + got_revision='4f4b02f6b7fa20a3a25682c457bbc8ad589c8a00',
|
| + got_revision_cp='refs/heads/master@{#3333333333}') +
|
| + api.platform('linux', 64) +
|
| + api.step_data('read version file', api.raw_io.output('9.99')) +
|
| + api.step_data('gsutil list chromedriver versions', retcode=1) +
|
| + api.step_data('gsutil check latest release', api.raw_io.stream_output(
|
| + '9.98', stream='stdout')) +
|
| + api.step_data('read results log file', api.raw_io.output(
|
| + '{"2222222222": true, "4444444444": false, "6666666666": true}')) +
|
| + api.step_data('gsutil list release candidates', api.raw_io.stream_output(
|
| + 'test/dir/chromedriver_linux64_9.99.2222222222.zip\n' # Passed tests.
|
| + 'test/dir/chromedriver_linux64_9.99.3333333333.zip\n' # No test data.
|
| + 'test/dir/chromedriver_linux64_9.99.4444444444.zip\n', # Failed tests.
|
| + stream='stdout')) +
|
| + api.step_data('gsutil list version notes', retcode=1) +
|
| + api.step_data('gsutil download prev notes', retcode=1))
|
| +
|
| + yield (
|
| + api.test('%s_download_log_failure' % sanitize('Linux64 ChromeDriver')) +
|
| + api.properties.generic(
|
| + buildername='Linux ChromeDriver Tests Example',
|
| + slavename='slavename') +
|
| + api.properties(
|
| + parent_build_archive_url='gs://test-domain/test-archive.zip',
|
| + got_revision='4f4b02f6b7fa20a3a25682c457bbc8ad589c8a00',
|
| + got_revision_cp='refs/heads/master@{#3333333333}') +
|
| + api.platform('linux', 64) +
|
| + api.step_data('read version file', api.raw_io.output('9.99')) +
|
| + api.step_data('gsutil list chromedriver versions', retcode=1) +
|
| + api.step_data('gsutil list release candidates', api.raw_io.stream_output(
|
| + 'test/dir/chromedriver_linux64_9.99.2222222222.zip\n' # Passed tests.
|
| + 'test/dir/chromedriver_linux64_9.99.3333333333.zip\n' # No test data.
|
| + 'test/dir/chromedriver_linux64_9.99.4444444444.zip\n', # Failed tests.
|
| + stream='stdout')) +
|
| + api.step_data('gsutil download results log', retcode=1))
|
| +
|
| + yield (
|
| + api.test('%s_commit_already_logged' % sanitize('Android ChromeDriver')) +
|
| + api.properties.generic(
|
| + buildername='Android ChromeDriver Tests Example',
|
| + slavename='slavename') +
|
| + api.properties(
|
| + parent_build_archive_url='gs://test-domain/test-archive.zip',
|
| + got_revision_cp='refs/heads/master@{#2222222222}') +
|
| + api.step_data('read results log file', api.raw_io.output(
|
| + '{"2222222222": true}')))
|
|
|