X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/d84f776e873ea93f22dc230e2b10ee70a8a6cd2e..27737964c40716d61321cb0101d5ddb641298fff:/tests/test_helper.tcl diff --git a/tests/test_helper.tcl b/tests/test_helper.tcl index 34d96606..7874256d 100644 --- a/tests/test_helper.tcl +++ b/tests/test_helper.tcl @@ -38,6 +38,7 @@ set ::all_tests { unit/scripting unit/maxmemory unit/introspection + unit/limits unit/obuf-limits unit/dump } @@ -345,6 +346,7 @@ proc print_help_screen {} { "--quiet Don't show individual tests." "--single Just execute the specified unit (see next option)." "--list-tests List all the available test units." + "--clients Number of test clients (16)." "--force-failure Force the execution of a test that always fails." "--help Print this help screen." } "\n"] @@ -390,6 +392,9 @@ for {set j 0} {$j < [llength $argv]} {incr j} { set ::client 1 set ::test_server_port $arg incr j + } elseif {$opt eq {--clients}} { + set ::numclients $arg + incr j } elseif {$opt eq {--help}} { print_help_screen exit 0 @@ -399,6 +404,18 @@ for {set j 0} {$j < [llength $argv]} {incr j} { } } +# With the parallel test running multiple Redis instances at the same time +# we need a fast enough computer, otherwise a lot of tests may generate +# false positives. +# If the computer is too slow we revert the sequetial test without any +# parallelism, that is, clients == 1. +proc is_a_slow_computer {} { + set start [clock milliseconds] + for {set j 0} {$j < 1000000} {incr j} {} + set elapsed [expr [clock milliseconds]-$start] + expr {$elapsed > 200} +} + if {$::client} { if {[catch { test_client_main $::test_server_port } err]} { set estr "Executing test client: $err.\n$::errorInfo" @@ -408,6 +425,11 @@ if {$::client} { exit 1 } } else { + if {[is_a_slow_computer]} { + puts "** SLOW COMPUTER ** Using a single client to avoid false positives." + set ::numclients 1 + } + if {[catch { test_server_main } err]} { if {[string length $err] > 0} { # only display error when not generated by the test suite