Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add phpseclib, Psalm, PHPStan nightly tests #12270

Closed
wants to merge 42 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
ef6db9f
Trigger JIT tracing&compilation more often, enable JIT for ASAN
danog Sep 18, 2023
4e504e1
Revert some changes
danog Sep 20, 2023
2c965c1
Fix
danog Sep 20, 2023
ca53391
Increase JIT buffer size since Psalm get dangerously close to the 16M…
danog Sep 20, 2023
88cf395
Add test for https://github.com/php/php-src/issues/11917
danog Sep 20, 2023
b3a2b3e
Remove jit_prof_threshold
danog Sep 20, 2023
a979682
Run opcache tests with JIT on windows
danog Sep 20, 2023
94714eb
Unify JIT settings and explicitly disable JIT where needed
danog Sep 20, 2023
f397961
Move new JIT test, fixup mac OS builds too
danog Sep 20, 2023
b4ac0e2
Explicitly disable JIT for ASAN builds
danog Sep 20, 2023
8c92c0e
Remove mistakenly added additional 0
danog Sep 20, 2023
8701969
Add phpseclib, psalm, phpstan nightly JIT+ASAN tests
danog Sep 20, 2023
104f03f
Change config in all other CIs
danog Sep 20, 2023
c5af745
Change config in all other CIs
danog Sep 20, 2023
c30b9b3
Fixup config
danog Sep 20, 2023
e11a67a
Improve
danog Sep 20, 2023
665e09c
Improve tests
danog Sep 21, 2023
f822a56
Parallelize
danog Sep 21, 2023
4aa113f
Remove RAM limitations
danog Sep 21, 2023
543b52b
Update
danog Sep 21, 2023
a06eea9
Fix deps
danog Sep 21, 2023
8de7066
Fix deps
danog Sep 21, 2023
1a4d450
Fixup opcache
danog Sep 21, 2023
96f7b74
Reorder
danog Sep 21, 2023
84373f0
fix
danog Sep 21, 2023
f837597
Update to upstream phpseclib
danog Sep 22, 2023
4caf2d6
Improve workflow
danog Sep 22, 2023
12281a4
Remove new tests, move to separate PR
danog Sep 22, 2023
ef71bd5
Add phpseclib, Psalm, PHPStan, UV+AMP nightly tests
danog Sep 22, 2023
220db9a
Merge remote-tracking branch 'origin/master' into improve_jit_nightly…
danog Oct 5, 2023
2df24e0
Tweak flags
danog Oct 8, 2023
7877d96
Update config
danog Oct 9, 2023
4996e34
Merge remote-tracking branch 'origin/master' into improve_jit_nightly…
danog Oct 9, 2023
e62d3d9
Update config
danog Oct 10, 2023
39e6c89
Add patch script
danog Oct 10, 2023
4bbdfde
Fix
danog Oct 10, 2023
a336ed7
Fixup
danog Oct 10, 2023
73fbf4c
Fixes
danog Oct 10, 2023
6588b79
Fixup
danog Oct 10, 2023
ab27c26
Improve limits
danog Oct 10, 2023
b474ce3
Fixup counters
danog Oct 10, 2023
a76d75f
Increase interned strings buffer size
danog Oct 10, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ arm_task:
-d opcache.enable_cli=1
-d opcache.jit_buffer_size=64M
-d opcache.jit=function
-d opcache.file_update_protection=0
-P -q -x -j2
-g FAIL,BORK,LEAK,XLEAK
--no-progress
Expand All @@ -218,13 +219,16 @@ arm_task:
-d zend_extension=opcache.so
-d opcache.enable_cli=1
-d opcache.jit_buffer_size=64M
-d opcache.jit_max_root_traces=1000000
-d opcache.jit_max_side_traces=1000000
-d opcache.jit_max_exit_counters=1000000
-d opcache.jit_max_root_traces=100000
-d opcache.jit_max_side_traces=100000
-d opcache.jit_max_exit_counters=100000
-d opcache.jit_hot_loop=1
-d opcache.jit_hot_func=1
-d opcache.jit_hot_return=1
-d opcache.jit_hot_side_exit=1
-d opcache.file_update_protection=0
-d opcache.jit_blacklist_root_trace=255
-d opcache.jit_blacklist_side_trace=255
-d opcache.jit=tracing
-P -q -x -j2
-g FAIL,BORK,LEAK,XLEAK
Expand Down
9 changes: 6 additions & 3 deletions .github/actions/test-linux/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,16 @@ runs:
-d opcache.jit=${{ inputs.jitType }} \
-d opcache.protect_memory=1 \
-d opcache.jit_buffer_size=64M \
-d opcache.jit_max_root_traces=1000000 \
-d opcache.jit_max_side_traces=1000000 \
-d opcache.jit_max_exit_counters=1000000 \
-d opcache.jit_max_root_traces=100000 \
-d opcache.jit_max_side_traces=100000 \
-d opcache.jit_max_exit_counters=100000 \
-d opcache.jit_hot_loop=1 \
-d opcache.jit_hot_func=1 \
-d opcache.jit_hot_return=1 \
-d opcache.jit_hot_side_exit=1 \
-d opcache.jit_blacklist_root_trace=255 \
-d opcache.jit_blacklist_side_trace=255 \
-d opcache.file_update_protection=0 \
-j$(/usr/bin/nproc) \
-g FAIL,BORK,LEAK,XLEAK \
--no-progress \
Expand Down
9 changes: 6 additions & 3 deletions .github/actions/test-macos/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,16 @@ runs:
-d opcache.jit=${{ inputs.jitType }} \
-d opcache.protect_memory=1 \
-d opcache.jit_buffer_size=64M \
-d opcache.jit_max_root_traces=1000000 \
-d opcache.jit_max_side_traces=1000000 \
-d opcache.jit_max_exit_counters=1000000 \
-d opcache.jit_max_root_traces=100000 \
-d opcache.jit_max_side_traces=100000 \
-d opcache.jit_max_exit_counters=100000 \
-d opcache.jit_hot_loop=1 \
-d opcache.jit_hot_func=1 \
-d opcache.jit_hot_return=1 \
-d opcache.jit_hot_side_exit=1 \
-d opcache.jit_blacklist_root_trace=255 \
-d opcache.jit_blacklist_side_trace=255 \
-d opcache.file_update_protection=0 \
-j$(sysctl -n hw.ncpu) \
-g FAIL,BORK,LEAK,XLEAK \
--no-progress \
Expand Down
37 changes: 37 additions & 0 deletions .github/patch.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

