mirror of
https://github.com/php/php-src.git
synced 2024-09-21 09:57:23 +00:00
Add ASAN XLEAK support
Only disable LSAN instead of skipping the test. This way we can still detect memory issues which is arguably more important anyway. Closes GH-10996
This commit is contained in:
parent
c211e67b4e
commit
50f58c8923
@ -6,7 +6,7 @@ marcosptf - <marcosptf@yahoo.com.br>
|
||||
enchant
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (getenv('SKIP_ASAN')) die('skip Known libenchant memory leak');
|
||||
if (getenv('SKIP_ASAN')) die('xleak Known libenchant memory leak');
|
||||
if (!is_object(enchant_broker_init())) {die("skip, resource dont load\n");}
|
||||
if (!is_array(enchant_broker_list_dicts(enchant_broker_init()))) {die("skip, no dictionary installed on this machine! \n");}
|
||||
|
||||
|
@ -4,7 +4,7 @@ Bug #79576 ("TYPE *" shows unhelpful message when type is not defined)
|
||||
ffi
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (PHP_DEBUG || getenv('SKIP_ASAN')) echo "xfail: FFI cleanup after parser error is nor implemented";
|
||||
if (PHP_DEBUG || getenv('SKIP_ASAN')) echo "xleak FFI cleanup after parser error is nor implemented";
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
@ -7,7 +7,7 @@ imap
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once(__DIR__.'/setup/skipif.inc');
|
||||
if (getenv("SKIP_ASAN")) die("skip asan chokes on this: 'LeakSanitizer does not work under ptrace (strace, gdb, etc)'");
|
||||
if (getenv("SKIP_ASAN")) die("xleak asan chokes on this: 'LeakSanitizer does not work under ptrace (strace, gdb, etc)'");
|
||||
?>
|
||||
--CONFLICTS--
|
||||
defaultmailbox
|
||||
|
@ -7,7 +7,7 @@ imap
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once(__DIR__.'/setup/skipif.inc');
|
||||
if (getenv("SKIP_ASAN")) die("skip leak sanitizer crashes");
|
||||
if (getenv("SKIP_ASAN")) die("xleak leak sanitizer crashes");
|
||||
?>
|
||||
--CONFLICTS--
|
||||
defaultmailbox
|
||||
|
@ -8,7 +8,7 @@ imap
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once(__DIR__.'/setup/skipif.inc');
|
||||
if (getenv("SKIP_ASAN")) die("skip leak sanitizer crashes");
|
||||
if (getenv("SKIP_ASAN")) die("xleak leak sanitizer crashes");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
@ -4,7 +4,7 @@ privileged connect tests
|
||||
oci8
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (getenv('SKIP_ASAN')) die('skip leaks memory under asan');
|
||||
if (getenv('SKIP_ASAN')) die('xleak leaks memory under asan');
|
||||
?>
|
||||
--INI--
|
||||
oci8.privileged_connect=1
|
||||
|
@ -4,7 +4,7 @@ Bug GH-9259 003 (Setting opcache.interned_strings_buffer to a very high value le
|
||||
opcache
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (getenv('SKIP_ASAN')) die('xfail Leaks memory with ASAN');
|
||||
if (getenv('SKIP_ASAN')) die('xleak Leaks memory with ASAN');
|
||||
?>
|
||||
--INI--
|
||||
opcache.interned_strings_buffer=500
|
||||
|
@ -14,7 +14,7 @@ opcache.log_verbosity_level=-1
|
||||
opcache
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (getenv('SKIP_ASAN')) die('xfail Startup failure leak');
|
||||
if (getenv('SKIP_ASAN')) die('xleak Startup failure leak');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
@ -10,7 +10,7 @@ opcache
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
|
||||
if (getenv('SKIP_ASAN')) die('xfail Startup failure leak');
|
||||
if (getenv('SKIP_ASAN')) die('xleak Startup failure leak');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
@ -10,7 +10,7 @@ opcache
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
|
||||
if (getenv('SKIP_ASAN')) die('xfail Startup failure leak');
|
||||
if (getenv('SKIP_ASAN')) die('xleak Startup failure leak');
|
||||
?>
|
||||
--FILE--
|
||||
OK
|
||||
|
@ -5,7 +5,7 @@ pdo
|
||||
pdo_oci
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (getenv('SKIP_ASAN')) die('skip leaks memory under asan');
|
||||
if (getenv('SKIP_ASAN')) die('xleak leaks memory under asan');
|
||||
require(__DIR__.'/../../pdo/tests/pdo_test.inc');
|
||||
PDOTest::skip();
|
||||
?>
|
||||
|
@ -4,7 +4,7 @@ Test posix_getgrgid() function : error conditions
|
||||
posix
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (getenv('SKIP_ASAN')) die('skip LSan crashes when firebird is loaded');
|
||||
if (getenv('SKIP_ASAN')) die('xleak LSan crashes when firebird is loaded');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
@ -4,7 +4,7 @@ Test posix_getpwuid() function : error conditions
|
||||
posix
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (getenv('SKIP_ASAN')) die('skip LSan crashes when firebird is loaded');
|
||||
if (getenv('SKIP_ASAN')) die('xleak LSan crashes when firebird is loaded');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
@ -5,7 +5,7 @@ pspell
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!@pspell_new('en')) die('skip English dictionary is not available');
|
||||
if (getenv('SKIP_ASAN')) die('skip pspell leaks memory for invalid dicationaries');
|
||||
if (getenv('SKIP_ASAN')) die('xleak pspell leaks memory for invalid dicationaries');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
@ -6,7 +6,7 @@ Francesco Fullone ff@ideato.it
|
||||
--INI--
|
||||
magic_quotes_gpc=1
|
||||
--SKIPIF--
|
||||
<?php if (getenv('SKIP_ASAN')) die('xfail Startup failure leak'); ?>
|
||||
<?php if (getenv('SKIP_ASAN')) die('xleak Startup failure leak'); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
echo "*** Test by calling method or function with deprecated option ***\n";
|
||||
|
@ -5,7 +5,7 @@ Bug #46024 stream_select() doesn't return the correct number
|
||||
if (!getenv('TEST_PHP_EXECUTABLE_ESCAPED')) die("skip TEST_PHP_EXECUTABLE_ESCAPED not defined");
|
||||
// Terminating the process may cause a bailout while writing out the phpinfo,
|
||||
// which may leak a temporary hash table. This does not seems worth fixing.
|
||||
if (getenv('SKIP_ASAN')) die("skip Test may leak");
|
||||
if (getenv('SKIP_ASAN')) die("xleak Test may leak");
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
@ -2207,6 +2207,9 @@ TEST $file
|
||||
} elseif (!strncasecmp('xfail', $output, 5)) {
|
||||
// Pretend we have an XFAIL section
|
||||
$test->setSection('XFAIL', ltrim(substr($output, 5)));
|
||||
} elseif (!strncasecmp('xleak', $output, 5)) {
|
||||
// Pretend we have an XLEAK section
|
||||
$test->setSection('XLEAK', ltrim(substr($output, 5)));
|
||||
} elseif ($output !== '') {
|
||||
show_result("BORK", $output, $tested_file, 'reason: invalid output from SKIPIF', $temp_filenames);
|
||||
$PHP_FAILED_TESTS['BORKED'][] = [
|
||||
@ -2461,6 +2464,10 @@ TEST $file
|
||||
$cmd = $valgrind->wrapCommand($cmd, $memcheck_filename, strpos($test_file, "pcre") !== false);
|
||||
}
|
||||
|
||||
if ($test->hasSection('XLEAK') && isset($env['SKIP_ASAN'])) {
|
||||
$env['LSAN_OPTIONS'] = 'detect_leaks=0';
|
||||
}
|
||||
|
||||
if ($DETAILED) {
|
||||
echo "
|
||||
CONTENT_LENGTH = " . $env['CONTENT_LENGTH'] . "
|
||||
@ -2657,7 +2664,8 @@ COMMAND $cmd
|
||||
if ($test->hasSection('XFAIL')) {
|
||||
$warn = true;
|
||||
$info = " (warn: XFAIL section but test passes)";
|
||||
} elseif ($test->hasSection('XLEAK')) {
|
||||
} elseif ($test->hasSection('XLEAK') && !isset($env['SKIP_ASAN'])) {
|
||||
// XLEAK with ASAN completely disables LSAN so the test is expected to pass
|
||||
$warn = true;
|
||||
$info = " (warn: XLEAK section but test passes)";
|
||||
} else {
|
||||
@ -2694,7 +2702,8 @@ COMMAND $cmd
|
||||
if ($test->hasSection('XFAIL')) {
|
||||
$restype[] = 'XFAIL';
|
||||
$info = ' XFAIL REASON: ' . rtrim($test->getSection('XFAIL'));
|
||||
} elseif ($test->hasSection('XLEAK')) {
|
||||
} elseif ($test->hasSection('XLEAK') && !isset($env['SKIP_ASAN'])) {
|
||||
// XLEAK with ASAN completely disables LSAN so the test is expected to pass
|
||||
$restype[] = 'XLEAK';
|
||||
$info = ' XLEAK REASON: ' . rtrim($test->getSection('XLEAK'));
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user