| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 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 # This a simple script to make building/testing Mojo components easier. | 6 # This a simple script to make building/testing Mojo components easier. |
| 7 | 7 |
| 8 import argparse | 8 import argparse |
| 9 import os | 9 import os |
| 10 import platform | 10 import platform |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 return subprocess.call(['ninja', '-j', '1000', '-l', '100', '-C', out_dir, | 100 return subprocess.call(['ninja', '-j', '1000', '-l', '100', '-C', out_dir, |
| 101 'root']) | 101 'root']) |
| 102 else: | 102 else: |
| 103 return subprocess.call(['ninja', '-C', out_dir, 'root']) | 103 return subprocess.call(['ninja', '-C', out_dir, 'root']) |
| 104 | 104 |
| 105 | 105 |
| 106 def run_unittests(args): | 106 def run_unittests(args): |
| 107 out_dir = get_out_dir(args) | 107 out_dir = get_out_dir(args) |
| 108 print 'Running unit tests in %s ...' % out_dir | 108 print 'Running unit tests in %s ...' % out_dir |
| 109 command = ['python'] | 109 command = ['python'] |
| 110 if platform.system() == 'Linux': | 110 if platform.system() == 'Linux' and not args.android: |
| 111 command.append('./testing/xvfb.py') | 111 command.append('./testing/xvfb.py') |
| 112 command.append(out_dir) | 112 command.append(out_dir) |
| 113 | 113 |
| 114 command.append(os.path.join('mojo', 'tools', 'test_runner.py')) | 114 command.append(os.path.join('mojo', 'tools', 'test_runner.py')) |
| 115 command.append(os.path.join('mojo', 'tools', 'data', 'unittests')) | 115 command.append('--debug' if args.debug else '--release') |
| 116 if args.android: |
| 117 command.append('--android') |
| 118 command.append(os.path.join('mojo', 'tools', 'data', 'android_unittests')) |
| 119 else: |
| 120 command.append(os.path.join('mojo', 'tools', 'data', 'unittests')) |
| 116 command.append(out_dir) | 121 command.append(out_dir) |
| 117 command.append('mojob_test_successes') | 122 command.append('mojob_test_successes') |
| 118 return subprocess.call(command) | 123 return subprocess.call(command) |
| 119 | 124 |
| 120 | 125 |
| 121 def run_skytests(args): | 126 def run_skytests(args): |
| 122 out_dir = get_out_dir(args) | 127 out_dir = get_out_dir(args) |
| 123 if platform.system() != 'Linux': | 128 if platform.system() != 'Linux' or args.android: |
| 124 return 0 | 129 return 0 |
| 125 | 130 |
| 126 command = [] | 131 command = [] |
| 127 command.append('./testing/xvfb.py') | 132 command.append('./testing/xvfb.py') |
| 128 command.append(out_dir) | 133 command.append(out_dir) |
| 129 command.append('sky/tools/test_sky') | 134 command.append('sky/tools/test_sky') |
| 130 command.append('-t') | 135 command.append('-t') |
| 131 command.append('Debug' if args.debug else 'Release') | 136 command.append('Debug' if args.debug else 'Release') |
| 132 command.append('--no-new-test-results') | 137 command.append('--no-new-test-results') |
| 133 command.append('--no-show-results') | 138 command.append('--no-show-results') |
| 134 command.append('--verbose') | 139 command.append('--verbose') |
| 135 return subprocess.call(command) | 140 return subprocess.call(command) |
| 136 | 141 |
| 137 | 142 |
| 138 def run_pytests(args): | 143 def run_pytests(args): |
| 139 out_dir = get_out_dir(args) | 144 out_dir = get_out_dir(args) |
| 140 print 'Running python tests in %s ...' % out_dir | 145 print 'Running python tests in %s ...' % out_dir |
| 141 command = ['python'] | 146 command = ['python'] |
| 142 command.append(os.path.join('mojo', 'tools', 'run_mojo_python_tests.py')) | 147 command.append(os.path.join('mojo', 'tools', 'run_mojo_python_tests.py')) |
| 143 exit_code = subprocess.call(command) | 148 exit_code = subprocess.call(command) |
| 144 if exit_code: | 149 if exit_code: |
| 145 return exit_code | 150 return exit_code |
| 146 | 151 |
| 147 if platform.system() != 'Linux': | 152 if platform.system() != 'Linux' or args.android: |
| 148 print ('Python bindings tests are only supported on Linux.') | 153 print ('Python bindings tests are only supported on Linux.') |
| 149 return | 154 return |
| 150 | 155 |
| 151 command = ['python'] | 156 command = ['python'] |
| 152 command.append(os.path.join('mojo', 'tools', | 157 command.append(os.path.join('mojo', 'tools', |
| 153 'run_mojo_python_bindings_tests.py')) | 158 'run_mojo_python_bindings_tests.py')) |
| 154 command.append('--build-dir=' + out_dir) | 159 command.append('--build-dir=' + out_dir) |
| 155 return subprocess.call(command) | 160 return subprocess.call(command) |
| 156 | 161 |
| 157 | 162 |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 args.clang = False | 265 args.clang = False |
| 261 | 266 |
| 262 if platform.system() == 'Windows': | 267 if platform.system() == 'Windows': |
| 263 args.clang = False | 268 args.clang = False |
| 264 | 269 |
| 265 return args.func(args) | 270 return args.func(args) |
| 266 | 271 |
| 267 | 272 |
| 268 if __name__ == '__main__': | 273 if __name__ == '__main__': |
| 269 sys.exit(main()) | 274 sys.exit(main()) |
| OLD | NEW |