Skip to content

Commit a3b0be8

Browse files
committed
Add phpseclib, Psalm, PHPStan nightly tests
1 parent 92693a2 commit a3b0be8

File tree

8 files changed

+181
-10
lines changed

8 files changed

+181
-10
lines changed

.cirrus.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ arm_task:
208208
-d opcache.enable_cli=1
209209
-d opcache.jit_buffer_size=16M
210210
-d opcache.jit=function
211+
-d opcache.file_update_protection=0
211212
-P -q -x -j2
212213
-g FAIL,BORK,LEAK,XLEAK
213214
--offline
@@ -218,7 +219,17 @@ arm_task:
218219
sapi/cli/php run-tests.php
219220
-d zend_extension=opcache.so
220221
-d opcache.enable_cli=1
221-
-d opcache.jit_buffer_size=16M
222+
-d opcache.jit_buffer_size=64M
223+
-d opcache.jit_max_root_traces=100000
224+
-d opcache.jit_max_side_traces=100000
225+
-d opcache.jit_max_exit_counters=100000
226+
-d opcache.jit_hot_loop=1
227+
-d opcache.jit_hot_func=1
228+
-d opcache.jit_hot_return=1
229+
-d opcache.jit_hot_side_exit=1
230+
-d opcache.file_update_protection=0
231+
-d opcache.jit_blacklist_root_trace=255
232+
-d opcache.jit_blacklist_side_trace=255
222233
-d opcache.jit=tracing
223234
-P -q -x -j2
224235
-g FAIL,BORK,LEAK,XLEAK

.github/actions/test-linux/action.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,18 @@ runs:
3131
export SKIP_IO_CAPTURE_TESTS=1
3232
sapi/cli/php run-tests.php -P -q ${{ inputs.runTestsParameters }} \
3333
-d opcache.jit=${{ inputs.jitType }} \
34+
-d opcache.protect_memory=1 \
35+
-d opcache.jit_buffer_size=64M \
36+
-d opcache.jit_max_root_traces=100000 \
37+
-d opcache.jit_max_side_traces=100000 \
38+
-d opcache.jit_max_exit_counters=100000 \
39+
-d opcache.jit_hot_loop=1 \
40+
-d opcache.jit_hot_func=1 \
41+
-d opcache.jit_hot_return=1 \
42+
-d opcache.jit_hot_side_exit=1 \
43+
-d opcache.jit_blacklist_root_trace=255 \
44+
-d opcache.jit_blacklist_side_trace=255 \
45+
-d opcache.file_update_protection=0 \
3446
-j$(/usr/bin/nproc) \
3547
-g FAIL,XFAIL,BORK,WARN,LEAK,XLEAK,SKIP \
3648
--offline \

.github/actions/test-macos/action.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,18 @@ runs:
1616
export CI_NO_IPV6=1
1717
sapi/cli/php run-tests.php -P -q ${{ inputs.runTestsParameters }} \
1818
-d opcache.jit=${{ inputs.jitType }} \
19+
-d opcache.protect_memory=1 \
20+
-d opcache.jit_buffer_size=64M \
21+
-d opcache.jit_max_root_traces=100000 \
22+
-d opcache.jit_max_side_traces=100000 \
23+
-d opcache.jit_max_exit_counters=100000 \
24+
-d opcache.jit_hot_loop=1 \
25+
-d opcache.jit_hot_func=1 \
26+
-d opcache.jit_hot_return=1 \
27+
-d opcache.jit_hot_side_exit=1 \
28+
-d opcache.jit_blacklist_root_trace=255 \
29+
-d opcache.jit_blacklist_side_trace=255 \
30+
-d opcache.file_update_protection=0 \
1931
-j$(sysctl -n hw.ncpu) \
2032
-g FAIL,XFAIL,BORK,WARN,LEAK,XLEAK,SKIP \
2133
--offline \

.github/patch.php

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
3+
register_shutdown_function(function () {
4+
$status = opcache_get_status(false);
5+
var_dump($status);
6+
7+
$ok = true;
8+
if ($status["memory_usage"]["free_memory"] < 10*1024*1024) {
9+
echo "Not enough free opcache memory!".PHP_EOL;
10+
$ok = false;
11+
}
12+
if ($status["interned_strings_usage"]["free_memory"] < 1*1024*1024) {
13+
echo "Not enough free interned strings memory!".PHP_EOL;
14+
$ok = false;
15+
}
16+
if ($status["jit"]["buffer_free"] < 10*1024*1024) {
17+
echo "Not enough free JIT memory!".PHP_EOL;
18+
$ok = false;
19+
}
20+
if (!$status["jit"]["on"]) {
21+
echo "JIT is not enabled!".PHP_EOL;
22+
$ok = false;
23+
}
24+
25+
unset($status);
26+
gc_collect_cycles();
27+
28+
if (!$ok) die(130);
29+
});
30+
31+
$argc--;
32+
array_shift($argv);
33+
34+
$_SERVER['argc']--;
35+
array_shift($_SERVER['argv']);
36+
37+
require $argv[0];

.github/scripts/windows/test_task.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ set OPENSSL_CONF=
7171
rem set SSLEAY_CONF=
7272

