diff options
author | antirez <antirez@gmail.com> | 2014-11-28 11:38:14 +0100 |
---|---|---|
committer | antirez <antirez@gmail.com> | 2014-11-28 11:38:17 +0100 |
commit | bd3a51615c7752186d8a4740affedc269ce5dfc6 (patch) | |
tree | 5c34d8af6f8b30777d4b2938647bc1762c7d90cf /tests/test_helper.tcl | |
parent | 8acb3a8843c2cb92c3acaf0ce30a765649496f69 (diff) | |
download | redis-bd3a51615c7752186d8a4740affedc269ce5dfc6.tar.gz |
Test: try to cleanup still running Redis instances on exit.
It's hard to run the Redis test continuously if it leaks processes on
exceptions / errors.
Diffstat (limited to 'tests/test_helper.tcl')
-rw-r--r-- | tests/test_helper.tcl | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/tests/test_helper.tcl b/tests/test_helper.tcl index 182975571..212c95b4f 100644 --- a/tests/test_helper.tcl +++ b/tests/test_helper.tcl @@ -67,6 +67,7 @@ set ::accurate 0; # If true runs fuzz tests with more iterations set ::force_failure 0 set ::timeout 600; # 10 minutes without progresses will quit the test. set ::last_progress [clock seconds] +set ::active_servers {} ; # Pids of active Redis instances. # Set to 1 when we are running in client mode. The Redis test uses a # server-client model to run tests simultaneously. The server instance @@ -211,6 +212,7 @@ proc test_server_cron {} { puts $err show_clients_state kill_clients + force_kill_all_servers the_end } @@ -268,9 +270,14 @@ proc read_from_test_client fd { } elseif {$status eq {exception}} { puts "\[[colorstr red $status]\]: $data" kill_clients + force_kill_all_servers exit 1 } elseif {$status eq {testing}} { set ::active_clients_task($fd) "(IN PROGRESS) $data" + } elseif {$status eq {server-spawned}} { + lappend ::active_servers $data + } elseif {$status eq {server-killed}} { + set ::active_servers [lsearch -all -inline -not -exact $::active_servers $data] } else { if {!$::quiet} { puts "\[$status\]: $data" @@ -296,6 +303,13 @@ proc kill_clients {} { } } +proc force_kill_all_servers {} { + foreach p $::active_servers { + puts "Killing still running Redis server $p" + catch {exec kill -9 $p} + } +} + # A new client is idle. Remove it from the list of active clients and # if there are still test units to run, launch them. proc signal_idle_client fd { @@ -378,7 +392,8 @@ proc print_help_screen {} { "--quiet Don't show individual tests." "--single <unit> Just execute the specified unit (see next option)." "--list-tests List all the available test units." - "--clients <num> Number of test clients (16)." + "--clients <num> Number of test clients (default 16)." + "--timeout <sec> Test timeout in seconds (default 10 min)." "--force-failure Force the execution of a test that always fails." "--help Print this help screen." } "\n"] @@ -427,6 +442,9 @@ for {set j 0} {$j < [llength $argv]} {incr j} { } elseif {$opt eq {--clients}} { set ::numclients $arg incr j + } elseif {$opt eq {--timeout}} { + set ::timeout $arg + incr j } elseif {$opt eq {--help}} { print_help_screen exit 0 |