mirror of
https://github.com/fluencelabs/redis
synced 2025-04-25 02:22:13 +00:00
some test colorization and some fix
This commit is contained in:
parent
36e790a040
commit
3744824c3e
@ -49,48 +49,22 @@ proc color_term {} {
|
||||
expr {[info exists ::env(TERM)] && [string match *xterm* $::env(TERM)]}
|
||||
}
|
||||
|
||||
# This is called after the test finished
|
||||
proc colored_dot {tags passed} {
|
||||
proc colorstr {color str} {
|
||||
if {[color_term]} {
|
||||
# Go backward and delete what announc_test function printed.
|
||||
puts -nonewline "\033\[${::backward_count}D\033\[0K\033\[J"
|
||||
|
||||
# Print a coloured char, accordingly to test outcome and tags.
|
||||
if {[lsearch $tags list] != -1} {
|
||||
set colorcode {31}
|
||||
set ch L
|
||||
} elseif {[lsearch $tags hash] != -1} {
|
||||
set colorcode {32}
|
||||
set ch H
|
||||
} elseif {[lsearch $tags set] != -1} {
|
||||
set colorcode {33}
|
||||
set ch S
|
||||
} elseif {[lsearch $tags zset] != -1} {
|
||||
set colorcode {34}
|
||||
set ch Z
|
||||
} elseif {[lsearch $tags basic] != -1} {
|
||||
set colorcode {35}
|
||||
set ch B
|
||||
} else {
|
||||
set colorcode {37}
|
||||
set ch .
|
||||
switch $color {
|
||||
red {set colorcode {31}}
|
||||
green {set colorcode {32}}
|
||||
yellow {set colorcode {33}}
|
||||
blue {set colorcode {34}}
|
||||
magenta {set colorcode {35}}
|
||||
cyan {set colorcode {36}}
|
||||
else {set colorcode {37}}
|
||||
}
|
||||
if {$colorcode ne {}} {
|
||||
if {$passed} {
|
||||
puts -nonewline "\033\[0;${colorcode};40m"
|
||||
} else {
|
||||
puts -nonewline "\033\[7;${colorcode};40m"
|
||||
}
|
||||
puts -nonewline $ch
|
||||
puts -nonewline "\033\[0m"
|
||||
flush stdout
|
||||
return "\033\[0;${colorcode};40m$str\033\[0m"
|
||||
}
|
||||
} else {
|
||||
if {$passed} {
|
||||
puts -nonewline .
|
||||
} else {
|
||||
puts -nonewline F
|
||||
}
|
||||
return $str
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -209,14 +209,21 @@ proc read_from_test_client fd {
|
||||
set bytes [gets $fd]
|
||||
set payload [read $fd $bytes]
|
||||
foreach {status data} $payload break
|
||||
puts "($fd) \[$status\]: $data"
|
||||
if {$status eq {ready}} {
|
||||
puts "($fd) \[$status\]: $data"
|
||||
signal_idle_client $fd
|
||||
} elseif {$status eq {done}} {
|
||||
set elapsed [expr {[clock seconds]-$::clients_start_time($fd)}]
|
||||
puts "+++ [llength $::active_clients] units still in execution ($elapsed seconds)."
|
||||
puts "($fd) \[[colorstr yellow $status]\]: $data ($elapsed seconds)"
|
||||
puts "+++ [llength $::active_clients] units still in execution."
|
||||
lappend ::clients_time_history $elapsed $data
|
||||
signal_idle_client $fd
|
||||
} elseif {$status eq {ok}} {
|
||||
puts "($fd) \[[colorstr green $status]\]: $data"
|
||||
} elseif {$status eq {err}} {
|
||||
puts "($fd) \[[colorstr red $status]\]: $data"
|
||||
} else {
|
||||
puts "($fd) \[$status\]: $data"
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user