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 cStringIO | 6 import cStringIO |
7 import hashlib | 7 import hashlib |
8 import json | 8 import json |
9 import logging | 9 import logging |
10 import os | 10 import os |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 self._execute('check', 'no_run.isolate', [], False) | 263 self._execute('check', 'no_run.isolate', [], False) |
264 self._expect_no_tree() | 264 self._expect_no_tree() |
265 self._expected_result([], None) | 265 self._expected_result([], None) |
266 | 266 |
267 def test_touch_root(self): | 267 def test_touch_root(self): |
268 self._execute('check', 'touch_root.isolate', [], False) | 268 self._execute('check', 'touch_root.isolate', [], False) |
269 self._expect_no_tree() | 269 self._expect_no_tree() |
270 self._expected_result(['touch_root.py'], None) | 270 self._expected_result(['touch_root.py'], None) |
271 | 271 |
272 def test_with_flag(self): | 272 def test_with_flag(self): |
273 self._execute('check', 'with_flag.isolate', ['-V', 'FLAG=gyp'], False) | 273 self._execute('check', 'with_flag.isolate', ['-V', 'FLAG', 'gyp'], False) |
274 self._expect_no_tree() | 274 self._expect_no_tree() |
275 self._expected_result(['with_flag.py', 'gyp'], None) | 275 self._expected_result(['with_flag.py', 'gyp'], None) |
276 | 276 |
277 | 277 |
278 class Isolate_hashtable(IsolateBase): | 278 class Isolate_hashtable(IsolateBase): |
279 LEVEL = isolate.WITH_HASH | 279 LEVEL = isolate.WITH_HASH |
280 | 280 |
281 def _expected_hash_tree(self): | 281 def _expected_hash_tree(self): |
282 """Verifies the files written in the temporary directory.""" | 282 """Verifies the files written in the temporary directory.""" |
283 expected = [v['sha-1'] for v in self._gen_files(False).itervalues()] | 283 expected = [v['sha-1'] for v in self._gen_files(False).itervalues()] |
(...skipping 26 matching lines...) Expand all Loading... |
310 self._execute('hashtable', 'no_run.isolate', [], False) | 310 self._execute('hashtable', 'no_run.isolate', [], False) |
311 self._expected_hash_tree() | 311 self._expected_hash_tree() |
312 self._expected_result([], None) | 312 self._expected_result([], None) |
313 | 313 |
314 def test_touch_root(self): | 314 def test_touch_root(self): |
315 self._execute('hashtable', 'touch_root.isolate', [], False) | 315 self._execute('hashtable', 'touch_root.isolate', [], False) |
316 self._expected_hash_tree() | 316 self._expected_hash_tree() |
317 self._expected_result(['touch_root.py'], None) | 317 self._expected_result(['touch_root.py'], None) |
318 | 318 |
319 def test_with_flag(self): | 319 def test_with_flag(self): |
320 self._execute('hashtable', 'with_flag.isolate', ['-V', 'FLAG=gyp'], False) | 320 self._execute( |
| 321 'hashtable', 'with_flag.isolate', ['-V', 'FLAG', 'gyp'], False) |
321 self._expected_hash_tree() | 322 self._expected_hash_tree() |
322 self._expected_result(['with_flag.py', 'gyp'], None) | 323 self._expected_result(['with_flag.py', 'gyp'], None) |
323 | 324 |
324 | 325 |
325 class Isolate_remap(IsolateBase): | 326 class Isolate_remap(IsolateBase): |
326 LEVEL = isolate.STATS_ONLY | 327 LEVEL = isolate.STATS_ONLY |
327 | 328 |
328 def test_fail(self): | 329 def test_fail(self): |
329 self._execute('remap', 'fail.isolate', [], False) | 330 self._execute('remap', 'fail.isolate', [], False) |
330 self._expected_tree() | 331 self._expected_tree() |
(...skipping 21 matching lines...) Expand all Loading... |
352 self._execute('remap', 'no_run.isolate', [], False) | 353 self._execute('remap', 'no_run.isolate', [], False) |
353 self._expected_tree() | 354 self._expected_tree() |
354 self._expected_result([], None) | 355 self._expected_result([], None) |
355 | 356 |
356 def test_touch_root(self): | 357 def test_touch_root(self): |
357 self._execute('remap', 'touch_root.isolate', [], False) | 358 self._execute('remap', 'touch_root.isolate', [], False) |
358 self._expected_tree() | 359 self._expected_tree() |
359 self._expected_result(['touch_root.py'], None) | 360 self._expected_result(['touch_root.py'], None) |
360 | 361 |
361 def test_with_flag(self): | 362 def test_with_flag(self): |
362 self._execute('remap', 'with_flag.isolate', ['-V', 'FLAG=gyp'], False) | 363 self._execute('remap', 'with_flag.isolate', ['-V', 'FLAG', 'gyp'], False) |
363 self._expected_tree() | 364 self._expected_tree() |
364 self._expected_result(['with_flag.py', 'gyp'], None) | 365 self._expected_result(['with_flag.py', 'gyp'], None) |
365 | 366 |
366 | 367 |
367 class Isolate_run(IsolateBase): | 368 class Isolate_run(IsolateBase): |
368 LEVEL = isolate.STATS_ONLY | 369 LEVEL = isolate.STATS_ONLY |
369 | 370 |
370 def _expect_empty_tree(self): | 371 def _expect_empty_tree(self): |
371 self.assertEquals([], self._result_tree()) | 372 self.assertEquals([], self._result_tree()) |
372 | 373 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 pass | 406 pass |
406 self._expect_empty_tree() | 407 self._expect_empty_tree() |
407 self._expected_result([], None) | 408 self._expected_result([], None) |
408 | 409 |
409 def test_touch_root(self): | 410 def test_touch_root(self): |
410 self._execute('run', 'touch_root.isolate', [], False) | 411 self._execute('run', 'touch_root.isolate', [], False) |
411 self._expect_empty_tree() | 412 self._expect_empty_tree() |
412 self._expected_result(['touch_root.py'], None) | 413 self._expected_result(['touch_root.py'], None) |
413 | 414 |
414 def test_with_flag(self): | 415 def test_with_flag(self): |
415 self._execute('run', 'with_flag.isolate', ['-V', 'FLAG=run'], False) | 416 self._execute('run', 'with_flag.isolate', ['-V', 'FLAG', 'run'], False) |
416 # Not sure about the empty tree, should be deleted. | 417 # Not sure about the empty tree, should be deleted. |
417 self._expect_empty_tree() | 418 self._expect_empty_tree() |
418 self._expected_result(['with_flag.py', 'run'], None) | 419 self._expected_result(['with_flag.py', 'run'], None) |
419 | 420 |
420 | 421 |
421 class Isolate_trace(IsolateBase): | 422 class Isolate_trace(IsolateBase): |
422 LEVEL = isolate.STATS_ONLY | 423 LEVEL = isolate.STATS_ONLY |
423 | 424 |
424 @staticmethod | 425 @staticmethod |
425 def _to_string(values): | 426 def _to_string(values): |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
486 '../../isolate.py', | 487 '../../isolate.py', |
487 ], | 488 ], |
488 }, | 489 }, |
489 }], | 490 }], |
490 ], | 491 ], |
491 } | 492 } |
492 self.assertEquals(self._to_string(expected), out) | 493 self.assertEquals(self._to_string(expected), out) |
493 | 494 |
494 def test_with_flag(self): | 495 def test_with_flag(self): |
495 out = self._execute( | 496 out = self._execute( |
496 'trace', 'with_flag.isolate', ['-V', 'FLAG=trace'], True) | 497 'trace', 'with_flag.isolate', ['-V', 'FLAG', 'trace'], True) |
497 self._expect_no_tree() | 498 self._expect_no_tree() |
498 self._expected_result(['with_flag.py', 'trace'], None) | 499 self._expected_result(['with_flag.py', 'trace'], None) |
499 expected = { | 500 expected = { |
500 'conditions': [ | 501 'conditions': [ |
501 ['OS=="%s"' % isolate.trace_inputs.get_flavor(), { | 502 ['OS=="%s"' % isolate.trace_inputs.get_flavor(), { |
502 'variables': { | 503 'variables': { |
503 isolate.trace_inputs.KEY_TRACKED: [ | 504 isolate.trace_inputs.KEY_TRACKED: [ |
504 'with_flag.py', | 505 'with_flag.py', |
505 ], | 506 ], |
506 isolate.trace_inputs.KEY_UNTRACKED: [ | 507 isolate.trace_inputs.KEY_UNTRACKED: [ |
507 'files1/', | 508 'files1/', |
508 ], | 509 ], |
509 }, | 510 }, |
510 }], | 511 }], |
511 ], | 512 ], |
512 } | 513 } |
513 self.assertEquals(self._to_string(expected), out) | 514 self.assertEquals(self._to_string(expected), out) |
514 | 515 |
515 | 516 |
516 | 517 |
517 if __name__ == '__main__': | 518 if __name__ == '__main__': |
518 VERBOSE = '-v' in sys.argv | 519 VERBOSE = '-v' in sys.argv |
519 logging.basicConfig(level=logging.DEBUG if VERBOSE else logging.ERROR) | 520 logging.basicConfig(level=logging.DEBUG if VERBOSE else logging.ERROR) |
520 unittest.main() | 521 unittest.main() |
OLD | NEW |