Skip to content

Commit 959a670

Browse files
committed
bisect_hang.py: print timing information for each file [skip ci]
1 parent c3e9383 commit 959a670

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

tools/bisect/bisect_hang.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,21 @@ def run(cppcheck_path, options, elapsed_time=None):
1212
cmd = options.split()
1313
cmd.insert(0, cppcheck_path)
1414
print('running {}'.format(cppcheck_path))
15-
with subprocess.Popen(cmd, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) as p:
15+
with subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL) as p:
1616
try:
17-
p.communicate(timeout=timeout)
17+
stdout, _ = p.communicate(timeout=timeout)
1818
if p.returncode != 0:
1919
print('error')
2020
return None
2121
print('done')
2222
except subprocess.TimeoutExpired:
2323
print('timeout')
2424
p.kill()
25-
p.communicate()
25+
stdout, _ = p.communicate()
2626
return False
27+
finally:
28+
stdout = stdout.decode(encoding='utf-8', errors='ignore').replace('\r\n', '\n')
29+
print(stdout)
2730

2831
return True
2932

@@ -33,6 +36,10 @@ def run(cppcheck_path, options, elapsed_time=None):
3336
options = sys.argv[2]
3437
if '--error-exitcode=0' not in options:
3538
options += ' --error-exitcode=0'
39+
if '--showtime=file' not in options:
40+
options += ' --showtime=file-total'
41+
if '-q' not in options:
42+
options += ' -q'
3643
if len(sys.argv) >= 4:
3744
elapsed_time = float(sys.argv[3])
3845
else:

0 commit comments

Comments
 (0)