| 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 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 help="The directory containing the products of the build.") | 32 help="The directory containing the products of the build.") |
| 33 return parser | 33 return parser |
| 34 | 34 |
| 35 | 35 |
| 36 def UploadSetACL(gsutil, local, remote): | 36 def UploadSetACL(gsutil, local, remote): |
| 37 gsutil.upload(local, remote, public=True) | 37 gsutil.upload(local, remote, public=True) |
| 38 | 38 |
| 39 | 39 |
| 40 def UploadAPKs(options): | 40 def UploadAPKs(options): |
| 41 with bot.BuildStep('Upload apk'): | 41 with bot.BuildStep('Upload apk'): |
| 42 revision = utils.GetSVNRevision() | |
| 43 bot_name = os.environ.get("BUILDBOT_BUILDERNAME") | 42 bot_name = os.environ.get("BUILDBOT_BUILDERNAME") |
| 44 channel = bot_utils.GetChannelFromName(bot_name) | 43 channel = bot_utils.GetChannelFromName(bot_name) |
| 45 namer = bot_utils.GCSNamer(channel=channel) | 44 namer = bot_utils.GCSNamer(channel=channel) |
| 46 gsutil = bot_utils.GSUtil() | 45 gsutil = bot_utils.GSUtil() |
| 47 | 46 |
| 48 web_link_prefix = 'https://storage.cloud.google.com/' | 47 web_link_prefix = 'https://storage.cloud.google.com/' |
| 49 | 48 |
| 50 # Archive content shell | 49 # Archive content shell |
| 51 local = os.path.join(options.build_products_dir, CS_LOCATION) | 50 local = os.path.join(options.build_products_dir, CS_LOCATION) |
| 52 # TODO(whesse): pass in arch and mode from reciepe | 51 |
| 53 remote = namer.dartium_android_apk_filepath(revision, | 52 for revision in [utils.GetSVNRevision(), 'latest']: |
| 54 'content_shell-android', | 53 # TODO(whesse): pass in arch and mode from reciepe |
| 55 'arm', | 54 remote = namer.dartium_android_apk_filepath(revision, |
| 56 'release') | 55 'content_shell-android', |
| 57 content_shell_link = string.replace(remote, 'gs://', web_link_prefix) | 56 'arm', |
| 58 UploadSetACL(gsutil, local, remote) | 57 'release') |
| 59 print "Uploaded content shell, available from: %s" % content_shell_link | 58 content_shell_link = string.replace(remote, 'gs://', web_link_prefix) |
| 59 UploadSetACL(gsutil, local, remote) |
| 60 print "Uploaded content shell, available from: %s" % content_shell_link |
| 60 | 61 |
| 61 | 62 |
| 62 def RunContentShellTests(options): | 63 def RunContentShellTests(options): |
| 63 with bot.BuildStep('ContentShell tests'): | 64 with bot.BuildStep('ContentShell tests'): |
| 64 subprocess.check_call([os.path.join(SCRIPT_DIR, 'run_android_tests.sh'), | 65 subprocess.check_call([os.path.join(SCRIPT_DIR, 'run_android_tests.sh'), |
| 65 os.path.join(options.build_products_dir, CS_LOCATION)]) | 66 os.path.join(options.build_products_dir, CS_LOCATION)]) |
| 66 | 67 |
| 67 | 68 |
| 68 def main(): | 69 def main(): |
| 69 if sys.platform != 'linux2': | 70 if sys.platform != 'linux2': |
| 70 print "This script was only tested on linux. Please run it on linux!" | 71 print "This script was only tested on linux. Please run it on linux!" |
| 71 sys.exit(1) | 72 sys.exit(1) |
| 72 | 73 |
| 73 parser = GetOptionsParser() | 74 parser = GetOptionsParser() |
| 74 (options, args) = parser.parse_args() | 75 (options, args) = parser.parse_args() |
| 75 | 76 |
| 76 if not options.build_products_dir: | 77 if not options.build_products_dir: |
| 77 print "No build products directory given." | 78 print "No build products directory given." |
| 78 sys.exit(1) | 79 sys.exit(1) |
| 79 | 80 |
| 80 UploadAPKs(options) | 81 UploadAPKs(options) |
| 81 RunContentShellTests(options) | 82 RunContentShellTests(options) |
| 82 sys.exit(0) | 83 sys.exit(0) |
| 83 | 84 |
| 84 if __name__ == '__main__': | 85 if __name__ == '__main__': |
| 85 main() | 86 main() |
| OLD | NEW |