| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # coding=utf-8 | 2 # coding=utf-8 |
| 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 import StringIO | 7 import StringIO |
| 8 import logging | 8 import logging |
| 9 import os | 9 import os |
| 10 import tempfile | 10 import tempfile |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 if not files: | 299 if not files: |
| 300 expected['root']['command'] = None | 300 expected['root']['command'] = None |
| 301 expected['root']['executable'] = None | 301 expected['root']['executable'] = None |
| 302 self.assertContext(lines, initial_cwd, expected, False) | 302 self.assertContext(lines, initial_cwd, expected, False) |
| 303 | 303 |
| 304 def test_execve(self): | 304 def test_execve(self): |
| 305 lines = [ | 305 lines = [ |
| 306 (self._ROOT_PID, | 306 (self._ROOT_PID, |
| 307 'execve("/home/foo_bar_user/out/unittests", ' | 307 'execve("/home/foo_bar_user/out/unittests", ' |
| 308 '["/home/foo_bar_user/out/unittests", ' | 308 '["/home/foo_bar_user/out/unittests", ' |
| 309 '"--gtest_filter=AtExitTest.Basic"], [/* 44 vars */]) = 0'), | 309 '"--random-flag"], [/* 44 vars */]) = 0'), |
| 310 (self._ROOT_PID, | 310 (self._ROOT_PID, |
| 311 'open("out/unittests.log", O_WRONLY|O_CREAT|O_APPEND, 0666) = 8'), | 311 'open("out/unittests.log", O_WRONLY|O_CREAT|O_APPEND, 0666) = 8'), |
| 312 ] | 312 ] |
| 313 files = [ | 313 files = [ |
| 314 { | 314 { |
| 315 'mode': trace_inputs.Results.File.READ, | 315 'mode': trace_inputs.Results.File.READ, |
| 316 'path': u'/home/foo_bar_user/out/unittests', | 316 'path': u'/home/foo_bar_user/out/unittests', |
| 317 'size': -1, | 317 'size': -1, |
| 318 }, | 318 }, |
| 319 { | 319 { |
| 320 'mode': trace_inputs.Results.File.WRITE, | 320 'mode': trace_inputs.Results.File.WRITE, |
| 321 'path': u'/home/foo_bar_user/src/out/unittests.log', | 321 'path': u'/home/foo_bar_user/src/out/unittests.log', |
| 322 'size': -1, | 322 'size': -1, |
| 323 }, | 323 }, |
| 324 ] | 324 ] |
| 325 command = [ | 325 command = [ |
| 326 '/home/foo_bar_user/out/unittests', '--gtest_filter=AtExitTest.Basic', | 326 '/home/foo_bar_user/out/unittests', '--random-flag', |
| 327 ] | 327 ] |
| 328 self._test_lines(lines, u'/home/foo_bar_user/src', files, command) | 328 self._test_lines(lines, u'/home/foo_bar_user/src', files, command) |
| 329 | 329 |
| 330 def test_empty(self): | 330 def test_empty(self): |
| 331 try: | 331 try: |
| 332 self._load_context([], None) | 332 self._load_context([], None) |
| 333 self.fail() | 333 self.fail() |
| 334 except trace_inputs.TracingFailure, e: | 334 except trace_inputs.TracingFailure, e: |
| 335 expected = ( | 335 expected = ( |
| 336 'Found internal inconsitency in process lifetime detection ' | 336 'Found internal inconsitency in process lifetime detection ' |
| (...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 794 } | 794 } |
| 795 self.assertContext(lines, ROOT_DIR, expected, False) | 795 self.assertContext(lines, ROOT_DIR, expected, False) |
| 796 | 796 |
| 797 | 797 |
| 798 if __name__ == '__main__': | 798 if __name__ == '__main__': |
| 799 logging.basicConfig( | 799 logging.basicConfig( |
| 800 level=logging.DEBUG if '-v' in sys.argv else logging.ERROR) | 800 level=logging.DEBUG if '-v' in sys.argv else logging.ERROR) |
| 801 if '-v' in sys.argv: | 801 if '-v' in sys.argv: |
| 802 unittest.TestCase.maxDiff = None | 802 unittest.TestCase.maxDiff = None |
| 803 unittest.main() | 803 unittest.main() |
| OLD | NEW |