Commit 6148f949 authored by Oran Agra's avatar Oran Agra Committed by antirez
Browse files

testsuite run the defrag latency test solo

this test is time sensitive and it sometimes fail to pass below the
latency threshold, even on strong machines.

this test was the reson we're running just 2 parallel tests in the
github actions CI, revering this.
parent 51d3012d
...@@ -12,9 +12,9 @@ jobs: ...@@ -12,9 +12,9 @@ jobs:
- name: test - name: test
run: | run: |
sudo apt-get install tcl8.5 sudo apt-get install tcl8.5
./runtest --clients 2 --verbose ./runtest --verbose
- name: module api test - name: module api test
run: ./runtest-moduleapi --clients 2 --verbose run: ./runtest-moduleapi --verbose
build-ubuntu-old: build-ubuntu-old:
runs-on: ubuntu-16.04 runs-on: ubuntu-16.04
......
...@@ -82,6 +82,7 @@ set ::skiptests {} ...@@ -82,6 +82,7 @@ set ::skiptests {}
set ::allowtags {} set ::allowtags {}
set ::only_tests {} set ::only_tests {}
set ::single_tests {} set ::single_tests {}
set ::run_solo_tests {}
set ::skip_till "" set ::skip_till ""
set ::external 0; # If "1" this means, we are running against external instance set ::external 0; # If "1" this means, we are running against external instance
set ::file ""; # If set, runs only the tests in this comma separated list set ::file ""; # If set, runs only the tests in this comma separated list
...@@ -112,6 +113,11 @@ proc execute_tests name { ...@@ -112,6 +113,11 @@ proc execute_tests name {
send_data_packet $::test_server_fd done "$name" send_data_packet $::test_server_fd done "$name"
} }
proc execute_code {name code} {
eval $code
send_data_packet $::test_server_fd done "$name"
}
# Setup a list to hold a stack of server configs. When calls to start_server # Setup a list to hold a stack of server configs. When calls to start_server
# are nested, use "srv 0 pid" to get the pid of the inner server. To access # are nested, use "srv 0 pid" to get the pid of the inner server. To access
# outer servers, use "srv -1 pid" etcetera. # outer servers, use "srv -1 pid" etcetera.
...@@ -188,6 +194,18 @@ proc s {args} { ...@@ -188,6 +194,18 @@ proc s {args} {
status [srv $level "client"] [lindex $args 0] status [srv $level "client"] [lindex $args 0]
} }
# Test wrapped into run_solo are sent back from the client to the
# test server, so that the test server will send them again to
# clients once the clients are idle.
proc run_solo {name code} {
if {$::numclients == 1 || $::loop || $::external} {
# run_solo is not supported in these scenarios, just run the code.
eval $code
return
}
send_data_packet $::test_server_fd run_solo [list $name $code]
}
proc cleanup {} { proc cleanup {} {
if {$::dont_clean} { if {$::dont_clean} {
return return
...@@ -337,6 +355,8 @@ proc read_from_test_client fd { ...@@ -337,6 +355,8 @@ proc read_from_test_client fd {
} elseif {$status eq {server-killed}} { } elseif {$status eq {server-killed}} {
set ::active_servers [lsearch -all -inline -not -exact $::active_servers $data] set ::active_servers [lsearch -all -inline -not -exact $::active_servers $data]
set ::active_clients_task($fd) "(KILLED SERVER) pid:$data" set ::active_clients_task($fd) "(KILLED SERVER) pid:$data"
} elseif {$status eq {run_solo}} {
lappend ::run_solo_tests $data
} else { } else {
if {!$::quiet} { if {!$::quiet} {
puts "\[$status\]: $data" puts "\[$status\]: $data"
...@@ -369,6 +389,13 @@ proc force_kill_all_servers {} { ...@@ -369,6 +389,13 @@ proc force_kill_all_servers {} {
} }
} }
proc lpop {listVar {count 1}} {
upvar 1 $listVar l
set ele [lindex $l 0]
set l [lrange $l 1 end]
set ele
}
# A new client is idle. Remove it from the list of active clients and # A new client is idle. Remove it from the list of active clients and
# if there are still test units to run, launch them. # if there are still test units to run, launch them.
proc signal_idle_client fd { proc signal_idle_client fd {
...@@ -389,6 +416,14 @@ proc signal_idle_client fd { ...@@ -389,6 +416,14 @@ proc signal_idle_client fd {
if {$::loop && $::next_test == [llength $::all_tests]} { if {$::loop && $::next_test == [llength $::all_tests]} {
set ::next_test 0 set ::next_test 0
} }
} elseif {[llength $::run_solo_tests] != 0 && [llength $::active_clients] == 0} {
if {!$::quiet} {
puts [colorstr bold-white "Testing solo test"]
set ::active_clients_task($fd) "ASSIGNED: $fd solo test"
}
set ::clients_start_time($fd) [clock seconds]
send_data_packet $fd run_code [lpop ::run_solo_tests]
lappend ::active_clients $fd
} else { } else {
lappend ::idle_clients $fd lappend ::idle_clients $fd
set ::active_clients_task($fd) "SLEEPING, no more units to assign" set ::active_clients_task($fd) "SLEEPING, no more units to assign"
...@@ -433,6 +468,9 @@ proc test_client_main server_port { ...@@ -433,6 +468,9 @@ proc test_client_main server_port {
foreach {cmd data} $payload break foreach {cmd data} $payload break
if {$cmd eq {run}} { if {$cmd eq {run}} {
execute_tests $data execute_tests $data
} elseif {$cmd eq {run_code}} {
foreach {name code} $data break
execute_code $name $code
} else { } else {
error "Unknown test client command: $cmd" error "Unknown test client command: $cmd"
} }
......
...@@ -36,6 +36,7 @@ start_server {tags {"memefficiency"}} { ...@@ -36,6 +36,7 @@ start_server {tags {"memefficiency"}} {
} }
} }
run_solo {defrag} {
start_server {tags {"defrag"}} { start_server {tags {"defrag"}} {
if {[string match {*jemalloc*} [s mem_allocator]]} { if {[string match {*jemalloc*} [s mem_allocator]]} {
test "Active defrag" { test "Active defrag" {
...@@ -328,3 +329,4 @@ start_server {tags {"defrag"}} { ...@@ -328,3 +329,4 @@ start_server {tags {"defrag"}} {
} {1} } {1}
} }
} }
} ;# run_solo
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment