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