Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 2 # Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 3 # for details. All rights reserved. Use of this source code is governed by a | 3 # for details. All rights reserved. Use of this source code is governed by a |
| 4 # BSD-style license that can be found in the LICENSE file. | 4 # BSD-style license that can be found in the LICENSE file. |
| 5 | 5 |
| 6 """ | 6 """ |
| 7 Dartium on Android buildbot steps. | 7 Dartium on Android buildbot steps. |
| 8 | 8 |
| 9 Runs steps after the buildbot builds Dartium on Android, | 9 Runs steps after the buildbot builds Dartium on Android, |
| 10 which should upload the APK to an attached device, and run | 10 which should upload the APK to an attached device, and run |
| 11 Dart and chromium tests on it. | 11 Dart and chromium tests on it. |
| 12 """ | 12 """ |
| 13 | 13 |
| 14 import optparse | 14 import optparse |
| 15 import os | 15 import os |
| 16 import string | 16 import string |
| 17 import subprocess | |
| 17 import sys | 18 import sys |
| 18 | 19 |
| 19 import bot | 20 import bot |
| 20 import bot_utils | 21 import bot_utils |
| 21 | 22 |
| 22 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) | 23 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) |
| 23 sys.path.append(os.path.join(SCRIPT_DIR, '..')) | 24 sys.path.append(os.path.join(SCRIPT_DIR, '..')) |
| 24 import utils | 25 import utils |
| 25 | 26 |
| 26 | 27 |
| 27 APK_LOCATION = 'apks/Chrome.apk' | 28 APK_LOCATION = 'apks/Chrome.apk' |
| 28 CS_LOCATION = 'apks/ContentShell.apk' | 29 CS_LOCATION = 'apks/ContentShell.apk' |
| 29 | 30 |
| 30 def GetOptionsParser(): | 31 def GetOptionsParser(): |
| 31 parser = optparse.OptionParser("usage: %prog [options]") | 32 parser = optparse.OptionParser("usage: %prog [options]") |
| 32 parser.add_option("--build-products-dir", | 33 parser.add_option("--build-products-dir", |
| 33 help="The directory containing the products of the build.") | 34 help="The directory containing the products of the build.") |
| 34 return parser | 35 return parser |
| 35 | 36 |
| 36 | 37 |
| 37 def UploadSetACL(gsutil, local, remote): | 38 def UploadSetACL(gsutil, local, remote): |
| 38 gsutil.upload(local, remote) | 39 gsutil.upload(local, remote) |
| 39 gsutil.setGroupReadACL(remote, 'google.com') | 40 gsutil.setGroupReadACL(remote, 'google.com') |
| 40 gsutil.setContentType(remote, 'application/vnd.android.package-archive') | 41 gsutil.setContentType(remote, 'application/vnd.android.package-archive') |
| 41 | 42 |
| 42 | 43 |
| 43 def UploadAPKs(options): | 44 def UploadAPKs(options): |
| 44 with bot.BuildStep('Upload apk'): | 45 with bot.BuildStep('Upload apk'): |
| 45 revision = utils.GetSVNRevision() | 46 revision = utils.GetSVNRevision() |
| 46 namer = bot_utils.GCSNamer(internal=True) | 47 namer = bot_utils.GCSNamer(internal=True) |
| 47 # The version of gsutil we have on the bots is not new enough to support | 48 # The version of gsutil we have on the bots is not new enough to support |
| 48 # the acl set commands. | 49 # the acl set commands. |
| 49 bot_utils.GSUtil.USE_DART_REPO_VERSION = True | 50 bot_utils.GSUtil.USE_DART_REPO_VERSION = True |
| 50 gsutil = bot_utils.GSUtil() | 51 gsutil = bot_utils.GSUtil() |
| 51 | 52 |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 65 local = os.path.join(options.build_products_dir, CS_LOCATION) | 66 local = os.path.join(options.build_products_dir, CS_LOCATION) |
| 66 # TODO(whesse): pass in arch and mode from reciepe | 67 # TODO(whesse): pass in arch and mode from reciepe |
| 67 remote = namer.dartium_android_apk_filepath(revision, | 68 remote = namer.dartium_android_apk_filepath(revision, |
| 68 'content_shell-android', | 69 'content_shell-android', |
| 69 'arm', | 70 'arm', |
| 70 'release') | 71 'release') |
| 71 content_shell_link = string.replace(remote, 'gs://', web_link_prefix) | 72 content_shell_link = string.replace(remote, 'gs://', web_link_prefix) |
| 72 UploadSetACL(gsutil, local, remote) | 73 UploadSetACL(gsutil, local, remote) |
| 73 print "Uploaded content shell, available from: %s" % content_shell_link | 74 print "Uploaded content shell, available from: %s" % content_shell_link |
| 74 | 75 |
| 76 | |
| 77 def RunContentShellTests(options): | |
| 78 with bot.BuildStep('ContentShell tests'): | |
| 79 subprocess.call([os.path.join(SCRIPT_DIR, 'run_android_tests.sh'), | |
|
kustermann
2014/03/14 13:34:09
I'd strongly encourage you to change this to call_
| |
| 80 os.path.join(options.build_products_dir, CS_LOCATION)]) | |
| 81 | |
| 82 | |
| 75 def main(): | 83 def main(): |
| 76 if sys.platform != 'linux2': | 84 if sys.platform != 'linux2': |
| 77 print "This script was only tested on linux. Please run it on linux!" | 85 print "This script was only tested on linux. Please run it on linux!" |
| 78 sys.exit(1) | 86 sys.exit(1) |
| 79 | 87 |
| 80 parser = GetOptionsParser() | 88 parser = GetOptionsParser() |
| 81 (options, args) = parser.parse_args() | 89 (options, args) = parser.parse_args() |
| 82 | 90 |
| 83 if not options.build_products_dir: | 91 if not options.build_products_dir: |
| 84 print "No build products directory given." | 92 print "No build products directory given." |
| 85 sys.exit(1) | 93 sys.exit(1) |
| 86 | 94 |
| 87 UploadAPKs(options) | 95 UploadAPKs(options) |
| 96 RunContentShellTests(options) | |
| 88 sys.exit(0) | 97 sys.exit(0) |
| 89 | 98 |
| 90 if __name__ == '__main__': | 99 if __name__ == '__main__': |
| 91 main() | 100 main() |
| OLD | NEW |