From fb991c8e954eb34e8bcebb31399a6acf53ee310a Mon Sep 17 00:00:00 2001 From: John Sully Date: Wed, 15 Apr 2020 16:35:24 -0400 Subject: [PATCH] Log stdout and stderr for cluster tests Former-commit-id: 06143c2e8cab5c201ce41b85fcac70a36f2626c1 --- tests/instances.tcl | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/instances.tcl b/tests/instances.tcl index c3102890c..c02a6697f 100644 --- a/tests/instances.tcl +++ b/tests/instances.tcl @@ -37,7 +37,7 @@ if {[catch {cd tmp}]} { # Execute the specified instance of the server specified by 'type', using # the provided configuration file. Returns the PID of the process. -proc exec_instance {type cfgfile} { +proc exec_instance {type cfgfile dir} { if {$type eq "redis"} { set prgname keydb-server } elseif {$type eq "sentinel"} { @@ -46,10 +46,13 @@ proc exec_instance {type cfgfile} { error "Unknown instance type." } + set stdout [format "%s/%s" $dir "stdout"] + set stderr [format "%s/%s" $dir "stderr"] + if {$::valgrind} { set pid [exec valgrind --track-origins=yes --suppressions=../../../src/valgrind.sup --show-reachable=no --show-possibly-lost=no --leak-check=full ../../../src/${prgname} $cfgfile &] } else { - set pid [exec ../../../src/${prgname} $cfgfile &] + set pid [exec ../../../src/${prgname} $cfgfile > $stdout 2> $stderr &] } return $pid } @@ -92,7 +95,7 @@ proc spawn_instance {type base_port count {conf {}}} { close $cfg # Finally exec it and remember the pid for later cleanup. - set pid [exec_instance $type $cfgfile] + set pid [exec_instance $type $cfgfile $dirname] lappend ::pids $pid # Check availability @@ -502,7 +505,7 @@ proc restart_instance {type id} { # Execute the instance with its old setup and append the new pid # file for cleanup. - set pid [exec_instance $type $cfgfile] + set pid [exec_instance $type $cfgfile $dirname] set_instance_attrib $type $id pid $pid lappend ::pids $pid