Add --dump-logs tests option. (#8459)
Dump the entire server log if a test failed, to easy troubleshooting with no access to log files.
This commit is contained in:
parent
be83bb13a8
commit
5b8350aaaa
24
.github/workflows/daily.yml
vendored
24
.github/workflows/daily.yml
vendored
@ -21,7 +21,7 @@ jobs:
|
|||||||
- name: test
|
- name: test
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get install tcl8.5
|
sudo apt-get install tcl8.5
|
||||||
./runtest --accurate --verbose
|
./runtest --accurate --verbose --dump-logs
|
||||||
- name: module api test
|
- name: module api test
|
||||||
run: ./runtest-moduleapi --verbose
|
run: ./runtest-moduleapi --verbose
|
||||||
- name: sentinel tests
|
- name: sentinel tests
|
||||||
@ -40,7 +40,7 @@ jobs:
|
|||||||
- name: test
|
- name: test
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get install tcl8.5
|
sudo apt-get install tcl8.5
|
||||||
./runtest --accurate --verbose
|
./runtest --accurate --verbose --dump-logs
|
||||||
- name: module api test
|
- name: module api test
|
||||||
run: ./runtest-moduleapi --verbose
|
run: ./runtest-moduleapi --verbose
|
||||||
- name: sentinel tests
|
- name: sentinel tests
|
||||||
@ -61,7 +61,7 @@ jobs:
|
|||||||
- name: test
|
- name: test
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get install tcl8.5
|
sudo apt-get install tcl8.5
|
||||||
./runtest --accurate --verbose
|
./runtest --accurate --verbose --dump-logs
|
||||||
- name: module api test
|
- name: module api test
|
||||||
run: |
|
run: |
|
||||||
make -C tests/modules 32bit # the script below doesn't have an argument, we must build manually ahead of time
|
make -C tests/modules 32bit # the script below doesn't have an argument, we must build manually ahead of time
|
||||||
@ -84,8 +84,8 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
sudo apt-get install tcl8.5 tcl-tls
|
sudo apt-get install tcl8.5 tcl-tls
|
||||||
./utils/gen-test-certs.sh
|
./utils/gen-test-certs.sh
|
||||||
./runtest --accurate --verbose --tls
|
./runtest --accurate --verbose --tls --dump-logs
|
||||||
./runtest --accurate --verbose
|
./runtest --accurate --verbose --dump-logs
|
||||||
- name: module api test
|
- name: module api test
|
||||||
run: |
|
run: |
|
||||||
./runtest-moduleapi --verbose --tls
|
./runtest-moduleapi --verbose --tls
|
||||||
@ -111,7 +111,7 @@ jobs:
|
|||||||
- name: test
|
- name: test
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get install tcl8.5 tcl-tls
|
sudo apt-get install tcl8.5 tcl-tls
|
||||||
./runtest --config io-threads 4 --config io-threads-do-reads yes --accurate --verbose --tags network
|
./runtest --config io-threads 4 --config io-threads-do-reads yes --accurate --verbose --tags network --dump-logs
|
||||||
- name: cluster tests
|
- name: cluster tests
|
||||||
run: |
|
run: |
|
||||||
./runtest-cluster --config io-threads 4 --config io-threads-do-reads yes
|
./runtest-cluster --config io-threads 4 --config io-threads-do-reads yes
|
||||||
@ -128,7 +128,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install tcl8.5 valgrind -y
|
sudo apt-get install tcl8.5 valgrind -y
|
||||||
./runtest --valgrind --verbose --clients 1
|
./runtest --valgrind --verbose --clients 1 --dump-logs
|
||||||
- name: module api test
|
- name: module api test
|
||||||
run: ./runtest-moduleapi --valgrind --verbose --clients 1
|
run: ./runtest-moduleapi --valgrind --verbose --clients 1
|
||||||
|
|
||||||
@ -146,7 +146,7 @@ jobs:
|
|||||||
- name: test
|
- name: test
|
||||||
run: |
|
run: |
|
||||||
yum -y install which tcl
|
yum -y install which tcl
|
||||||
./runtest --accurate --verbose
|
./runtest --accurate --verbose --dump-logs
|
||||||
- name: module api test
|
- name: module api test
|
||||||
run: ./runtest-moduleapi --verbose
|
run: ./runtest-moduleapi --verbose
|
||||||
- name: sentinel tests
|
- name: sentinel tests
|
||||||
@ -170,8 +170,8 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
yum -y install tcl tcltls
|
yum -y install tcl tcltls
|
||||||
./utils/gen-test-certs.sh
|
./utils/gen-test-certs.sh
|
||||||
./runtest --accurate --verbose --tls
|
./runtest --accurate --verbose --tls --dump-logs
|
||||||
./runtest --accurate --verbose
|
./runtest --accurate --verbose --dump-logs
|
||||||
- name: module api test
|
- name: module api test
|
||||||
run: |
|
run: |
|
||||||
./runtest-moduleapi --verbose --tls
|
./runtest-moduleapi --verbose --tls
|
||||||
@ -195,7 +195,7 @@ jobs:
|
|||||||
run: make
|
run: make
|
||||||
- name: test
|
- name: test
|
||||||
run: |
|
run: |
|
||||||
./runtest --accurate --verbose --no-latency
|
./runtest --accurate --verbose --no-latency --dump-logs
|
||||||
- name: module api test
|
- name: module api test
|
||||||
run: ./runtest-moduleapi --verbose
|
run: ./runtest-moduleapi --verbose
|
||||||
- name: sentinel tests
|
- name: sentinel tests
|
||||||
@ -217,7 +217,7 @@ jobs:
|
|||||||
prepare: pkg install -y bash gmake lang/tcl86
|
prepare: pkg install -y bash gmake lang/tcl86
|
||||||
run: >
|
run: >
|
||||||
gmake &&
|
gmake &&
|
||||||
./runtest --accurate --verbose --no-latency &&
|
./runtest --accurate --verbose --no-latency --dump-logs &&
|
||||||
MAKE=gmake ./runtest-moduleapi --verbose &&
|
MAKE=gmake ./runtest-moduleapi --verbose &&
|
||||||
./runtest-sentinel &&
|
./runtest-sentinel &&
|
||||||
./runtest-cluster
|
./runtest-cluster
|
||||||
|
@ -259,6 +259,13 @@ proc wait_server_started {config_file stdout pid} {
|
|||||||
return $port_busy
|
return $port_busy
|
||||||
}
|
}
|
||||||
|
|
||||||
|
proc dump_server_log {srv} {
|
||||||
|
set pid [dict get $srv "pid"]
|
||||||
|
puts "\n===== Start of server log (pid $pid) =====\n"
|
||||||
|
puts [exec cat [dict get $srv "stdout"]]
|
||||||
|
puts "===== End of server log (pid $pid) =====\n"
|
||||||
|
}
|
||||||
|
|
||||||
proc start_server {options {code undefined}} {
|
proc start_server {options {code undefined}} {
|
||||||
# setup defaults
|
# setup defaults
|
||||||
set baseconfig "default.conf"
|
set baseconfig "default.conf"
|
||||||
@ -492,6 +499,9 @@ proc start_server {options {code undefined}} {
|
|||||||
# connect client (after server dict is put on the stack)
|
# connect client (after server dict is put on the stack)
|
||||||
reconnect
|
reconnect
|
||||||
|
|
||||||
|
# remember previous num_failed to catch new errors
|
||||||
|
set prev_num_failed $::num_failed
|
||||||
|
|
||||||
# execute provided block
|
# execute provided block
|
||||||
set num_tests $::num_tests
|
set num_tests $::num_tests
|
||||||
if {[catch { uplevel 1 $code } error]} {
|
if {[catch { uplevel 1 $code } error]} {
|
||||||
@ -529,6 +539,10 @@ proc start_server {options {code undefined}} {
|
|||||||
# Re-raise, let handler up the stack take care of this.
|
# Re-raise, let handler up the stack take care of this.
|
||||||
error $error $backtrace
|
error $error $backtrace
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if {$::dump_logs && $prev_num_failed != $::num_failed} {
|
||||||
|
dump_server_log $srv
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# fetch srv back from the server list, in case it was restarted by restart_server (new PID)
|
# fetch srv back from the server list, in case it was restarted by restart_server (new PID)
|
||||||
|
@ -110,6 +110,7 @@ set ::active_servers {} ; # Pids of active Redis instances.
|
|||||||
set ::dont_clean 0
|
set ::dont_clean 0
|
||||||
set ::wait_server 0
|
set ::wait_server 0
|
||||||
set ::stop_on_failure 0
|
set ::stop_on_failure 0
|
||||||
|
set ::dump_logs 0
|
||||||
set ::loop 0
|
set ::loop 0
|
||||||
set ::tlsdir "tests/tls"
|
set ::tlsdir "tests/tls"
|
||||||
|
|
||||||
@ -555,6 +556,7 @@ proc print_help_screen {} {
|
|||||||
"--stop Blocks once the first test fails."
|
"--stop Blocks once the first test fails."
|
||||||
"--loop Execute the specified set of tests forever."
|
"--loop Execute the specified set of tests forever."
|
||||||
"--wait-server Wait after server is started (so that you can attach a debugger)."
|
"--wait-server Wait after server is started (so that you can attach a debugger)."
|
||||||
|
"--dump-logs Dump server log on test failure."
|
||||||
"--tls Run tests in TLS mode."
|
"--tls Run tests in TLS mode."
|
||||||
"--host <addr> Run tests against an external host."
|
"--host <addr> Run tests against an external host."
|
||||||
"--port <port> TCP port to use against external host."
|
"--port <port> TCP port to use against external host."
|
||||||
@ -657,6 +659,8 @@ for {set j 0} {$j < [llength $argv]} {incr j} {
|
|||||||
set ::no_latency 1
|
set ::no_latency 1
|
||||||
} elseif {$opt eq {--wait-server}} {
|
} elseif {$opt eq {--wait-server}} {
|
||||||
set ::wait_server 1
|
set ::wait_server 1
|
||||||
|
} elseif {$opt eq {--dump-logs}} {
|
||||||
|
set ::dump_logs 1
|
||||||
} elseif {$opt eq {--stop}} {
|
} elseif {$opt eq {--stop}} {
|
||||||
set ::stop_on_failure 1
|
set ::stop_on_failure 1
|
||||||
} elseif {$opt eq {--loop}} {
|
} elseif {$opt eq {--loop}} {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user