1parameters: 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. 15jobs: 16 - job: ${{ parameters.configurationName }} 17 timeoutInMinutes: ${{ parameters.timeoutInMinutes }} 18 pool: 19 vmImage: 'ubuntu-18.04' 20 variables: 21 ubsan_options: 'print_stacktrace=1' 22 steps: 23 - template: apt.yml 24 - script: | 25 # Compile a newer version of curl, otherwise there will be an asan warning 26 # when running symfony tests. 27 wget https://curl.haxx.se/download/curl-7.65.3.tar.gz 28 tar xzf curl-7.65.3.tar.gz 29 cd curl-7.65.3/ 30 ./configure 31 make -j2 32 sudo make install 33 displayName: 'Build Curl' 34 - template: configure.yml 35 parameters: 36 configurationParameters: ${{ parameters.configurationParameters }} 37 - script: make -j$(/usr/bin/nproc) >/dev/null 38 displayName: 'Make Build' 39 - script: | 40 sudo make install 41 sudo mkdir /etc/php.d 42 sudo chmod 777 /etc/php.d 43 echo mysqli.default_socket=/var/run/mysqld/mysqld.sock > /etc/php.d/mysqli.ini 44 echo pdo_mysql.default_socket=/var/run/mysqld/mysqld.sock > /etc/php.d/pdo_mysql.ini 45 # Run with opcache to also catch optimizer bugs. 46 echo zend_extension=opcache.so > /etc/php.d/opcache.ini 47 echo opcache.enable_cli=1 >> /etc/php.d/opcache.ini 48 echo opcache.protect_memory=1 >> /etc/php.d/opcache.ini 49 displayName: 'Install Build' 50 - script: | 51 git clone https://github.com/laravel/framework.git --branch=8.x --depth=1 52 cd framework 53 php7.4 /usr/bin/composer install --no-progress 54 export USE_ZEND_ALLOC=0 55 # Avoid test using exit(), which thus leaks. 56 # We can use USE_TRACKED_ALLOC=1 if more of these show up. 57 sed -i 's/$exit = true/$exit = false/g' vendor/phpunit/phpunit/src/TextUI/Command.php 58 # Hack to disable a test that hangs on azure 59 sed -i 's/PHP_OS/"Darwin"/' tests/Filesystem/FilesystemTest.php 60 php vendor/bin/phpunit 61 displayName: 'Test Laravel' 62 - script: | 63 git clone https://github.com/symfony/symfony.git --depth=1 64 cd symfony 65 php7.4 /usr/bin/composer install --no-progress 66 php7.4 ./phpunit install 67 export USE_ZEND_ALLOC=0 68 export USE_TRACKED_ALLOC=1 69 export ASAN_OPTIONS=exitcode=139 70 php ./phpunit --exclude-group tty,benchmark,intl-data,transient 71 if [ $? -gt 128 ]; then 72 exit 1 73 fi 74 displayName: 'Test Symfony' 75 condition: or(succeeded(), failed()) 76 - script: | 77 git clone https://github.com/amphp/amp.git --branch=master --depth=1 78 cd amp 79 php /usr/bin/composer install --no-progress --ignore-platform-reqs 80 export USE_ZEND_ALLOC=0 81 sed -i 's/$exit = true/$exit = false/g' vendor/phpunit/phpunit/src/TextUI/Command.php 82 php vendor/bin/phpunit 83 displayName: 'Test Amphp' 84 condition: or(succeeded(), failed()) 85 - script: | 86 php7.4 /usr/bin/composer create-project symfony/symfony-demo symfony_demo --no-progress 87 cd symfony_demo 88 export USE_ZEND_ALLOC=0 89 export USE_TRACKED_ALLOC=1 90 sed -i 's/PHP_SAPI/"cli-server"/g' var/cache/dev/App_KernelDevDebugContainer.preload.php 91 php -d opcache.preload=var/cache/dev/App_KernelDevDebugContainer.preload.php public/index.php 92 displayName: 'Symfony Preloading' 93 condition: or(succeeded(), failed()) 94