From e88276bf0e334c97e301f778926ee0f7beb44807 Mon Sep 17 00:00:00 2001 From: Stefan Kalkowski Date: Fri, 23 Mar 2012 12:19:15 +0100 Subject: [PATCH] Fix compare_output_to in run tool (fix #162) In the compare_output_to function in the run tool a check was introduced, whether the given arguments are empty, and if so if the output string is it too. Without this patch compare_output_to succeeded when the given pattern was empty but output wasn't. Please refer to issue #162. --- tool/run | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tool/run b/tool/run index e4e9d76c0d..456d7da16c 100755 --- a/tool/run +++ b/tool/run @@ -188,6 +188,21 @@ proc compare_output_to { good } { incr i } + # + # if $good is empty the foreach-loop isn't entered + # so we've to check for it separately + # + if {![llength $good_list] && [llength $output_list]} { + foreach output_line $output_list { + set output_line [strip_whitespace $output_line] + puts "" + puts stderr "Line $i of output is unexpected" + puts stderr " got: '$output_line'" + incr mismatch_cnt + incr i + } + } + if {$mismatch_cnt > 0} { puts "Error: Test failed, $mismatch_cnt unexpected lines of output" exit -1