reduce.py: Allow reducing error messages, print output in case of error (#2179)

* reduce.py: Allow reducing error messages, print output in case of error

Allow reducing code that triggers (false positive) error messages.
Print Cppcheck output in case Cppcheck returns unsuccessfully and no
segfault is expected. This helps fixing messed up command lines (for
example issues with the path).

* Use "else" as suggested
This commit is contained in:
Sebastian 2019-10-04 21:22:59 +02:00 committed by amai2012
parent fcccd5f42e
commit bfbfeefbb3
1 changed files with 5 additions and 1 deletions

View File

@ -57,8 +57,12 @@ def runtool():
return True return True
elif p.returncode == 0: elif p.returncode == 0:
out = comm[0] + '\n' + comm[1] out = comm[0] + '\n' + comm[1]
if 'error:' not in out and EXPECTED in out: if EXPECTED in out:
return True return True
else:
# Something could be wrong, for example the command line for Cppcheck (CMD).
# Print the output to give a hint how to fix it.
print('Error: {}\n{}'.format(comm[0], comm[1]))
return False return False