| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """Main entry point for the NaCl SDK buildbot. | 6 """Main entry point for the NaCl SDK buildbot. |
| 7 | 7 |
| 8 The entry point used to be build_sdk.py itself, but we want | 8 The entry point used to be build_sdk.py itself, but we want |
| 9 to be able to simplify build_sdk (for example separating out | 9 to be able to simplify build_sdk (for example separating out |
| 10 the test code into test_sdk) and change its default behaviour | 10 the test code into test_sdk) and change its default behaviour |
| 11 while being able to separately control excactly what the bots | 11 while being able to separately control excactly what the bots |
| 12 run. | 12 run. |
| 13 """ | 13 """ |
| 14 | 14 |
| 15 import argparse |
| 15 import buildbot_common | 16 import buildbot_common |
| 16 import os | 17 import os |
| 17 import optparse | |
| 18 import subprocess | 18 import subprocess |
| 19 import sys | 19 import sys |
| 20 | 20 |
| 21 from buildbot_common import Run | 21 from buildbot_common import Run |
| 22 from build_paths import SRC_DIR, SDK_SRC_DIR, SCRIPT_DIR | 22 from build_paths import SRC_DIR, SDK_SRC_DIR, SCRIPT_DIR |
| 23 import getos | 23 import getos |
| 24 | 24 |
| 25 | 25 |
| 26 def StepArmRunHooks(): | 26 def StepArmRunHooks(): |
| 27 if getos.GetPlatform() != 'linux': | 27 if getos.GetPlatform() != 'linux': |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 cmd.extend(['build_examples', 'copy_tests', 'build_tests']) | 94 cmd.extend(['build_examples', 'copy_tests', 'build_tests']) |
| 95 Run(cmd, cwd=SCRIPT_DIR) | 95 Run(cmd, cwd=SCRIPT_DIR) |
| 96 | 96 |
| 97 | 97 |
| 98 def main(args): | 98 def main(args): |
| 99 # Don't write out .pyc files in the source tree. Without this, incremental | 99 # Don't write out .pyc files in the source tree. Without this, incremental |
| 100 # builds can fail when .py files are moved/deleted, since python could load | 100 # builds can fail when .py files are moved/deleted, since python could load |
| 101 # orphaned .pyc files generated by a previous run. | 101 # orphaned .pyc files generated by a previous run. |
| 102 os.environ['PYTHONDONTWRITEBYTECODE'] = '1' | 102 os.environ['PYTHONDONTWRITEBYTECODE'] = '1' |
| 103 | 103 |
| 104 parser = optparse.OptionParser(description=__doc__) | 104 parser = argparse.ArgumentParser(description=__doc__) |
| 105 parser.add_option('--build-only', action='store_true', | 105 parser.add_argument('--build-only', action='store_true', |
| 106 help='Only build the SDK, don\'t build or run tests.') | 106 help='Only build the SDK, don\'t build or run tests.') |
| 107 parser.add_option('--build-properties', | 107 parser.add_argument('--build-properties', |
| 108 help='JSON properties passed by buildbot. Currently ignored.') | 108 help='JSON properties passed by buildbot. Currently ignored.') |
| 109 parser.add_option('--factory-properties', | 109 parser.add_argument('--factory-properties', |
| 110 help='JSON properties passed by buildbot. Currently ignored.') | 110 help='JSON properties passed by buildbot. Currently ignored.') |
| 111 options, args = parser.parse_args(args) | 111 options = parser.parse_args(args) |
| 112 | 112 |
| 113 # Skip the testing phase if we are running on a build-only bots. | 113 # Skip the testing phase if we are running on a build-only bots. |
| 114 if not options.build_only: | 114 if not options.build_only: |
| 115 # Infer build-only from bot name. | 115 # Infer build-only from bot name. |
| 116 # TODO(sbc): Remove this once buildbot script have been updated | 116 # TODO(sbc): Remove this once buildbot script have been updated |
| 117 # to pass --build-only argument. | 117 # to pass --build-only argument. |
| 118 if os.getenv('BUILDBOT_BUILDERNAME', '').endswith('build'): | 118 if os.getenv('BUILDBOT_BUILDERNAME', '').endswith('build'): |
| 119 options.build_only = True | 119 options.build_only = True |
| 120 | 120 |
| 121 StepArmRunHooks() | 121 StepArmRunHooks() |
| 122 StepRunUnittests() | 122 StepRunUnittests() |
| 123 StepBuildSDK() | 123 StepBuildSDK() |
| 124 if not options.build_only: | 124 if not options.build_only: |
| 125 StepTestSDK() | 125 StepTestSDK() |
| 126 | 126 |
| 127 return 0 | 127 return 0 |
| 128 | 128 |
| 129 | 129 |
| 130 if __name__ == '__main__': | 130 if __name__ == '__main__': |
| 131 try: | 131 try: |
| 132 sys.exit(main(sys.argv[1:])) | 132 sys.exit(main(sys.argv[1:])) |
| 133 except KeyboardInterrupt: | 133 except KeyboardInterrupt: |
| 134 buildbot_common.ErrorExit('buildbot_run: interrupted') | 134 buildbot_common.ErrorExit('buildbot_run: interrupted') |
| OLD | NEW |