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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 | 97 |
98 return subprocess.call(['ninja', '-j', '1000', '-l', '100', '-C', out_dir, | 98 return subprocess.call(['ninja', '-j', '1000', '-l', '100', '-C', out_dir, |
99 'root']) | 99 'root']) |
100 else: | 100 else: |
101 return subprocess.call(['ninja', '-C', out_dir, 'root']) | 101 return subprocess.call(['ninja', '-C', out_dir, 'root']) |
102 | 102 |
103 | 103 |
104 def run_unittests(args): | 104 def run_unittests(args): |
105 out_dir = get_out_dir(args) | 105 out_dir = get_out_dir(args) |
106 print 'Running unit tests in %s ...' % out_dir | 106 print 'Running unit tests in %s ...' % out_dir |
107 command = [] | 107 command = ['python'] |
108 if platform.system() == 'Linux': | 108 if platform.system() == 'Linux': |
109 command.append('./testing/xvfb.py') | 109 command.append('./testing/xvfb.py') |
110 command.append(out_dir) | 110 command.append(out_dir) |
111 | 111 |
112 command.append(os.path.join('mojo', 'tools', 'test_runner.py')) | 112 command.append(os.path.join('mojo', 'tools', 'test_runner.py')) |
113 command.append(os.path.join('mojo', 'tools', 'data', 'unittests')) | 113 command.append(os.path.join('mojo', 'tools', 'data', 'unittests')) |
114 command.append(out_dir) | 114 command.append(out_dir) |
115 command.append('mojob_test_successes') | 115 command.append('mojob_test_successes') |
116 return subprocess.call(command) | 116 return subprocess.call(command) |
117 | 117 |
118 | 118 |
119 def run_skytests(args): | 119 def run_skytests(args): |
120 out_dir = get_out_dir(args) | 120 out_dir = get_out_dir(args) |
121 if platform.system() != 'Linux': | 121 if platform.system() != 'Linux': |
122 return 0 | 122 return 0 |
123 | 123 |
124 command = [] | 124 command = [] |
125 command.append('./testing/xvfb.py') | 125 command.append('./testing/xvfb.py') |
126 command.append(out_dir) | 126 command.append(out_dir) |
127 command.append('sky/tools/test_sky') | 127 command.append('sky/tools/test_sky') |
128 command.append('-t') | 128 command.append('-t') |
129 command.append('Debug' if args.debug else 'Release') | 129 command.append('Debug' if args.debug else 'Release') |
130 command.append('--no-new-test-results') | 130 command.append('--no-new-test-results') |
131 command.append('--no-show-results') | 131 command.append('--no-show-results') |
132 command.append('--verbose') | 132 command.append('--verbose') |
133 return subprocess.call(command) | 133 return subprocess.call(command) |
134 | 134 |
135 | 135 |
136 def run_pytests(args): | 136 def run_pytests(args): |
| 137 if platform.system() == 'Windows': |
| 138 print ('pytests aren\'t supported on Windows because the Python bindings ' |
| 139 'aren\'t build there.') |
| 140 return |
137 out_dir = get_out_dir(args) | 141 out_dir = get_out_dir(args) |
138 print 'Running python tests in %s ...' % out_dir | 142 print 'Running python tests in %s ...' % out_dir |
139 command = [] | 143 command = ['python'] |
140 command.append(os.path.join('mojo', 'tools', 'run_mojo_python_tests.py')) | 144 command.append(os.path.join('mojo', 'tools', 'run_mojo_python_tests.py')) |
141 exit_code = subprocess.call(command) | 145 exit_code = subprocess.call(command) |
142 if exit_code: | 146 if exit_code: |
143 return exit_code | 147 return exit_code |
144 | 148 |
145 command = [] | 149 command = ['python'] |
146 command.append(os.path.join('mojo', 'tools', | 150 command.append(os.path.join('mojo', 'tools', |
147 'run_mojo_python_bindings_tests.py')) | 151 'run_mojo_python_bindings_tests.py')) |
148 command.append('--build-dir=' + out_dir) | 152 command.append('--build-dir=' + out_dir) |
149 return subprocess.call(command) | 153 return subprocess.call(command) |
150 | 154 |
151 | 155 |
152 def test(args): | 156 def test(args): |
153 exit_code = run_unittests(args) | 157 exit_code = run_unittests(args) |
154 if exit_code: | 158 if exit_code: |
155 return exit_code | 159 return exit_code |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 args.clang = False | 258 args.clang = False |
255 | 259 |
256 if platform.system() == 'Windows': | 260 if platform.system() == 'Windows': |
257 args.clang = False | 261 args.clang = False |
258 | 262 |
259 return args.func(args) | 263 return args.func(args) |
260 | 264 |
261 | 265 |
262 if __name__ == '__main__': | 266 if __name__ == '__main__': |
263 sys.exit(main()) | 267 sys.exit(main()) |
OLD | NEW |