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 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
549 self.assertEquals(expected, out) | 549 self.assertEquals(expected, out) |
550 | 550 |
551 def test_touch_root(self): | 551 def test_touch_root(self): |
552 out = self._execute('trace', 'touch_root.isolate', [], True) | 552 out = self._execute('trace', 'touch_root.isolate', [], True) |
553 self.assertEquals('', out) | 553 self.assertEquals('', out) |
554 self._expect_no_tree() | 554 self._expect_no_tree() |
555 self._expect_results(['touch_root.py'], None, None) | 555 self._expect_results(['touch_root.py'], None, None) |
556 expected = self._wrap_in_condition( | 556 expected = self._wrap_in_condition( |
557 { | 557 { |
558 isolate.isolate_common.KEY_TRACKED: [ | 558 isolate.isolate_common.KEY_TRACKED: [ |
| 559 '../../isolate.py', |
559 'touch_root.py', | 560 'touch_root.py', |
560 '../../isolate.py', | |
561 ], | 561 ], |
562 }) | 562 }) |
563 out = self._execute('read', 'touch_root.isolate', [], True) | 563 out = self._execute('read', 'touch_root.isolate', [], True) |
564 self.assertEquals(expected, out) | 564 self.assertEquals(expected, out) |
565 | 565 |
566 def test_with_flag(self): | 566 def test_with_flag(self): |
567 out = self._execute( | 567 out = self._execute( |
568 'trace', 'with_flag.isolate', ['-V', 'FLAG', 'trace'], True) | 568 'trace', 'with_flag.isolate', ['-V', 'FLAG', 'trace'], True) |
569 self.assertEquals('', out) | 569 self.assertEquals('', out) |
570 self._expect_no_tree() | 570 self._expect_no_tree() |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
696 ] | 696 ] |
697 self.assertEquals(files, list_files_tree(self.tempdir)) | 697 self.assertEquals(files, list_files_tree(self.tempdir)) |
698 | 698 |
699 def test_read_trace(self): | 699 def test_read_trace(self): |
700 self._execute('trace', [self.filename()], False) | 700 self._execute('trace', [self.filename()], False) |
701 # Read the trace before cleaning up. No need to specify self.filename() | 701 # Read the trace before cleaning up. No need to specify self.filename() |
702 # because add the needed information is in the .state file. | 702 # because add the needed information is in the .state file. |
703 output = self._execute('read', [], True) | 703 output = self._execute('read', [], True) |
704 expected = { | 704 expected = { |
705 isolate.isolate_common.KEY_TRACKED: [ | 705 isolate.isolate_common.KEY_TRACKED: [ |
| 706 '../../isolate.py', |
706 'touch_root.py', | 707 'touch_root.py', |
707 '../../isolate.py', | |
708 ], | 708 ], |
709 } | 709 } |
710 self.assertEquals(self._wrap_in_condition(expected), output) | 710 self.assertEquals(self._wrap_in_condition(expected), output) |
711 | 711 |
712 # Clean the directory from the logs, which are OS-specific. | 712 # Clean the directory from the logs, which are OS-specific. |
713 isolate.trace_inputs.get_api().clean_trace( | 713 isolate.trace_inputs.get_api().clean_trace( |
714 os.path.join(self.tempdir, 'isolate_smoke_test.results.log')) | 714 os.path.join(self.tempdir, 'isolate_smoke_test.results.log')) |
715 files = [ | 715 files = [ |
716 'isolate_smoke_test.results', | 716 'isolate_smoke_test.results', |
717 'isolate_smoke_test.state', | 717 'isolate_smoke_test.state', |
718 os.path.join('root', 'data', 'isolate', 'touch_root.isolate'), | 718 os.path.join('root', 'data', 'isolate', 'touch_root.isolate'), |
719 os.path.join('root', 'data', 'isolate', 'touch_root.py'), | 719 os.path.join('root', 'data', 'isolate', 'touch_root.py'), |
720 os.path.join('root', 'isolate.py'), | 720 os.path.join('root', 'isolate.py'), |
721 ] | 721 ] |
722 self.assertEquals(files, list_files_tree(self.tempdir)) | 722 self.assertEquals(files, list_files_tree(self.tempdir)) |
723 | 723 |
724 | 724 |
725 if __name__ == '__main__': | 725 if __name__ == '__main__': |
726 VERBOSE = '-v' in sys.argv | 726 VERBOSE = '-v' in sys.argv |
727 logging.basicConfig(level=logging.DEBUG if VERBOSE else logging.ERROR) | 727 logging.basicConfig(level=logging.DEBUG if VERBOSE else logging.ERROR) |
728 unittest.main() | 728 unittest.main() |
OLD | NEW |