diff options
author | Pieter Noordhuis <pcnoordhuis@gmail.com> | 2010-12-10 16:13:21 +0100 |
---|---|---|
committer | Pieter Noordhuis <pcnoordhuis@gmail.com> | 2010-12-10 16:13:21 +0100 |
commit | 6f8a32d5c71350afa1b64f2b77667e94b8e9773a (patch) | |
tree | c2e159589381f6da16d5929f7dfe97d45715e372 /tests/test_helper.tcl | |
parent | a5be65f71c927601260f4518236cbc7bc3d87965 (diff) | |
download | redis-6f8a32d5c71350afa1b64f2b77667e94b8e9773a.tar.gz |
Be less verbose in testing; improve error handling
Diffstat (limited to 'tests/test_helper.tcl')
-rw-r--r-- | tests/test_helper.tcl | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/tests/test_helper.tcl b/tests/test_helper.tcl index 4c207f643..1852fa7b5 100644 --- a/tests/test_helper.tcl +++ b/tests/test_helper.tcl @@ -13,13 +13,17 @@ set ::host 127.0.0.1 set ::port 16379 set ::traceleaks 0 set ::valgrind 0 +set ::verbose 0 set ::denytags {} set ::allowtags {} set ::external 0; # If "1" this means, we are running against external instance set ::file ""; # If set, runs only the tests in this comma separated list +set ::curfile ""; # Hold the filename of the current suite proc execute_tests name { - source "tests/$name.tcl" + set path "tests/$name.tcl" + set ::curfile $path + source $path } # Setup a list to hold a stack of server configs. When calls to start_server @@ -147,9 +151,27 @@ proc main {} { } cleanup - puts "\n[expr $::passed+$::failed] tests, $::passed passed, $::failed failed" - if {$::failed > 0} { - puts "\n*** WARNING!!! $::failed FAILED TESTS ***\n" + puts "\n[expr $::num_tests] tests, $::num_passed passed, $::num_failed failed\n" + if {$::num_failed > 0} { + set curheader "" + puts "Failures:" + foreach {test} $::tests_failed { + set header [lindex $test 0] + append header " (" + append header [join [lindex $test 1] ","] + append header ")" + + if {$curheader ne $header} { + set curheader $header + puts "\n$curheader:" + } + + set name [lindex $test 2] + set msg [lindex $test 3] + puts "- $name: $msg" + } + + puts "" exit 1 } } @@ -177,6 +199,8 @@ for {set j 0} {$j < [llength $argv]} {incr j} { } elseif {$opt eq {--port}} { set ::port $arg incr j + } elseif {$opt eq {--verbose}} { + set ::verbose 1 } else { puts "Wrong argument: $opt" exit 1 @@ -187,7 +211,7 @@ if {[catch { main } err]} { if {[string length $err] > 0} { # only display error when not generated by the test suite if {$err ne "exception"} { - puts $err + puts $::errorInfo } exit 1 } |