Skip to content

Commit 36be34b

Browse files
committed
Test: support for stack logging for OSX malloc/leaks.
1 parent 974514b commit 36be34b

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

tests/support/server.tcl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,8 @@ proc start_server {options {code undefined}} {
213213

214214
if {$::valgrind} {
215215
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 &]
216+
} elseif ($::stack_logging) {
217+
set pid [exec /usr/bin/env MallocStackLogging=1 MallocLogFile=/tmp/malloc_log.txt src/redis-server $config_file > $stdout 2> $stderr &]
216218
} else {
217219
set pid [exec src/redis-server $config_file > $stdout 2> $stderr &]
218220
}

tests/test_helper.tcl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,7 @@ proc send_data_packet {fd status data} {
391391
proc print_help_screen {} {
392392
puts [join {
393393
"--valgrind Run the test over valgrind."
394+
"--stack-logging Enable OSX leaks/malloc stack logging."
394395
"--accurate Run slow randomized tests for more iterations."
395396
"--quiet Don't show individual tests."
396397
"--single <unit> Just execute the specified unit (see next option)."
@@ -417,6 +418,10 @@ for {set j 0} {$j < [llength $argv]} {incr j} {
417418
incr j
418419
} elseif {$opt eq {--valgrind}} {
419420
set ::valgrind 1
421+
} elseif {$opt eq {--stack-logging}} {
422+
if {[string match {*Darwin*} [exec uname -a]]} {
423+
set ::stack_logging 1
424+
}
420425
} elseif {$opt eq {--quiet}} {
421426
set ::quiet 1
422427
} elseif {$opt eq {--host}} {

0 commit comments

Comments
 (0)