|
| 1 | +parameters: |
| 2 | + configurationName: '' |
| 3 | + configurationParameters: '' |
| 4 | + timeoutInMinutes: 60 |
| 5 | + |
| 6 | +# The purpose of the job is to test open-source community projects against an aggressive |
| 7 | +# debug build, that enables assertions, as well as the address and UB sanitizers. However, |
| 8 | +# we are only interested in finding assertion failures, segfaults and sanitizer violations, |
| 9 | +# and don't care about the actual test results, as there will commonly be failures for |
| 10 | +# pre-release versions of PHP. |
| 11 | +# |
| 12 | +# Because exit() in PHP results in an unclean shutdown, test runs are patching phpunit to |
| 13 | +# avoid the exit, which allows us to also check for memory leaks. Otherwise we use |
| 14 | +# USE_TRACKED_ALLOC=1 to avoid reporting of leaks that will be handled by ZMM. |
| 15 | +jobs: |
| 16 | + - job: ${{ parameters.configurationName }} |
| 17 | + timeoutInMinutes: ${{ parameters.timeoutInMinutes }} |
| 18 | + pool: |
| 19 | + vmImage: 'ubuntu-latest' |
| 20 | + steps: |
| 21 | + - template: apt.yml |
| 22 | + - script: | |
| 23 | + # Compile a newer version of curl, otherwise there will be an asan warning |
| 24 | + # when running symfony tests. |
| 25 | + wget https://curl.haxx.se/download/curl-7.65.3.tar.gz |
| 26 | + tar xzf curl-7.65.3.tar.gz |
| 27 | + cd curl-7.65.3/ |
| 28 | + ./configure |
| 29 | + make -j2 |
| 30 | + sudo make install |
| 31 | + displayName: 'Build Curl' |
| 32 | + - template: configure.yml |
| 33 | + parameters: |
| 34 | + configurationParameters: ${{ parameters.configurationParameters }} |
| 35 | + - script: make -j$(/usr/bin/nproc) >/dev/null |
| 36 | + displayName: 'Make Build' |
| 37 | + - script: | |
| 38 | + sudo make install |
| 39 | + sudo mkdir /etc/php.d |
| 40 | + sudo chmod 777 /etc/php.d |
| 41 | + echo mysqli.default_socket=/var/run/mysqld/mysqld.sock > /etc/php.d/mysqli.ini |
| 42 | + echo pdo_mysql.default_socket=/var/run/mysqld/mysqld.sock > /etc/php.d/pdo_mysql.ini |
| 43 | + # Run with opcache to also catch optimizer bugs. |
| 44 | + echo zend_extension=opcache.so > /etc/php.d/opcache.ini |
| 45 | + echo opcache.enable_cli=1 >> /etc/php.d/opcache.ini |
| 46 | + echo opcache.protect_memory=1 >> /etc/php.d/opcache.ini |
| 47 | + displayName: 'Install Build' |
| 48 | + - script: | |
| 49 | + git clone https://github.com/laravel/framework.git --branch=master --depth=1 |
| 50 | + cd framework |
| 51 | + php7.3 /usr/bin/composer install --no-progress |
| 52 | + export USE_ZEND_ALLOC=0 |
| 53 | + sed -i 's/$exit = true/$exit = false/g' vendor/phpunit/phpunit/src/TextUI/Command.php |
| 54 | + # Avoid test using exit(), which thus leaks. |
| 55 | + # We can use USE_TRACKED_ALLOC=1 if more of these show up. |
| 56 | + sed -i "s/function_exists('pcntl_fork')/false/" tests/Filesystem/FilesystemTest.php |
| 57 | + php vendor/bin/phpunit |
| 58 | + displayName: 'Test Laravel' |
| 59 | + - script: | |
| 60 | + git clone https://github.com/symfony/symfony.git --branch=master --depth=1 |
| 61 | + cd symfony |
| 62 | + php7.3 /usr/bin/composer install --no-progress |
| 63 | + export USE_ZEND_ALLOC=0 |
| 64 | + export USE_TRACKED_ALLOC=1 |
| 65 | + export ASAN_OPTIONS=exitcode=139 |
| 66 | + # Close stdin because we hang on some kind of tty test otherwise. |
| 67 | + php ./phpunit 0<&- |
| 68 | + if [ $? -gt 128 ]; then |
| 69 | + exit 1 |
| 70 | + fi |
| 71 | + displayName: 'Test Symfony' |
| 72 | + condition: or(succeeded(), failed()) |
| 73 | + - script: | |
| 74 | + git clone https://github.com/amphp/amp.git --branch=master --depth=1 |
| 75 | + cd amp |
| 76 | + php7.3 /usr/bin/composer install --no-progress --ignore-platform-reqs |
| 77 | + export USE_ZEND_ALLOC=0 |
| 78 | + sed -i 's/$exit = true/$exit = false/g' vendor/phpunit/phpunit/src/TextUI/Command.php |
| 79 | + php vendor/bin/phpunit |
| 80 | + displayName: 'Test Amphp' |
| 81 | + condition: or(succeeded(), failed()) |
0 commit comments