From bfbfeefbb360d46c67477195c88f9e747fa1734b Mon Sep 17 00:00:00 2001 From: Sebastian Date: Fri, 4 Oct 2019 21:22:59 +0200 Subject: [PATCH] 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 --- tools/reduce.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/reduce.py b/tools/reduce.py index 2d4c29861..ffcb8274e 100755 --- a/tools/reduce.py +++ b/tools/reduce.py @@ -57,8 +57,12 @@ def runtool(): return True elif p.returncode == 0: out = comm[0] + '\n' + comm[1] - if 'error:' not in out and EXPECTED in out: + if EXPECTED in out: 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