Skip to content

Repeat JIT tests #12495

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

Closed
wants to merge 10 commits into from
Closed
Show file tree
Hide file tree
Changes from 6 commits
Commits
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
1 change: 1 addition & 0 deletions .github/actions/test-linux/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ runs:
export TEST_PHP_JUNIT=junit.out.xml
export STACK_LIMIT_DEFAULTS_CHECK=1
sapi/cli/php run-tests.php -P -q ${{ inputs.runTestsParameters }} \
${{ inputs.jitType == 'disable' && '' || '--repeat 2' }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CircleCI already tests with --repeat 2, I think that's enough.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue with combining --repeat with ASAN is that --repeat disabled certain tests (e.g. all tests with a CLEAN section). So this would essentially stop testing all DB extensions on ASAN, amongst other things.

-d opcache.jit=${{ inputs.jitType }} \
-d opcache.protect_memory=1 \
-d opcache.jit_buffer_size=64M \
Expand Down
1 change: 1 addition & 0 deletions .github/actions/test-macos/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ runs:
export TEST_PHP_JUNIT=junit.out.xml
export STACK_LIMIT_DEFAULTS_CHECK=1
sapi/cli/php run-tests.php -P -q ${{ inputs.runTestsParameters }} \
${{ inputs.jitType == 'disable' && '' || '--repeat 2' }}
-d opcache.jit=${{ inputs.jitType }} \
-d opcache.protect_memory=1 \
-d opcache.jit_buffer_size=64M \
Expand Down
30 changes: 30 additions & 0 deletions .github/jit_check.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

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

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

unset($status);
gc_collect_cycles();
});

$argc--;
array_shift($argv);

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

require $argv[0];
15 changes: 3 additions & 12 deletions .github/nightly_matrix.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,26 +46,17 @@ function get_matrix_include(array $branches) {
$jobs = [];
foreach ($branches as $branch) {
$jobs[] = [
'name' => '_ASAN_UBSAN',
'name' => '_ASAN_UBSAN_REPEAT',
'branch' => $branch,
'debug' => true,
'zts' => true,
'configuration_parameters' => "CFLAGS='-fsanitize=undefined,address -DZEND_TRACK_ARENA_ALLOC' LDFLAGS='-fsanitize=undefined,address'",
'run_tests_parameters' => '--asan',
'test_function_jit' => false,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that function JIT was specifically disabled on ASAN because it exceeded the 6h limit on GitHub Actions.

'timeout_minutes' => 3600,
'test_function_jit' => true,
'asan' => true,
];
if ($branch['ref'] !== 'PHP-8.0') {
$jobs[] = [
'name' => '_REPEAT',
'branch' => $branch,
'debug' => true,
'zts' => false,
'run_tests_parameters' => '--repeat 2',
'timeout_minutes' => 360,
'test_function_jit' => true,
'asan' => false,
];
$jobs[] = [
'name' => '_VARIATION',
'branch' => $branch,
Expand Down
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=100000 -d opcache.jit_max_side_traces=100000 -d opcache.jit_max_exit_counters=100000 -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=tracing --repeat 2
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, I don't think --repeat should be added unless we can make sure it works for all tests, or unless the architecture is already tested without --repeat.

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
63 changes: 56 additions & 7 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,9 @@ jobs:
run: |
echo zend_extension=opcache.so > /etc/php.d/opcache.ini
echo opcache.enable_cli=1 >> /etc/php.d/opcache.ini
echo opcache.enable=1 >> /etc/php.d/opcache.ini
echo opcache.protect_memory=1 >> /etc/php.d/opcache.ini
echo opcache.jit=tracing >> /etc/php.d/opcache.ini
echo opcache.jit_buffer_size=1G >> /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
Expand All @@ -373,8 +375,45 @@ jobs:
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=256M >> /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 Infection
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think your PRs still do too much at a time 🙂 E.g. just adding Infection without jit_check.php or other changes would be much easier to review and merge.

if: matrix.branch.ref != 'PHP-8.0'
run: |
git clone https://github.com/infection/infection --branch=master --depth 1
cd infection
git rev-parse HEAD
export ASAN_OPTIONS=exitcode=139
php /usr/bin/composer install --no-progress --ignore-platform-reqs
php $GITHUB_WORKSPACE/.github/jit_check.php vendor/bin/phpunit || exit $?
- name: Test Psalm
if: matrix.branch.ref != 'PHP-8.0'
run: |
git clone https://github.com/vimeo/psalm --branch=master --depth 1
cd psalm
git rev-parse HEAD
export ASAN_OPTIONS=exitcode=139
# Needed to avoid overwriting JIT config
export PSALM_ALLOW_XDEBUG=1
php /usr/bin/composer install --no-progress --ignore-platform-reqs
php $GITHUB_WORKSPACE/.github/jit_check.php ./psalm --no-cache || exit $?
- name: Test PHPStan
if: matrix.branch.ref != 'PHP-8.0'
run: |
git clone https://github.com/phpstan/phpstan-src --depth 1
cd phpstan-src
git rev-parse HEAD
sed -E 's/phpVersion(.*)max[^)]+/phpVersion\1max(89999/g' conf/parametersSchema.neon -i
php /usr/bin/composer install --no-progress --ignore-platform-reqs
export ASAN_OPTIONS=exitcode=139
php $GITHUB_WORKSPACE/.github/jit_check.php bin/phpstan clear-result-cache
php $GITHUB_WORKSPACE/.github/jit_check.php bin/phpstan || exit $?
- name: Test AMPHP
if: matrix.branch.ref != 'PHP-8.0'
run: |
Expand All @@ -387,7 +426,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/jit_check.php vendor/bin/phpunit || EXIT_CODE=$?
if [ ${EXIT_CODE:-0} -gt 128 ]; then
X=1;
fi
Expand All @@ -404,7 +443,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/jit_check.php vendor/bin/phpunit --exclude-group skip || EXIT_CODE=$?
if [ ${EXIT_CODE:-0} -gt 128 ]; then
exit 1
fi
Expand All @@ -420,7 +459,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/jit_check.php vendor/bin/phpunit || EXIT_CODE=$?
if [ $[EXIT_CODE:-0} -gt 128 ]; then
X=1;
fi
Expand All @@ -435,7 +474,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/jit_check.php vendor/bin/phpunit || EXIT_CODE=$?
if [ ${EXIT_CODE:-0} -gt 128 ]; then
exit 1
fi
Expand All @@ -455,12 +494,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/jit_check.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 --depth 1
cd phpseclib
git rev-parse HEAD
export ASAN_OPTIONS=exitcode=139
export PHPSECLIB_ALLOW_JIT=1
php /usr/bin/composer install --no-progress --ignore-platform-reqs
php $GITHUB_WORKSPACE/.github/jit_check.php vendor/bin/paratest --verbose --configuration=tests/phpunit.xml --runner=WrapperRunner || exit $?
- name: Test PHPUnit
if: always()
run: |
Expand All @@ -469,7 +518,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/jit_check.php ./phpunit || EXIT_CODE=$?
if [ ${EXIT_CODE:-0} -gt 128 ]; then
exit 1
fi
Expand All @@ -493,7 +542,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/jit_check.php vendor/bin/phpunit || EXIT_CODE=$?
if [ $EXIT_CODE -gt 128 ]; then
exit 1
fi
Expand Down
1 change: 1 addition & 0 deletions ext/standard/tests/dir/bug71542.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Bug #71542 (disk_total_space does not work with relative paths)
--FILE--
<?php
chdir(__DIR__);
$dir = basename(getcwd());
chdir("..");
var_dump(
Expand Down