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 import hashlib | 6 import hashlib |
7 import json | 7 import json |
8 import logging | 8 import logging |
9 import os | 9 import os |
10 import re | 10 import re |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 '--', | 218 '--', |
219 sys.executable, os.path.join(ROOT_DIR, 'isolate_test.py'), '--ok', | 219 sys.executable, os.path.join(ROOT_DIR, 'isolate_test.py'), '--ok', |
220 ] | 220 ] |
221 out = self._execute(cmd, True) | 221 out = self._execute(cmd, True) |
222 self._expected_tree(['result', 'result.log']) | 222 self._expected_tree(['result', 'result.log']) |
223 # The 'result.log' log is OS-specific so we can't read it but we can read | 223 # The 'result.log' log is OS-specific so we can't read it but we can read |
224 # the gyp result. | 224 # the gyp result. |
225 # cmd[0] is not generated from infiles[0] so it's not using a relative path. | 225 # cmd[0] is not generated from infiles[0] so it's not using a relative path. |
226 self._expected_result( | 226 self._expected_result( |
227 False, ['isolate_test.py'], ['isolate_test.py', '--ok'], False) | 227 False, ['isolate_test.py'], ['isolate_test.py', '--ok'], False) |
228 if sys.platform == 'linux2': | 228 expected = ( |
229 expected = ( | 229 "{\n 'variables': {\n" |
230 "{\n 'variables': {\n" | 230 " 'isolate_files': [\n" |
231 " 'isolate_files': [\n" | 231 " '<(DEPTH)/isolate_test.py',\n" |
232 " '<(DEPTH)/isolate_test.py',\n" | 232 " ],\n" |
233 " ],\n" | 233 " 'isolate_dirs': [\n" |
234 " 'isolate_dirs': [\n" | 234 " ],\n },\n},\n") |
235 " ],\n },\n},\n") | |
236 else: | |
237 # TODO(maruel): BUG with relative paths on darwin. | |
238 expected = ( | |
239 "{\n 'variables': {\n" | |
240 " 'isolate_files': [\n" | |
241 " ],\n" | |
242 " 'isolate_dirs': [\n" | |
243 " ],\n },\n},\n") | |
244 self.assertEquals(expected, out) | 235 self.assertEquals(expected, out) |
245 | 236 |
246 | 237 |
247 def main(): | 238 def main(): |
248 global VERBOSE | 239 global VERBOSE |
249 VERBOSE = '-v' in sys.argv | 240 VERBOSE = '-v' in sys.argv |
250 level = logging.DEBUG if VERBOSE else logging.ERROR | 241 level = logging.DEBUG if VERBOSE else logging.ERROR |
251 logging.basicConfig(level=level) | 242 logging.basicConfig(level=level) |
252 if len(sys.argv) == 1: | 243 if len(sys.argv) == 1: |
253 unittest.main() | 244 unittest.main() |
254 if sys.argv[1] == '--ok': | 245 if sys.argv[1] == '--ok': |
255 return 0 | 246 return 0 |
256 if sys.argv[1] == '--fail': | 247 if sys.argv[1] == '--fail': |
257 return 1 | 248 return 1 |
258 | 249 |
259 unittest.main() | 250 unittest.main() |
260 | 251 |
261 | 252 |
262 if __name__ == '__main__': | 253 if __name__ == '__main__': |
263 sys.exit(main()) | 254 sys.exit(main()) |
OLD | NEW |