summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2015-09-23 10:34:00 +0200
committerantirez <antirez@gmail.com>2015-10-01 13:02:25 +0200
commit36be34bb87f6292b6259172d974c211023e5ba43 (patch)
tree51323b8b5f8e75ec71e43a518cdff2614f89458a
parent974514b936c7b7b970b03224963f05818c568c60 (diff)
downloadredis-36be34bb87f6292b6259172d974c211023e5ba43.tar.gz
Test: support for stack logging for OSX malloc/leaks.
-rw-r--r--tests/support/server.tcl2
-rw-r--r--tests/test_helper.tcl5
2 files changed, 7 insertions, 0 deletions
diff --git a/tests/support/server.tcl b/tests/support/server.tcl
index e5c31af28..19d6c5152 100644
--- a/tests/support/server.tcl
+++ b/tests/support/server.tcl
@@ -213,6 +213,8 @@ proc start_server {options {code undefined}} {
if {$::valgrind} {
set pid [exec valgrind --track-origins=yes --suppressions=src/valgrind.sup --show-reachable=no --show-possibly-lost=no --leak-check=full src/redis-server $config_file > $stdout 2> $stderr &]
+ } elseif ($::stack_logging) {
+ set pid [exec /usr/bin/env MallocStackLogging=1 MallocLogFile=/tmp/malloc_log.txt src/redis-server $config_file > $stdout 2> $stderr &]
} else {
set pid [exec src/redis-server $config_file > $stdout 2> $stderr &]
}
diff --git a/tests/test_helper.tcl b/tests/test_helper.tcl
index 914f6ba1e..1c38f9fd0 100644
--- a/tests/test_helper.tcl
+++ b/tests/test_helper.tcl
@@ -391,6 +391,7 @@ proc send_data_packet {fd status data} {
proc print_help_screen {} {
puts [join {
"--valgrind Run the test over valgrind."
+ "--stack-logging Enable OSX leaks/malloc stack logging."
"--accurate Run slow randomized tests for more iterations."
"--quiet Don't show individual tests."
"--single <unit> Just execute the specified unit (see next option)."
@@ -417,6 +418,10 @@ for {set j 0} {$j < [llength $argv]} {incr j} {
incr j
} elseif {$opt eq {--valgrind}} {
set ::valgrind 1
+ } elseif {$opt eq {--stack-logging}} {
+ if {[string match {*Darwin*} [exec uname -a]]} {
+ set ::stack_logging 1
+ }
} elseif {$opt eq {--quiet}} {
set ::quiet 1
} elseif {$opt eq {--host}} {