X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/6f8a32d5c71350afa1b64f2b77667e94b8e9773a..6856c7b4d64f6afc00249128fc952c575d8c84bf:/tests/support/server.tcl diff --git a/tests/support/server.tcl b/tests/support/server.tcl index 39038bd6..c2d7132d 100644 --- a/tests/support/server.tcl +++ b/tests/support/server.tcl @@ -1,5 +1,6 @@ set ::global_overrides {} set ::tags {} +set ::valgrind_errors {} proc error_and_quit {config_file error} { puts "!!COULD NOT START REDIS-SERVER\n" @@ -16,11 +17,9 @@ proc check_valgrind_errors stderr { close $fd if {![regexp -- {ERROR SUMMARY: 0 errors} $buf] || - ![regexp -- {definitely lost: 0 bytes} $buf]} { - puts "*** VALGRIND ERRORS ***" - puts $buf - puts "--- press enter to continue ---" - gets stdin + (![regexp -- {definitely lost: 0 bytes} $buf] && + ![regexp -- {no leaks are possible} $buf])} { + send_data_packet $::test_server_fd err "Valgrind error: $buf\n" } } @@ -155,7 +154,8 @@ proc start_server {options {code undefined}} { dict set config dir [tmpdir server] # start every server on a different port - dict set config port [incr ::port] + set ::port [find_available_port [expr {$::port+1}]] + dict set config port $::port # apply overrides from global space and arguments foreach {directive arguments} [concat $::global_overrides $overrides] { @@ -175,14 +175,14 @@ proc start_server {options {code undefined}} { set stderr [format "%s/%s" [dict get $config "dir"] "stderr"] if {$::valgrind} { - exec valgrind src/redis-server $config_file > $stdout 2> $stderr & + exec valgrind --suppressions=src/valgrind.sup src/redis-server $config_file > $stdout 2> $stderr & } else { exec src/redis-server $config_file > $stdout 2> $stderr & } # check that the server actually started # ugly but tries to be as fast as possible... - set retrynum 20 + set retrynum 100 set serverisup 0 if {$::verbose} { @@ -214,7 +214,7 @@ proc start_server {options {code undefined}} { # find out the pid while {![info exists pid]} { - regexp {^\[(\d+)\]} [exec head -n1 $stdout] _ pid + regexp {\[(\d+)\]} [exec cat $stdout] _ pid after 100 }