This commit is contained in:
Daniil Gentili 2023-10-23 23:04:58 +02:00
parent 667be01cc2
commit 14561fd8e1
6 changed files with 57 additions and 12 deletions

View File

@ -28,9 +28,9 @@ RUN true \
pkg-config autoconf bison re2c \
libxml2-dev libsqlite3-dev \
systemtap-sdt-dev libssl-dev \
libpcre2-dev libargon2-dev libedit-dev libsodium-dev llvm-16 libonig-dev \
\
&& git clone --depth 1 https://github.com/php/php-src -b PHP-8.1 && cd php-src \
libpcre2-dev libargon2-dev libedit-dev libsodium-dev llvm-16 libonig-dev
RUN git clone https://github.com/php/php-src -b master && cd php-src \
\
&& ./buildconf \
&& ./configure --prefix=/usr \
@ -61,7 +61,10 @@ ADD php.ini /etc/php/php.ini
RUN php -r "readfile('https://getcomposer.org/installer');" | php \
&& mv composer.phar /usr/bin/composer
RUN git config --global --add safe.directory /app
ENV USE_ZEND_ALLOC=0
ENV PSALM_ALLOW_XDEBUG=1
ENV ASAN_OPTIONS="detect_leaks=0:exitcode=139"
WORKDIR /app

View File

@ -2,6 +2,7 @@
#!/bin/bash -e
wrap=$PWD/bugs/wrap.php
standalone=$PWD/bugs/1_infection.php
cd /tmp
@ -14,19 +15,24 @@ cd infection
composer i --ignore-platform-reqs
cp $standalone .
cp $wrap .
echo "About to run the standalone test"
docker run -v $PWD:/app --rm --privileged -it asan_tests /usr/bin/php /app/1_infection.php
docker run -v $PWD:/app --rm --privileged -it asan_tests /usr/bin/php /app/wrap.php /app/1_infection.php
echo "About to run the testsuite"
docker run -v $PWD:/app --rm --privileged -it asan_tests /usr/bin/php vendor/bin/phpunit
docker run -v $PWD:/app --rm --privileged -it asan_tests /usr/bin/php /app/wrap.php vendor/bin/phpunit || EXIT_CODE=$?
if [ $EXIT_CODE -gt 128 ]; then
exit $EXIT_CODE
fi
echo "About to run composer"
rm -rf vendor
docker run -v $PWD:/app --rm --privileged -it asan_tests composer update
docker run -v $PWD:/app --rm --privileged -it asan_tests /usr/bin/php /app/wrap.php /usr/bin/composer update
echo "OK, no bugs!"

View File

@ -1,5 +1,7 @@
#!/bin/bash -e
standalone=$PWD/bugs/wrap.php
cd /tmp
rm -rf psalm
@ -12,18 +14,20 @@ git branch -D master || true
git branch master
git checkout master
cp $standalone .
export PSALM_ALLOW_XDEBUG=1
composer i --ignore-platform-reqs
echo "About to run phpunit"
docker run -v $PWD:/app --rm --privileged -it asan_tests /usr/bin/php /app/vendor/bin/phpunit --debug tests/MagicMethodAnnotationTest.php
docker run -v $PWD:/app --rm --privileged -it asan_tests /usr/bin/php /app/wrap.php /app/vendor/bin/phpunit --debug tests/MagicMethodAnnotationTest.php
echo "About to run composer"
rm -rf vendor
docker run -v $PWD:/app --rm --privileged -it asan_tests composer update
docker run -v $PWD:/app --rm --privileged -it asan_tests /usr/bin/php /app/wrap.php /usr/bin/composer update
echo "OK, no bugs!"

View File

@ -1,5 +1,7 @@
#!/bin/bash -e
standalone=$PWD/bugs/wrap.php
cd /tmp
rm -rf psalm_3
@ -14,16 +16,18 @@ git checkout master
export PSALM_ALLOW_XDEBUG=1
cp $standalone .
composer i --ignore-platform-reqs
echo "About to run psalm"
docker run -v $PWD:/app --rm --privileged -it asan_tests /usr/bin/php /app/psalm --no-cache
docker run -v $PWD:/app --rm --privileged -it asan_tests /usr/bin/php /app/wrap.php /app/psalm --no-cache
echo "About to run composer"
rm -rf vendor
docker run -v $PWD:/app --rm --privileged -it asan_tests composer update
docker run -v $PWD:/app --rm --privileged -it asan_tests /usr/bin/php /app/wrap.php /usr/bin/composer update
echo "OK, no bugs!"

30
bugs/wrap.php Normal file
View File

@ -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];

View File

@ -14,8 +14,6 @@ opcache.file_update_protection=0
opcache.max_accelerated_files=1000000
opcache.interned_strings_buffer=64
;opcache.jit_debug=256
opcache.jit_prof_threshold=0.000000001
opcache.jit_max_root_traces= 30000000
opcache.jit_max_side_traces= 30000000