Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
2ebfd0f7
Commit
2ebfd0f7
authored
Jan 02, 2016
by
antirez
Browse files
Cluster test: do leaks detection with OSX leaks utility.
parent
13a70eb6
Changes
1
Show whitespace changes
Inline
Side-by-side
tests/instances.tcl
View file @
2ebfd0f7
...
...
@@ -249,6 +249,37 @@ proc test {descr code} {
}
}
# Check memory leaks when running on OSX using the
"leaks"
utility.
proc check_leaks instance_types
{
if
{[
string match
{
*Darwin*
}
[
exec uname -a
]]}
{
puts -nonewline
"Testing for memory leaks..."
;
flush stdout
foreach type $instance_types
{
foreach_instance_id
[
set ::$
{
type
}
_instances
]
id
{
if
{[
instance_is_killed $type $id
]}
continue
set pid
[
get_instance_attrib $type $id pid
]
set output
{
0 leaks
}
catch
{
exec leaks $pid
}
output
if
{[
string match
{
*process does not exist*
}
$output
]
||
[
string match
{
*cannot examine*
}
$output
]}
{
# In a few tests we kill the server process.
set output
"0 leaks"
}
else
{
puts -nonewline
"
$type
/
$pid
"
flush stdout
}
if
{
!
[
string match
{
*0 leaks*
}
$output
]}
{
puts
[
colorstr red
"=== MEMORY LEAK DETECTED ==="
]
puts
"Instance type
$type
, ID
$id:
"
puts $output
puts
"==="
incr ::failed
}
}
}
puts
""
}
}
# Execute all the units inside the 'tests' directory.
proc run_tests
{}
{
set tests
[
lsort
[
glob ../tests/*
]]
...
...
@@ -259,6 +290,7 @@ proc run_tests {} {
if
{[
file isdirectory $test
]}
continue
puts
[
colorstr yellow
"Testing unit:
[
lindex
[
file split $test
]
end
]
"
]
source $test
check_leaks
{
redis sentinel
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment