Skip to content

Commit 2813621

Browse files
committed
Add JIT check
1 parent 35c0183 commit 2813621

File tree

2 files changed

+55
-17
lines changed

2 files changed

+55
-17
lines changed

.github/jit_check.php

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

.github/workflows/nightly.yml

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,9 @@ jobs:
378378
run: |
379379
echo zend_extension=opcache.so > /etc/php.d/opcache.ini
380380
echo opcache.enable_cli=1 >> /etc/php.d/opcache.ini
381+
echo opcache.enable=1 >> /etc/php.d/opcache.ini
381382
echo opcache.protect_memory=1 >> /etc/php.d/opcache.ini
383+
echo opcache.jit=tracing >> /etc/php.d/opcache.ini
382384
echo opcache.jit_buffer_size=1G >> /etc/php.d/opcache.ini
383385
echo opcache.jit_max_root_traces=100000 >> /etc/php.d/opcache.ini
384386
echo opcache.jit_max_side_traces=100000 >> /etc/php.d/opcache.ini
@@ -387,30 +389,36 @@ jobs:
387389
echo opcache.jit_hot_func=1 >> /etc/php.d/opcache.ini
388390
echo opcache.jit_hot_return=1 >> /etc/php.d/opcache.ini
389391
echo opcache.jit_hot_side_exit=1 >> /etc/php.d/opcache.ini
392+
echo opcache.jit_blacklist_root_trace=255 >> /etc/php.d/opcache.ini
393+
echo opcache.jit_blacklist_side_trace=255 >> /etc/php.d/opcache.ini
394+
echo opcache.file_update_protection=0 >> /etc/php.d/opcache.ini
395+
echo opcache.memory_consumption=256M >> /etc/php.d/opcache.ini
396+
echo opcache.interned_strings_buffer=64 >> /etc/php.d/opcache.ini
397+
echo opcache.max_accelerated_files=100000 >> /etc/php.d/opcache.ini
390398
echo memory_limit=-1 >> /etc/php.d/opcache.ini
391399
php -v
392400
- name: Test Psalm
393401
if: matrix.branch.ref != 'PHP-8.0'
394402
run: |
395-
git clone https://github.com/vimeo/psalm --branch=master
403+
git clone https://github.com/vimeo/psalm --branch=master --depth 1
396404
cd psalm
397-
git checkout 7428e49b115a2a837aa29cf0fafd0ca902fe2457
405+
git rev-parse HEAD
398406
export ASAN_OPTIONS=exitcode=139
399407
# Needed to avoid overwriting JIT config
400408
export PSALM_ALLOW_XDEBUG=1
401409
php /usr/bin/composer install --no-progress --ignore-platform-reqs
402-
php ./psalm --no-cache || exit $?
410+
php $GITHUB_WORKSPACE/.github/jit_check.php ./psalm --no-cache || exit $?
403411
- name: Test PHPStan
404412
if: matrix.branch.ref != 'PHP-8.0'
405413
run: |
406-
git clone https://github.com/phpstan/phpstan-src
414+
git clone https://github.com/phpstan/phpstan-src --depth 1
407415
cd phpstan-src
408-
git checkout d02cc99d4480a203a2dbe54a5ded2da016266b11
416+
git rev-parse HEAD
409417
sed -E 's/phpVersion(.*)max[^)]+/phpVersion\1max(89999/g' conf/parametersSchema.neon -i
410418
php /usr/bin/composer install --no-progress --ignore-platform-reqs
411419
export ASAN_OPTIONS=exitcode=139
412-
php bin/phpstan clear-result-cache
413-
php bin/phpstan || exit $?
420+
php $GITHUB_WORKSPACE/.github/jit_check.php bin/phpstan clear-result-cache
421+
php $GITHUB_WORKSPACE/.github/jit_check.php bin/phpstan || exit $?
414422
- name: Test AMPHP
415423
if: matrix.branch.ref != 'PHP-8.0'
416424
run: |
@@ -423,7 +431,7 @@ jobs:
423431
git rev-parse HEAD
424432
php /usr/bin/composer install --no-progress --ignore-platform-reqs
425433
export ASAN_OPTIONS=exitcode=139
426-
vendor/bin/phpunit || EXIT_CODE=$?
434+
php $GITHUB_WORKSPACE/.github/jit_check.php vendor/bin/phpunit || EXIT_CODE=$?
427435
if [ ${EXIT_CODE:-0} -gt 128 ]; then
428436
X=1;
429437
fi
@@ -440,7 +448,7 @@ jobs:
440448
# Hack to disable a test that hangs
441449
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);'
442450
export ASAN_OPTIONS=exitcode=139
443-
php vendor/bin/phpunit --exclude-group skip || EXIT_CODE=$?
451+
php $GITHUB_WORKSPACE/.github/jit_check.php vendor/bin/phpunit --exclude-group skip || EXIT_CODE=$?
444452
if [ ${EXIT_CODE:-0} -gt 128 ]; then
445453
exit 1
446454
fi
@@ -456,7 +464,7 @@ jobs:
456464
git rev-parse HEAD
457465
php /usr/bin/composer install --no-progress --ignore-platform-reqs
458466
export ASAN_OPTIONS=exitcode=139
459-
vendor/bin/phpunit || EXIT_CODE=$?
467+
php $GITHUB_WORKSPACE/.github/jit_check.php vendor/bin/phpunit || EXIT_CODE=$?
460468
if [ $[EXIT_CODE:-0} -gt 128 ]; then
461469
X=1;
462470
fi
@@ -471,7 +479,7 @@ jobs:
471479
git rev-parse HEAD
472480
php /usr/bin/composer install --no-progress --ignore-platform-reqs
473481
export ASAN_OPTIONS=exitcode=139
474-
vendor/bin/phpunit || EXIT_CODE=$?
482+
php $GITHUB_WORKSPACE/.github/jit_check.php vendor/bin/phpunit || EXIT_CODE=$?
475483
if [ ${EXIT_CODE:-0} -gt 128 ]; then
476484
exit 1
477485
fi
@@ -491,7 +499,7 @@ jobs:
491499
export SYMFONY_DEPRECATIONS_HELPER=max[total]=999
492500
X=0
493501
for component in $(find src/Symfony -mindepth 2 -type f -name phpunit.xml.dist -printf '%h\n'); do
494-
php ./phpunit $component --exclude-group tty,benchmark,intl-data,transient --exclude-group skip || EXIT_CODE=$?
502+
php $GITHUB_WORKSPACE/.github/jit_check.php ./phpunit $component --exclude-group tty,benchmark,intl-data,transient --exclude-group skip || EXIT_CODE=$?
495503
if [ ${EXIT_CODE:-0} -gt 128 ]; then
496504
X=1;
497505
fi
@@ -500,13 +508,13 @@ jobs:
500508
- name: Test PHPSeclib
501509
if: always()
502510
run: |
503-
git clone https://github.com/phpseclib/phpseclib --branch=master
511+
git clone https://github.com/phpseclib/phpseclib --depth 1
504512
cd phpseclib
505-
git checkout 259bd9f1e8af11726ed74acf527c2c046549061b
513+
git rev-parse HEAD
506514
export ASAN_OPTIONS=exitcode=139
507515
export PHPSECLIB_ALLOW_JIT=1
508516
php /usr/bin/composer install --no-progress --ignore-platform-reqs
509-
php vendor/bin/paratest --verbose --configuration=tests/phpunit.xml --runner=WrapperRunner || exit $?
517+
php $GITHUB_WORKSPACE/.github/jit_check.php vendor/bin/paratest --verbose --configuration=tests/phpunit.xml --runner=WrapperRunner || exit $?
510518
- name: Test PHPUnit
511519
if: always()
512520
run: |
@@ -515,7 +523,7 @@ jobs:
515523
git rev-parse HEAD
516524
export ASAN_OPTIONS=exitcode=139
517525
php /usr/bin/composer install --no-progress --ignore-platform-reqs
518-
php ./phpunit || EXIT_CODE=$?
526+
php $GITHUB_WORKSPACE/.github/jit_check.php ./phpunit || EXIT_CODE=$?
519527
if [ ${EXIT_CODE:-0} -gt 128 ]; then
520528
exit 1
521529
fi
@@ -539,7 +547,7 @@ jobs:
539547
sed -i 's/youremptytestdbnamehere/test/g' wp-tests-config.php
540548
sed -i 's/yourusernamehere/root/g' wp-tests-config.php
541549
sed -i 's/yourpasswordhere/root/g' wp-tests-config.php
542-
php vendor/bin/phpunit || EXIT_CODE=$?
550+
php $GITHUB_WORKSPACE/.github/jit_check.php vendor/bin/phpunit || EXIT_CODE=$?
543551
if [ $EXIT_CODE -gt 128 ]; then
544552
exit 1
545553
fi

0 commit comments

Comments
 (0)