Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(64)

Side by Side Diff: tools/isolate/trace_inputs_smoke_test.py

Issue 10772002: Initial refactoring to eventually support touch-only access. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tools/isolate/trace_inputs.py ('k') | tools/isolate/trace_inputs_test.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 json 6 import json
7 import logging 7 import logging
8 import os 8 import os
9 import shutil 9 import shutil
10 import subprocess 10 import subprocess
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 ], 552 ],
553 'executable': self.real_executable, 553 'executable': self.real_executable,
554 'files': [], 554 'files': [],
555 'initial_cwd': self.initial_cwd, 555 'initial_cwd': self.initial_cwd,
556 }, 556 },
557 } 557 }
558 actual = results.flatten() 558 actual = results.flatten()
559 self.assertTrue(actual['root'].pop('pid')) 559 self.assertTrue(actual['root'].pop('pid'))
560 self.assertEquals(expected, actual) 560 self.assertEquals(expected, actual)
561 561
562 def _touch_expected(self, command):
563 # Look for file that were touched but not opened, using different APIs.
564 results = self._execute_trace(
565 [sys.executable, os.path.join('trace_inputs', 'touch_only.py'), command])
566 expected = {
567 'root': {
568 'children': [],
569 'command': [
570 self.executable,
571 os.path.join('trace_inputs', 'touch_only.py'),
572 command,
573 ],
574 'executable': self.real_executable,
575 'files': [
576 {
577 'path': os.path.join(u'data', 'trace_inputs', 'touch_only.py'),
578 'size': self._size('data', 'trace_inputs', 'touch_only.py'),
579 },
580 ],
581 'initial_cwd': self.initial_cwd,
582 },
583 }
584 actual = results.flatten()
585 self.assertTrue(actual['root'].pop('pid'))
586 self.assertEquals(expected, actual)
587
588 def test_trace_touch_only_access(self):
589 self._touch_expected('access')
590
591 def test_trace_touch_only_isfile(self):
592 self._touch_expected('isfile')
593
594 def test_trace_touch_only_stat(self):
595 self._touch_expected('stat')
596
562 597
563 if __name__ == '__main__': 598 if __name__ == '__main__':
564 VERBOSE = '-v' in sys.argv 599 VERBOSE = '-v' in sys.argv
565 logging.basicConfig(level=logging.DEBUG if VERBOSE else logging.ERROR) 600 logging.basicConfig(level=logging.DEBUG if VERBOSE else logging.ERROR)
566 unittest.main() 601 unittest.main()
OLDNEW
« no previous file with comments | « tools/isolate/trace_inputs.py ('k') | tools/isolate/trace_inputs_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698