Backport PHP8's run-tests.php

This commit is contained in:
Gustavo Lopes
2020-12-05 14:44:38 +00:00
parent 4ff664b2b0
commit 5b94797037
8 changed files with 3873 additions and 17 deletions

View File

@@ -1,18 +1,6 @@
replace-run-tests:
@if grep 'is_numeric($$valgrind_version)' run-tests.php > /dev/null; then \
curl -L -f https://raw.githubusercontent.com/php/php-src/PHP-7.2.33/run-tests.php > run-tests.php; \
@if ! grep -q 'Minimum required PHP version: 5\.3\.0' run-tests.php; then \
cp run-tests8.php run-tests.php; \
fi
fixup-run-tests: replace-run-tests
@if ! grep -q leak-check=full run-tests.php; then \
sed -i 's/--trace-children=yes/--trace-children=no/' run-tests.php && \
if grep -q 'tool={$$this->tool}' run-tests.php; then \
sed -i "s@--tool={\$$this->tool}@\0 --leak-check=full --gen-suppressions=all --suppressions='$(top_srcdir)/valgrind.supp' --num-callers=16 --run-libc-freeres=no@" run-tests.php; \
elif grep -q wrapCommand run-tests.php; then \
sed -i 's@--tool=memcheck@\0 --leak-check=full --gen-suppressions=all --suppressions="$(top_srcdir)/valgrind.supp" --run-libc-freeres=no@' run-tests.php; \
else \
sed -i "s@--tool=memcheck@\0 --leak-check=full --gen-suppressions=all --suppressions='$(top_srcdir)/valgrind.supp' --run-libc-freeres=no@" run-tests.php; \
fi \
fi
test: fixup-run-tests
test: replace-run-tests

View File

@@ -27,3 +27,5 @@ CALL configure.bat --disable-all --enable-cli --enable-rar=shared --with-config-
nmake || exit /b
rmdir Release_TS\php-rar /S /Q
del /S /Q "Release_TS\*.sbr"
copy %APPVEYOR_BUILD_FOLDER%\run-tests8.php C:\projects\php-src\run-tests.php

3811
run-tests8.php Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -4,6 +4,7 @@ RarArchive direct instantiation does not crash (PHP 5.x)
<?php
if (!extension_loaded("rar")) die("skip");
if (!defined('PHP_VERSION_ID') || PHP_VERSION_ID >= 70000) die("skip for PHP 5.x");
if (key_exists('USE_ZEND_ALLOC', $_ENV) && PHP_VERSION_ID < 70000) die('skip do not use with valgrind in PHP <7');
--FILE--
<?php

View File

@@ -3,6 +3,7 @@ RarEntry direct instantiation does not crash (PHP 5.x)
--SKIPIF--
<?php if(!extension_loaded("rar")) die("skip");
if (!defined('PHP_VERSION_ID') || PHP_VERSION_ID >= 70000) die("skip for PHP 5.x");
if (key_exists('USE_ZEND_ALLOC', $_ENV) && PHP_VERSION_ID < 70000) die('skip do not use with valgrind in PHP <7');
--FILE--
<?php

View File

@@ -1,7 +1,10 @@
--TEST--
RarArchive write_property gives a fatal error
--SKIPIF--
<?php if(!extension_loaded("rar")) print "skip"; ?>
<?php
if(!extension_loaded("rar")) die("skip");
if (key_exists('USE_ZEND_ALLOC', $_ENV) && PHP_VERSION_ID < 70000) die('skip do not use with valgrind in PHP <7');
?>
--FILE--
<?php

View File

@@ -1,7 +1,10 @@
--TEST--
RarArchive write_property gives a fatal error
--SKIPIF--
<?php if(!extension_loaded("rar")) print "skip"; ?>
<?php
if(!extension_loaded("rar")) die("skip");
if (key_exists('USE_ZEND_ALLOC', $_ENV) && PHP_VERSION_ID < 70000) die('skip do not use with valgrind in PHP <7')
?>
--FILE--
<?php

View File

@@ -75,3 +75,50 @@
fun:php_verror
...
}
{
<verror (pre-8)>
Memcheck:Leak
match-leak-kinds: definite
...
fun:spprintf
fun:php_verror
fun:php_error_docref0
...
}
{
<verror (pre-8) 7.4>
Memcheck:Leak
match-leak-kinds: definite
...
fun:zend_spprintf
fun:php_verror
fun:php_error_docref0
...
}
{
<compilation leak>
Memcheck:Leak
match-leak-kinds: definite
...
fun:_emalloc
fun:compile_file
fun:zend_execute_scripts
fun:php_execute_script
...
}
{
<compilation leak (7)>
Memcheck:Leak
match-leak-kinds: possible
fun:realloc
fun:__zend_realloc
fun:_realloc_custom
fun:_erealloc
fun:pass_two
fun:zend_compile
fun:compile_file
fun:zend_execute_scripts
fun:php_execute_script
fun:do_cli
fun:main
}