diff options
author | antirez <antirez@gmail.com> | 2012-05-11 17:26:09 +0200 |
---|---|---|
committer | antirez <antirez@gmail.com> | 2012-05-12 09:33:19 +0200 |
commit | 064223107e3ce2a8cae6e35245bb1037ff5b984c (patch) | |
tree | a0678684275936f9a2770214ff68c4ce4d2af019 /tests/test_helper.tcl | |
parent | 25496f47005f87dfb29ca4b797927b3cba555225 (diff) | |
download | redis-064223107e3ce2a8cae6e35245bb1037ff5b984c.tar.gz |
If the computer running the Redis test is slow, we revert to --clients 1 to avoid false positives.
Diffstat (limited to 'tests/test_helper.tcl')
-rw-r--r-- | tests/test_helper.tcl | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/test_helper.tcl b/tests/test_helper.tcl index 598a39291..7874256da 100644 --- a/tests/test_helper.tcl +++ b/tests/test_helper.tcl @@ -404,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" @@ -413,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 |