X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/04e2410d2dcfc14c938ac56877929e96baa99d28..7551e23716dbedb3561a5e5e4c590247f6b4e50d:/tests/test_helper.tcl diff --git a/tests/test_helper.tcl b/tests/test_helper.tcl index 6624ff28..4f3cf01e 100644 --- a/tests/test_helper.tcl +++ b/tests/test_helper.tcl @@ -31,6 +31,8 @@ set ::all_tests { integration/aof unit/pubsub unit/slowlog + unit/scripting + unit/maxmemory } # Index to the next test to run in the ::all_tests list. set ::next_test 0 @@ -140,7 +142,7 @@ proc s {args} { } proc cleanup {} { - puts -nonewline "Cleanup: warning may take some time... " + puts -nonewline "Cleanup: may take some time... " flush stdout catch {exec rm -rf {*}[glob tests/tmp/redis.conf.*]} catch {exec rm -rf {*}[glob tests/tmp/server.*]} @@ -277,13 +279,15 @@ proc the_end {} { puts " $time seconds - $name" } if {[llength $::failed_tests]} { - puts "!!! WARNING: The following tests failed\n" + puts "\n[colorstr bold-red {!!! WARNING}] The following tests failed:\n" foreach failed $::failed_tests { puts "*** $failed" } + cleanup exit 1 } else { puts "\n[colorstr bold-white {\o/}] [colorstr bold-green {All tests passed without errors!}]\n" + cleanup exit 0 } } @@ -312,6 +316,17 @@ proc send_data_packet {fd status data} { flush $fd } +proc print_help_screen {} { + puts [join { + "--valgrind Run the test over valgrind." + "--accurate Run slow randomized tests for more iterations." + "--single Just execute the specified unit (see next option)." + "--list-tests List all the available test units." + "--force-failure Force the execution of a test that always fails." + "--help Print this help screen." + } "\n"] +} + # parse arguments for {set j 0} {$j < [llength $argv]} {incr j} { set opt [lindex $argv $j] @@ -327,9 +342,6 @@ for {set j 0} {$j < [llength $argv]} {incr j} { incr j } elseif {$opt eq {--valgrind}} { set ::valgrind 1 - } elseif {$opt eq {--file}} { - set ::file $arg - incr j } elseif {$opt eq {--host}} { set ::external 1 set ::host $arg @@ -337,8 +349,6 @@ 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 } elseif {$opt eq {--accurate}} { set ::accurate 1 } elseif {$opt eq {--force-failure}} { @@ -356,7 +366,7 @@ for {set j 0} {$j < [llength $argv]} {incr j} { set ::test_server_port $arg incr j } elseif {$opt eq {--help}} { - puts "TODO print an help screen" + print_help_screen exit 0 } else { puts "Wrong argument: $opt"