From 14561fd8e14e28c79985f7b852159b406d2236c9 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Mon, 23 Oct 2023 23:04:58 +0200 Subject: [PATCH] Fixes --- Dockerfile | 9 ++++++--- bugs/1_infection.sh | 12 +++++++++--- bugs/2_psalm.sh | 8 ++++++-- bugs/3_psalm_new.sh | 8 ++++++-- bugs/wrap.php | 30 ++++++++++++++++++++++++++++++ php.ini | 2 -- 6 files changed, 57 insertions(+), 12 deletions(-) create mode 100644 bugs/wrap.php diff --git a/Dockerfile b/Dockerfile index 546ea19..d834ad6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 \ No newline at end of file diff --git a/bugs/1_infection.sh b/bugs/1_infection.sh index 45279a5..2ef8e3e 100755 --- a/bugs/1_infection.sh +++ b/bugs/1_infection.sh @@ -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!" \ No newline at end of file diff --git a/bugs/2_psalm.sh b/bugs/2_psalm.sh index affe0c9..0857109 100755 --- a/bugs/2_psalm.sh +++ b/bugs/2_psalm.sh @@ -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!" \ No newline at end of file diff --git a/bugs/3_psalm_new.sh b/bugs/3_psalm_new.sh index 6ee5c8f..3942ae3 100755 --- a/bugs/3_psalm_new.sh +++ b/bugs/3_psalm_new.sh @@ -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!" \ No newline at end of file diff --git a/bugs/wrap.php b/bugs/wrap.php new file mode 100644 index 0000000..c8b0ec9 --- /dev/null +++ b/bugs/wrap.php @@ -0,0 +1,30 @@ +