Bug #81050 make tests fail when leaksanitizer detects leaks
Submitted: 12 Apr 2016 11:54 Modified: 13 Apr 2016 15:01
Reporter: Erlend Dahl Email Updates:
Status: Closed Impact on me:
None 
Category:Tools: MTR / mysql-test-run Severity:S3 (Non-critical)
Version:5.7+ OS:Any
Assigned to: CPU Architecture:Any

[12 Apr 2016 11:54] Erlend Dahl
Description:
It seems LeakSanitizer is no longer fail-fast on recent versions of Clang (3.8). 

This means that leaks can go undetected.

How to repeat:
Run a test leaking memory under mtr and observe that the test passes, even though the log file contains evidence of leaks.

Suggested fix:
Use LSAN_OPTIONS to force an exit:

diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index 6ce066b..a67aedf 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -2826,6 +2826,9 @@ sub environment_setup {
   # Ask UBSAN to print stack traces
   $ENV{'UBSAN_OPTIONS'}= "print_stacktrace=1" if $opt_sanitize;
 
+  # Make sure LeakSanitizer exits if leaks are found
+  $ENV{'LSAN_OPTIONS'}= "exitcode=42" if $opt_sanitize;
+
   # Add dir of this perl to aid mysqltest in finding perl
   my $perldir= dirname($^X);
   my $pathsep= ":";
[13 Apr 2016 15:01] Paul DuBois
Posted by developer:
 
Fixed in 5.7.13.

Changes for test suite. No changelog entry needed.