7373
rem prepare for OPcache
74-
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=16M
74+
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
7575
rem work-around for failing to dl(mysqli) with OPcache (https://github.com/php/php-src/issues/8508)
7676
if "%OPCACHE%" equ "1" set OPCACHE_OPTS=%OPCACHE_OPTS% -d extension=mysqli
7777

.github/workflows/nightly.yml

Lines changed: 104 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,62 @@ jobs:
339339
echo opcache.enable_cli=1 >> /etc/php.d/opcache.ini
340340
echo opcache.protect_memory=1 >> /etc/php.d/opcache.ini
341341
echo opcache.jit_buffer_size=1G >> /etc/php.d/opcache.ini
342+
echo opcache.jit_max_root_traces=100000 >> /etc/php.d/opcache.ini
343+
echo opcache.jit_max_side_traces=100000 >> /etc/php.d/opcache.ini
344+
echo opcache.jit_max_exit_counters=100000 >> /etc/php.d/opcache.ini
345+
echo opcache.jit_hot_loop=1 >> /etc/php.d/opcache.ini
346+
echo opcache.jit_hot_func=1 >> /etc/php.d/opcache.ini
347+
echo opcache.jit_hot_return=1 >> /etc/php.d/opcache.ini
348+
echo opcache.jit_hot_side_exit=1 >> /etc/php.d/opcache.ini
349+
echo opcache.jit_blacklist_root_trace=255 >> /etc/php.d/opcache.ini
350+
echo opcache.jit_blacklist_side_trace=255 >> /etc/php.d/opcache.ini
351+
echo opcache.file_update_protection=0 >> /etc/php.d/opcache.ini
352+
echo opcache.memory_consumption=2G >> /etc/php.d/opcache.ini
353+
echo opcache.interned_strings_buffer=64 >> /etc/php.d/opcache.ini
354+
echo opcache.max_accelerated_files=100000 >> /etc/php.d/opcache.ini
355+
echo memory_limit=-1 >> /etc/php.d/opcache.ini
356+
php -v
357+
- name: Test Psalm
358+
if: matrix.branch.ref != 'PHP-8.0'
359+
run: |
360+
git clone https://github.com/vimeo/psalm --branch=master
361+
cd psalm
362+
git checkout 7428e49b115a2a837aa29cf0fafd0ca902fe2457
363+
export ASAN_OPTIONS=exitcode=139
364+
# Needed to avoid overwriting JIT config
365+
export PSALM_ALLOW_XDEBUG=1
366+
php /usr/bin/composer install --no-progress --ignore-platform-reqs
367+
php $GITHUB_WORKSPACE/.github/patch.php ./psalm --no-cache || exit $?
368+
- name: Test PHPStan
369+
if: matrix.branch.ref != 'PHP-8.0'
370+
run: |
371+
git clone https://github.com/phpstan/phpstan-src
372+
cd phpstan-src
373+
git checkout d02cc99d4480a203a2dbe54a5ded2da016266b11
374+
sed 's/80399/89999/g' -i conf/parametersSchema.neon
375+
php /usr/bin/composer install --no-progress --ignore-platform-reqs
376+
export ASAN_OPTIONS=exitcode=139
377+
php $GITHUB_WORKSPACE/.github/patch.php bin/phpstan clear-result-cache
378+
php $GITHUB_WORKSPACE/.github/patch.php bin/phpstan || exit $?
379+
- name: Test AMPHP
380+
if: matrix.branch.ref != 'PHP-8.0'
381+
run: |
382+
repositories="amp cache dns file http parallel parser pipeline process serialization socket sync websocket-client websocket-server"
383+
X=0
384+
for repository in $repositories; do
385+
printf "Testing amp/%s\n" "$repository"
386+
git clone "https://github.com/amphp/$repository.git" "amphp-$repository" --depth 1
387+
cd "amphp-$repository"
388+
git rev-parse HEAD
389+
php /usr/bin/composer install --no-progress --ignore-platform-reqs
390+
export ASAN_OPTIONS=exitcode=139
391+
php $GITHUB_WORKSPACE/.github/patch.php vendor/bin/phpunit || EXIT_CODE=$?
392+
if [ ${EXIT_CODE:-0} -gt 128 ]; then
393+
X=1;
394+
fi
395+
cd ..
396+
done
397+
exit $X
342398
- name: Test Laravel
343399
if: matrix.branch.ref != 'PHP-8.0'
344400
run: |
@@ -349,8 +405,39 @@ jobs:
349405
# Hack to disable a test that hangs
350406
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);'
351407
export ASAN_OPTIONS=exitcode=139
352-
php vendor/bin/phpunit --exclude-group skip || EXIT_CODE=$?
353-
if [ $EXIT_CODE -gt 128 ]; then
408+
php $GITHUB_WORKSPACE/.github/patch.php vendor/bin/phpunit --exclude-group skip || EXIT_CODE=$?
409+
if [ ${EXIT_CODE:-0} -gt 128 ]; then
410+
exit 1
411+
fi
412+
- name: Test ReactPHP
413+
if: matrix.branch.ref != 'PHP-8.0'
414+
run: |
415+
repositories="async cache child-process datagram dns event-loop promise promise-stream promise-timer stream"
416+
X=0
417+
for repository in $repositories; do
418+
printf "Testing reactphp/%s\n" "$repository"
419+
git clone "https://github.com/reactphp/$repository.git" "reactphp-$repository" --depth 1
420+
cd "reactphp-$repository"
421+
git rev-parse HEAD
422+
php /usr/bin/composer install --no-progress --ignore-platform-reqs
423+
export ASAN_OPTIONS=exitcode=139
424+
php $GITHUB_WORKSPACE/.github/patch.php vendor/bin/phpunit || EXIT_CODE=$?
425+
if [ $[EXIT_CODE:-0} -gt 128 ]; then
426+
X=1;
427+
fi
428+
cd ..
429+
done
430+
exit $X
431+
- name: Test Revolt PHP
432+
if: matrix.branch.ref != 'PHP-8.0'
433+
run: |
434+
git clone https://github.com/revoltphp/event-loop.git --depth=1
435+
cd event-loop
436+
git rev-parse HEAD
437+
php /usr/bin/composer install --no-progress --ignore-platform-reqs
438+
export ASAN_OPTIONS=exitcode=139
439+
php $GITHUB_WORKSPACE/.github/patch.php vendor/bin/phpunit || EXIT_CODE=$?
440+
if [ ${EXIT_CODE:-0} -gt 128 ]; then
354441
exit 1
355442
fi
356443
- name: Test Symfony
@@ -369,12 +456,22 @@ jobs:
369456
export SYMFONY_DEPRECATIONS_HELPER=max[total]=999
370457
X=0
371458
for component in $(find src/Symfony -mindepth 2 -type f -name phpunit.xml.dist -printf '%h\n'); do
372-
php ./phpunit $component --exclude-group tty,benchmark,intl-data,transient --exclude-group skip || EXIT_CODE=$?
373-
if [ $EXIT_CODE -gt 128 ]; then
459+
php $GITHUB_WORKSPACE/.github/patch.php ./phpunit $component --exclude-group tty,benchmark,intl-data,transient --exclude-group skip || EXIT_CODE=$?
460+
if [ ${EXIT_CODE:-0} -gt 128 ]; then
374461
X=1;
375462
fi
376463
done
377464
exit $X
465+
- name: Test PHPSeclib
466+
if: always()
467+
run: |
468+
git clone https://github.com/phpseclib/phpseclib --branch=master
469+
cd phpseclib
470+
git checkout 259bd9f1e8af11726ed74acf527c2c046549061b
471+
export ASAN_OPTIONS=exitcode=139
472+
export PHPSECLIB_ALLOW_JIT=1
473+
php /usr/bin/composer install --no-progress --ignore-platform-reqs
474+
php $GITHUB_WORKSPACE/.github/patch.php vendor/bin/paratest --verbose --configuration=tests/phpunit.xml --runner=WrapperRunner || exit $?
378475
- name: Test PHPUnit
379476
if: always()
380477
run: |
@@ -383,8 +480,8 @@ jobs:
383480
git rev-parse HEAD
384481
export ASAN_OPTIONS=exitcode=139
385482
php /usr/bin/composer install --no-progress --ignore-platform-reqs
386-
php ./phpunit || EXIT_CODE=$?
387-
if [ $EXIT_CODE -gt 128 ]; then
483+
php $GITHUB_WORKSPACE/.github/patch.php ./phpunit || EXIT_CODE=$?
484+
if [ ${EXIT_CODE:-0} -gt 128 ]; then
388485
exit 1
389486
fi
390487
- name: 'Symfony Preloading'
@@ -407,7 +504,7 @@ jobs:
407504
sed -i 's/youremptytestdbnamehere/test/g' wp-tests-config.php
408505
sed -i 's/yourusernamehere/root/g' wp-tests-config.php
409506
sed -i 's/yourpasswordhere/root/g' wp-tests-config.php
410-
php vendor/bin/phpunit || EXIT_CODE=$?
507+
php $GITHUB_WORKSPACE/.github/patch.php vendor/bin/phpunit || EXIT_CODE=$?
411508
if [ $EXIT_CODE -gt 128 ]; then
412509
exit 1
413510
fi

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ before_script:
8585

8686
# Run PHPs run-tests.php
8787
script:
88-
- ./travis/test.sh -d opcache.jit_buffer_size=16M -d opcache.jit=tracing
88+
- 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
8989
- sapi/cli/php -d extension_dir=`pwd`/modules -r 'dl("zend_test");'
9090

9191
after_success:

run-tests.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,8 @@ function main(): void
305305
'opcache.jit_hot_func=1',
306306
'opcache.jit_hot_return=1',
307307
'opcache.jit_hot_side_exit=1',
308+
'opcache.jit_blacklist_root_trace=255',
309+
'opcache.jit_blacklist_side_trace=255',
308310
'zend.assertions=1',
309311
'zend.exception_ignore_args=0',
310312
'zend.exception_string_param_max_len=15',

0 commit comments

Comments
 (0)