| 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 return subprocess.call(['ninja', '-j', '1000', '-l', '100', '-C', out_dir, | 101 return subprocess.call(['ninja', '-j', '1000', '-l', '100', '-C', out_dir, |
| 102 'root']) | 102 'root']) |
| 103 else: | 103 else: |
| 104 return subprocess.call(['ninja', '-C', out_dir, 'root']) | 104 return subprocess.call(['ninja', '-C', out_dir, 'root']) |
| 105 | 105 |
| 106 | 106 |
| 107 def run_unittests(args): | 107 def run_unittests(args): |
| 108 out_dir = get_out_dir(args) | 108 out_dir = get_out_dir(args) |
| 109 print 'Running unit tests in %s ...' % out_dir | 109 print 'Running unit tests in %s ...' % out_dir |
| 110 command = ['python'] | 110 command = ['python'] |
| 111 if platform.system() == 'Linux': | 111 if platform.system() == 'Linux' and not args.android: |
| 112 command.append('./testing/xvfb.py') | 112 command.append('./testing/xvfb.py') |
| 113 command.append(out_dir) | 113 command.append(out_dir) |
| 114 | 114 |
| 115 command.append(os.path.join('mojo', 'tools', 'test_runner.py')) | 115 command.append(os.path.join('mojo', 'tools', 'test_runner.py')) |
| 116 command.append(os.path.join('mojo', 'tools', 'data', 'unittests')) | 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')) |
| 117 command.append(out_dir) | 121 command.append(out_dir) |
| 118 command.append('mojob_test_successes') | 122 command.append('mojob_test_successes') |
| 119 return subprocess.call(command) | 123 return subprocess.call(command) |
| 120 | 124 |
| 121 def run_apptests(args): | 125 def run_apptests(args): |
| 122 out_dir = get_out_dir(args) | 126 out_dir = get_out_dir(args) |
| 127 if args.android: |
| 128 return 0 |
| 129 |
| 123 print 'Running application tests in %s ...' % out_dir | 130 print 'Running application tests in %s ...' % out_dir |
| 124 command = ['python'] | 131 command = ['python'] |
| 125 if platform.system() == 'Linux': | 132 if platform.system() == 'Linux': |
| 126 command.append('./testing/xvfb.py') | 133 command.append('./testing/xvfb.py') |
| 127 command.append(out_dir) | 134 command.append(out_dir) |
| 128 | 135 |
| 129 command.append(os.path.join('mojo', 'tools', 'apptest_runner.py')) | 136 command.append(os.path.join('mojo', 'tools', 'apptest_runner.py')) |
| 130 command.append(os.path.join('mojo', 'tools', 'data', 'apptests')) | 137 command.append(os.path.join('mojo', 'tools', 'data', 'apptests')) |
| 131 command.append(out_dir) | 138 command.append(out_dir) |
| 132 return subprocess.call(command) | 139 return subprocess.call(command) |
| 133 | 140 |
| 134 def run_skytests(args): | 141 def run_skytests(args): |
| 135 out_dir = get_out_dir(args) | 142 out_dir = get_out_dir(args) |
| 136 if platform.system() != 'Linux': | 143 if platform.system() != 'Linux' or args.android: |
| 137 return 0 | 144 return 0 |
| 138 | 145 |
| 139 command = [] | 146 command = [] |
| 140 command.append('./testing/xvfb.py') | 147 command.append('./testing/xvfb.py') |
| 141 command.append(out_dir) | 148 command.append(out_dir) |
| 142 command.append('sky/tools/test_sky') | 149 command.append('sky/tools/test_sky') |
| 143 command.append('-t') | 150 command.append('-t') |
| 144 command.append('Debug' if args.debug else 'Release') | 151 command.append('Debug' if args.debug else 'Release') |
| 145 command.append('--no-new-test-results') | 152 command.append('--no-new-test-results') |
| 146 command.append('--no-show-results') | 153 command.append('--no-show-results') |
| (...skipping 23 matching lines...) Expand all Loading... |
| 170 | 177 |
| 171 def run_pytests(args): | 178 def run_pytests(args): |
| 172 out_dir = get_out_dir(args) | 179 out_dir = get_out_dir(args) |
| 173 print 'Running python tests in %s ...' % out_dir | 180 print 'Running python tests in %s ...' % out_dir |
| 174 command = ['python'] | 181 command = ['python'] |
| 175 command.append(os.path.join('mojo', 'tools', 'run_mojo_python_tests.py')) | 182 command.append(os.path.join('mojo', 'tools', 'run_mojo_python_tests.py')) |
| 176 exit_code = subprocess.call(command) | 183 exit_code = subprocess.call(command) |
| 177 if exit_code: | 184 if exit_code: |
| 178 return exit_code | 185 return exit_code |
| 179 | 186 |
| 180 if platform.system() != 'Linux': | 187 if platform.system() != 'Linux' or args.android: |
| 181 print ('Python bindings tests are only supported on Linux.') | 188 print ('Python bindings tests are only supported on Linux.') |
| 182 return | 189 return |
| 183 | 190 |
| 184 command = ['python'] | 191 command = ['python'] |
| 185 command.append(os.path.join('mojo', 'tools', | 192 command.append(os.path.join('mojo', 'tools', |
| 186 'run_mojo_python_bindings_tests.py')) | 193 'run_mojo_python_bindings_tests.py')) |
| 187 command.append('--build-dir=' + out_dir) | 194 command.append('--build-dir=' + out_dir) |
| 188 return subprocess.call(command) | 195 return subprocess.call(command) |
| 189 | 196 |
| 190 | 197 |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 args.clang = False | 319 args.clang = False |
| 313 | 320 |
| 314 if platform.system() == 'Windows': | 321 if platform.system() == 'Windows': |
| 315 args.clang = False | 322 args.clang = False |
| 316 | 323 |
| 317 return args.func(args) | 324 return args.func(args) |
| 318 | 325 |
| 319 | 326 |
| 320 if __name__ == '__main__': | 327 if __name__ == '__main__': |
| 321 sys.exit(main()) | 328 sys.exit(main()) |
| OLD | NEW |