OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2010 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 # memcheck_analyze.py | 6 # memcheck_analyze.py |
7 | 7 |
8 ''' Given a valgrind XML file, parses errors and uniques them.''' | 8 ''' Given a valgrind XML file, parses errors and uniques them.''' |
9 | 9 |
10 import gdb_helper | 10 import gdb_helper |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 while (running and not found and | 411 while (running and not found and |
412 (firstrun or | 412 (firstrun or |
413 ((time.time() - start_time) < self.LOG_COMPLETION_TIMEOUT))): | 413 ((time.time() - start_time) < self.LOG_COMPLETION_TIMEOUT))): |
414 firstrun = False | 414 firstrun = False |
415 f.seek(0) | 415 f.seek(0) |
416 if pid: | 416 if pid: |
417 # Make sure the process is still running so we don't wait for | 417 # Make sure the process is still running so we don't wait for |
418 # 3 minutes if it was killed. See http://crbug.com/17453 | 418 # 3 minutes if it was killed. See http://crbug.com/17453 |
419 ps_out = subprocess.Popen("ps p %s" % pid, shell=True, | 419 ps_out = subprocess.Popen("ps p %s" % pid, shell=True, |
420 stdout=subprocess.PIPE).stdout | 420 stdout=subprocess.PIPE).stdout |
421 if ps_out.readlines() < 2: | 421 if len(ps_out.readlines()) < 2: |
422 running = False | 422 running = False |
423 found = find_and_truncate(f) | 423 found = find_and_truncate(f) |
424 if not running and not found: | 424 if not running and not found: |
425 logging.warn("Valgrind process PID = %s is not running but " | 425 logging.warn("Valgrind process PID = %s is not running but " |
426 "its XML log has not been finished correctly." % pid) | 426 "its XML log has not been finished correctly." % pid) |
427 if running and not found: | 427 if running and not found: |
428 time.sleep(1) | 428 time.sleep(1) |
429 f.close() | 429 f.close() |
430 if not found: | 430 if not found: |
431 badfiles.add(file) | 431 badfiles.add(file) |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
566 parser.error("no filename specified") | 566 parser.error("no filename specified") |
567 filenames = args | 567 filenames = args |
568 | 568 |
569 analyzer = MemcheckAnalyzer(options.source_dir, use_gdb=True) | 569 analyzer = MemcheckAnalyzer(options.source_dir, use_gdb=True) |
570 retcode = analyzer.Report(filenames) | 570 retcode = analyzer.Report(filenames) |
571 | 571 |
572 sys.exit(retcode) | 572 sys.exit(retcode) |
573 | 573 |
574 if __name__ == "__main__": | 574 if __name__ == "__main__": |
575 _main() | 575 _main() |
OLD | NEW |