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 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 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 self.assertEquals(expected, actual) | 373 self.assertEquals(expected, actual) |
374 files = [ | 374 files = [ |
375 os.path.join(u'data', 'trace_inputs') + os.path.sep, | 375 os.path.join(u'data', 'trace_inputs') + os.path.sep, |
376 u'trace_inputs.py', | 376 u'trace_inputs.py', |
377 u'trace_inputs_smoke_test.py', | 377 u'trace_inputs_smoke_test.py', |
378 ] | 378 ] |
379 simplified = self.trace_inputs.extract_directories(ROOT_DIR, results.files) | 379 simplified = self.trace_inputs.extract_directories(ROOT_DIR, results.files) |
380 self.assertEquals(files, [f.path for f in simplified]) | 380 self.assertEquals(files, [f.path for f in simplified]) |
381 | 381 |
382 def test_trace_multiple(self): | 382 def test_trace_multiple(self): |
383 if sys.platform not in ('darwin', 'linux2'): | |
384 # TODO(maruel): Soon! | |
385 return | |
386 # Starts PARALLEL threads and trace PARALLEL child processes simultaneously. | 383 # Starts PARALLEL threads and trace PARALLEL child processes simultaneously. |
387 # Some are started from 'data' directory, others from this script's | 384 # Some are started from 'data' directory, others from this script's |
388 # directory. One trace fails. Verify everything still goes one. | 385 # directory. One trace fails. Verify everything still goes one. |
389 PARALLEL = 8 | 386 PARALLEL = 8 |
390 | 387 |
391 def trace(tracer, cmd, cwd, tracename): | 388 def trace(tracer, cmd, cwd, tracename): |
392 resultcode, output = tracer.trace( | 389 resultcode, output = tracer.trace( |
393 cmd, cwd, tracename, True) | 390 cmd, cwd, tracename, True) |
394 return (tracename, resultcode, output) | 391 return (tracename, resultcode, output) |
395 | 392 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 actual = results.flatten() | 451 actual = results.flatten() |
455 self.assertTrue(actual['root'].pop('pid')) | 452 self.assertTrue(actual['root'].pop('pid')) |
456 if index != BUSTED: | 453 if index != BUSTED: |
457 self.assertTrue(actual['root']['children'][0].pop('pid')) | 454 self.assertTrue(actual['root']['children'][0].pop('pid')) |
458 self.assertEquals(expected_results[index], actual) | 455 self.assertEquals(expected_results[index], actual) |
459 | 456 |
460 if __name__ == '__main__': | 457 if __name__ == '__main__': |
461 VERBOSE = '-v' in sys.argv | 458 VERBOSE = '-v' in sys.argv |
462 logging.basicConfig(level=logging.DEBUG if VERBOSE else logging.ERROR) | 459 logging.basicConfig(level=logging.DEBUG if VERBOSE else logging.ERROR) |
463 unittest.main() | 460 unittest.main() |
OLD | NEW |