register_shutdown_function(function () {
$status = opcache_get_status(false);
var_dump($status);

$ok = true;
if ($status["memory_usage"]["free_memory"] < 10*1024*1024) {
echo "Not enough free opcache memory!".PHP_EOL;
$ok = false;
}
if ($status["interned_strings_usage"]["free_memory"] < 1*1024*1024) {
echo "Not enough free interned strings memory!".PHP_EOL;
$ok = false;
}
if ($status["jit"]["buffer_free"] < 10*1024*1024) {
echo "Not enough free JIT memory!".PHP_EOL;
$ok = false;
}
if (!$status["jit"]["on"]) {
echo "JIT is not enabled!".PHP_EOL;
$ok = false;
}

unset($status);
gc_collect_cycles();

if (!$ok) die(130);
});

$argc--;
array_shift($argv);

$_SERVER['argc']--;
array_shift($_SERVER['argv']);

require $argv[0];
2 changes: 1 addition & 1 deletion .github/scripts/windows/test_task.bat
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ set OPENSSL_CONF=
rem set SSLEAY_CONF=

rem prepare for OPcache
if "%OPCACHE%" equ "1" set OPCACHE_OPTS=-d opcache.enable=1 -d opcache.enable_cli=1 -d opcache.protect_memory=1 -d opcache.jit_buffer_size=64M -d opcache.jit_max_root_traces=1000000 -d opcache.jit_max_side_traces=1000000 -d opcache.jit_max_exit_counters=1000000 -d opcache.jit_hot_loop=1 -d opcache.jit_hot_func=1 -d opcache.jit_hot_return=1 -d opcache.jit_hot_side_exit=1 -d opcache.jit=tracing
if "%OPCACHE%" equ "1" set OPCACHE_OPTS=-d opcache.enable=1 -d opcache.enable_cli=1 -d opcache.protect_memory=1 -d opcache.jit_buffer_size=64M -d opcache.jit_max_root_traces=100000 -d opcache.jit_max_side_traces=100000 -d opcache.jit_max_exit_counters=100000 -d opcache.jit_hot_loop=1 -d opcache.jit_hot_func=1 -d opcache.jit_hot_return=1 -d opcache.jit_hot_side_exit=1 -d opcache.jit=tracing -d opcache.file_update_protection=0 -d opcache.jit_blacklist_root_trace=255 -d opcache.jit_blacklist_side_trace=255
rem work-around for failing to dl(mysqli) with OPcache (https://github.com/php/php-src/issues/8508)
if "%OPCACHE%" equ "1" set OPCACHE_OPTS=%OPCACHE_OPTS% -d extension=mysqli

Expand Down
58 changes: 48 additions & 10 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -380,15 +380,43 @@ jobs:
echo opcache.enable_cli=1 >> /etc/php.d/opcache.ini
echo opcache.protect_memory=1 >> /etc/php.d/opcache.ini
echo opcache.jit_buffer_size=1G >> /etc/php.d/opcache.ini
echo opcache.jit_max_root_traces=1000000 >> /etc/php.d/opcache.ini
echo opcache.jit_max_side_traces=1000000 >> /etc/php.d/opcache.ini
echo opcache.jit_max_exit_counters=1000000 >> /etc/php.d/opcache.ini
echo opcache.jit_max_root_traces=100000 >> /etc/php.d/opcache.ini
echo opcache.jit_max_side_traces=100000 >> /etc/php.d/opcache.ini
echo opcache.jit_max_exit_counters=100000 >> /etc/php.d/opcache.ini
echo opcache.jit_hot_loop=1 >> /etc/php.d/opcache.ini
echo opcache.jit_hot_func=1 >> /etc/php.d/opcache.ini
echo opcache.jit_hot_return=1 >> /etc/php.d/opcache.ini
echo opcache.jit_hot_side_exit=1 >> /etc/php.d/opcache.ini
echo opcache.jit_blacklist_root_trace=255 >> /etc/php.d/opcache.ini
echo opcache.jit_blacklist_side_trace=255 >> /etc/php.d/opcache.ini
echo opcache.file_update_protection=0 >> /etc/php.d/opcache.ini
echo opcache.memory_consumption=2G >> /etc/php.d/opcache.ini
echo opcache.interned_strings_buffer=64 >> /etc/php.d/opcache.ini
echo opcache.max_accelerated_files=100000 >> /etc/php.d/opcache.ini
echo memory_limit=-1 >> /etc/php.d/opcache.ini
php -v
- name: Test Psalm
if: matrix.branch.ref != 'PHP-8.0'
run: |
git clone https://github.com/vimeo/psalm --branch=master
cd psalm
git checkout 7428e49b115a2a837aa29cf0fafd0ca902fe2457
export ASAN_OPTIONS=exitcode=139
# Needed to avoid overwriting JIT config
export PSALM_ALLOW_XDEBUG=1
danog marked this conversation as resolved.
Show resolved Hide resolved
php /usr/bin/composer install --no-progress --ignore-platform-reqs
php $GITHUB_WORKSPACE/.github/patch.php ./psalm --no-cache || exit $?
- name: Test PHPStan
if: matrix.branch.ref != 'PHP-8.0'
run: |
git clone https://github.com/phpstan/phpstan-src
cd phpstan-src
git checkout d02cc99d4480a203a2dbe54a5ded2da016266b11
sed 's/80399/89999/g' -i conf/parametersSchema.neon
php /usr/bin/composer install --no-progress --ignore-platform-reqs
export ASAN_OPTIONS=exitcode=139
php $GITHUB_WORKSPACE/.github/patch.php bin/phpstan clear-result-cache
php $GITHUB_WORKSPACE/.github/patch.php bin/phpstan || exit $?
- name: Test AMPHP
if: matrix.branch.ref != 'PHP-8.0'
run: |
Expand All @@ -401,7 +429,7 @@ jobs:
git rev-parse HEAD
php /usr/bin/composer install --no-progress --ignore-platform-reqs
export ASAN_OPTIONS=exitcode=139
vendor/bin/phpunit || EXIT_CODE=$?
php $GITHUB_WORKSPACE/.github/patch.php vendor/bin/phpunit || EXIT_CODE=$?
if [ ${EXIT_CODE:-0} -gt 128 ]; then
X=1;
fi
Expand All @@ -418,7 +446,7 @@ jobs:
# Hack to disable a test that hangs
php -r '$c = file_get_contents("tests/Filesystem/FilesystemTest.php"); $c = str_replace("*/\n public function testSharedGet()", "* @group skip\n */\n public function testSharedGet()", $c); file_put_contents("tests/Filesystem/FilesystemTest.php", $c);'
export ASAN_OPTIONS=exitcode=139
php vendor/bin/phpunit --exclude-group skip || EXIT_CODE=$?
php $GITHUB_WORKSPACE/.github/patch.php vendor/bin/phpunit --exclude-group skip || EXIT_CODE=$?
if [ ${EXIT_CODE:-0} -gt 128 ]; then
exit 1
fi
Expand All @@ -434,7 +462,7 @@ jobs:
git rev-parse HEAD
php /usr/bin/composer install --no-progress --ignore-platform-reqs
export ASAN_OPTIONS=exitcode=139
vendor/bin/phpunit || EXIT_CODE=$?
php $GITHUB_WORKSPACE/.github/patch.php vendor/bin/phpunit || EXIT_CODE=$?
if [ $[EXIT_CODE:-0} -gt 128 ]; then
X=1;
fi
Expand All @@ -449,7 +477,7 @@ jobs:
git rev-parse HEAD
php /usr/bin/composer install --no-progress --ignore-platform-reqs
export ASAN_OPTIONS=exitcode=139
vendor/bin/phpunit || EXIT_CODE=$?
php $GITHUB_WORKSPACE/.github/patch.php vendor/bin/phpunit || EXIT_CODE=$?
if [ ${EXIT_CODE:-0} -gt 128 ]; then
exit 1
fi
Expand All @@ -469,12 +497,22 @@ jobs:
export SYMFONY_DEPRECATIONS_HELPER=max[total]=999
X=0
for component in $(find src/Symfony -mindepth 2 -type f -name phpunit.xml.dist -printf '%h\n'); do
php ./phpunit $component --exclude-group tty,benchmark,intl-data,transient --exclude-group skip || EXIT_CODE=$?
php $GITHUB_WORKSPACE/.github/patch.php ./phpunit $component --exclude-group tty,benchmark,intl-data,transient --exclude-group skip || EXIT_CODE=$?
if [ ${EXIT_CODE:-0} -gt 128 ]; then
X=1;
fi
done
exit $X
- name: Test PHPSeclib
if: always()
run: |
git clone https://github.com/phpseclib/phpseclib --branch=master
cd phpseclib
git checkout 259bd9f1e8af11726ed74acf527c2c046549061b
export ASAN_OPTIONS=exitcode=139
export PHPSECLIB_ALLOW_JIT=1
php /usr/bin/composer install --no-progress --ignore-platform-reqs
php $GITHUB_WORKSPACE/.github/patch.php vendor/bin/paratest --verbose --configuration=tests/phpunit.xml --runner=WrapperRunner || exit $?
- name: Test PHPUnit
if: always()
run: |
Expand All @@ -483,7 +521,7 @@ jobs:
git rev-parse HEAD
export ASAN_OPTIONS=exitcode=139
php /usr/bin/composer install --no-progress --ignore-platform-reqs
php ./phpunit || EXIT_CODE=$?
php $GITHUB_WORKSPACE/.github/patch.php ./phpunit || EXIT_CODE=$?
if [ ${EXIT_CODE:-0} -gt 128 ]; then
exit 1
fi
Expand All @@ -507,7 +545,7 @@ jobs:
sed -i 's/youremptytestdbnamehere/test/g' wp-tests-config.php
sed -i 's/yourusernamehere/root/g' wp-tests-config.php
sed -i 's/yourpasswordhere/root/g' wp-tests-config.php
php vendor/bin/phpunit || EXIT_CODE=$?
php $GITHUB_WORKSPACE/.github/patch.php vendor/bin/phpunit || EXIT_CODE=$?
if [ $EXIT_CODE -gt 128 ]; then
exit 1
fi
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ before_script:

# Run PHPs run-tests.php
script:
- travis_wait 60 ./travis/test.sh -d opcache.jit=tracing -d opcache.jit_buffer_size=64M -d opcache.jit_max_root_traces=1000000 -d opcache.jit_max_side_traces=1000000 -d opcache.jit_max_exit_counters=1000000 -d opcache.jit_hot_loop=1 -d opcache.jit_hot_func=1 -d opcache.jit_hot_return=1 -d opcache.jit_hot_side_exit=1
- travis_wait 60 ./travis/test.sh -d opcache.jit=tracing -d opcache.jit_buffer_size=64M -d opcache.jit_max_root_traces=100000 -d opcache.jit_max_side_traces=100000 -d opcache.jit_max_exit_counters=100000 -d opcache.jit_hot_loop=1 -d opcache.jit_hot_func=1 -d opcache.jit_hot_return=1 -d opcache.jit_hot_side_exit=1 -d opcache.file_update_protection=0 -d opcache.jit_blacklist_root_trace=255 -d opcache.jit_blacklist_side_trace=255
- sapi/cli/php -d extension_dir=`pwd`/modules -r 'dl("zend_test");'

after_success:
Expand Down
2 changes: 2 additions & 0 deletions run-tests.php
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,8 @@ function main(): void
'opcache.jit_hot_func=1',
'opcache.jit_hot_return=1',
'opcache.jit_hot_side_exit=1',
'opcache.jit_blacklist_root_trace=255',
'opcache.jit_blacklist_side_trace=255',
'zend.assertions=1',
'zend.exception_ignore_args=0',
'zend.exception_string_param_max_len=15',
Expand Down