@@ -2207,6 +2207,9 @@ function run_test(string $php, $file, array $env): string
2207
2207
} elseif (!strncasecmp ('xfail ' , $ output , 5 )) {
2208
2208
// Pretend we have an XFAIL section
2209
2209
$ test ->setSection ('XFAIL ' , ltrim (substr ($ output , 5 )));
2210
+ } elseif (!strncasecmp ('xleak ' , $ output , 5 )) {
2211
+ // Pretend we have an XLEAK section
2212
+ $ test ->setSection ('XLEAK ' , ltrim (substr ($ output , 5 )));
2210
2213
} elseif ($ output !== '' ) {
2211
2214
show_result ("BORK " , $ output , $ tested_file , 'reason: invalid output from SKIPIF ' , $ temp_filenames );
2212
2215
$ PHP_FAILED_TESTS ['BORKED ' ][] = [
@@ -2461,6 +2464,10 @@ function run_test(string $php, $file, array $env): string
2461
2464
$ cmd = $ valgrind ->wrapCommand ($ cmd , $ memcheck_filename , strpos ($ test_file , "pcre " ) !== false );
2462
2465
}
2463
2466
2467
+ if ($ test ->hasSection ('XLEAK ' ) && isset ($ env ['SKIP_ASAN ' ])) {
2468
+ $ env ['LSAN_OPTIONS ' ] = 'detect_leaks=0 ' ;
2469
+ }
2470
+
2464
2471
if ($ DETAILED ) {
2465
2472
echo "
2466
2473
CONTENT_LENGTH = " . $ env ['CONTENT_LENGTH ' ] . "
@@ -2657,7 +2664,8 @@ function run_test(string $php, $file, array $env): string
2657
2664
if ($ test ->hasSection ('XFAIL ' )) {
2658
2665
$ warn = true ;
2659
2666
$ info = " (warn: XFAIL section but test passes) " ;
2660
- } elseif ($ test ->hasSection ('XLEAK ' )) {
2667
+ } elseif ($ test ->hasSection ('XLEAK ' ) && !isset ($ env ['SKIP_ASAN ' ])) {
2668
+ // XLEAK with ASAN completely disables LSAN so the test is expected to pass
2661
2669
$ warn = true ;
2662
2670
$ info = " (warn: XLEAK section but test passes) " ;
2663
2671
} else {
@@ -2694,7 +2702,8 @@ function run_test(string $php, $file, array $env): string
2694
2702
if ($ test ->hasSection ('XFAIL ' )) {
2695
2703
$ restype [] = 'XFAIL ' ;
2696
2704
$ info = ' XFAIL REASON: ' . rtrim ($ test ->getSection ('XFAIL ' ));
2697
- } elseif ($ test ->hasSection ('XLEAK ' )) {
2705
+ } elseif ($ test ->hasSection ('XLEAK ' ) && !isset ($ env ['SKIP_ASAN ' ])) {
2706
+ // XLEAK with ASAN completely disables LSAN so the test is expected to pass
2698
2707
$ restype [] = 'XLEAK ' ;
2699
2708
$ info = ' XLEAK REASON: ' . rtrim ($ test ->getSection ('XLEAK ' ));
2700
2709
} else {
0 commit comments