From 04e92ec0a00216f81a5e5cd354a4e7a983288867 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 27 Aug 2019 20:54:50 +0200 Subject: [PATCH 01/22] Add job for community projects We don't look at test results, only check that the test-suite does not segfault or assert. --- azure-pipelines.yml | 7 +++++ azure/community_job.yml | 37 +++++++++++++++++++++++++ azure/configure.yml | 60 +++++++++++++++++++++++++++++++++++++++++ azure/job.yml | 59 +++------------------------------------- 4 files changed, 107 insertions(+), 56 deletions(-) create mode 100644 azure/community_job.yml create mode 100644 azure/configure.yml diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 476104d21abc5..a4174940da8be 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -75,3 +75,10 @@ jobs: configurationName: DEBUG_ZTS_MSAN configurationParameters: '--enable-debug --enable-maintainer-zts' runTestsParameters: --asan + - template: azure/community_job.yml + parameters: + configurationName: COMMUNITY + configurationParameters: >- + --enable-debug --enable-maintainer-zts + CFLAGS='-fsanitize=undefined,address -DZEND_TRACK_ARENA_ALLOC' + LDFLAGS='-fsanitize=undefined,address' diff --git a/azure/community_job.yml b/azure/community_job.yml new file mode 100644 index 0000000000000..bf0879aaad74a --- /dev/null +++ b/azure/community_job.yml @@ -0,0 +1,37 @@ +parameters: + configurationName: '' + configurationParameters: '' + timeoutInMinutes: 60 + +jobs: + - job: ${{ parameters.configurationName }} + timeoutInMinutes: ${{ parameters.timeoutInMinutes }} + pool: + vmImage: 'ubuntu-latest' + steps: + - template: apt.yml + - template: configure.yml + parameters: + configurationParameters: ${{ parameters.configurationParameters }} + - script: make -j$(/usr/bin/nproc) >/dev/null + displayName: 'Make Build' + - script: | + sudo make install + sudo mkdir /etc/php.d + sudo chmod 777 /etc/php.d + echo mysqli.default_socket=/var/run/mysqld/mysqld.sock > /etc/php.d/mysqli.ini + echo pdo_mysql.default_socket=/var/run/mysqld/mysqld.sock > /etc/php.d/pdo_mysql.ini + echo zend_extension=opcache.so > /etc/php.d/opcache.ini + echo opcache.enable_cli=1 >> /etc/php.d/opcache.ini + displayName: 'Install Build' + - script: | + git clone https://github.com/laravel/framework.git --branch=master --depth=1 + cd framework + php7.3 /usr/bin/composer install + export USE_ZEND_ALLOC=0 + php vendor/bin/phpunit + status=$? + if [ $status -gt 128 ]; then + exit 1 + fi + displayName: 'Test Laravel' diff --git a/azure/configure.yml b/azure/configure.yml new file mode 100644 index 0000000000000..15f6847e0bedd --- /dev/null +++ b/azure/configure.yml @@ -0,0 +1,60 @@ +parameters: + configurationParameters: '' + +steps: +- script: | + ./buildconf --force + ./configure ${{ parameters.configurationParameters }} \ + --enable-option-checking=fatal \ + --prefix=/usr \ + --enable-phpdbg \ + --enable-fpm \ + --with-pdo-mysql=mysqlnd \ + --with-mysqli=mysqlnd \ + --with-pgsql \ + --with-pdo-pgsql \ + --with-pdo-sqlite \ + --enable-intl \ + --without-pear \ + --enable-gd \ + --with-jpeg \ + --with-webp \ + --with-freetype \ + --with-xpm \ + --enable-exif \ + --with-zip \ + --with-zlib \ + --with-zlib-dir=/usr \ + --enable-soap \ + --enable-xmlreader \ + --with-xsl \ + --with-tidy \ + --with-xmlrpc \ + --enable-sysvsem \ + --enable-sysvshm \ + --enable-shmop \ + --enable-pcntl \ + --with-readline \ + --enable-mbstring \ + --with-curl \ + --with-gettext \ + --enable-sockets \ + --with-bz2 \ + --with-openssl \ + --with-gmp \ + --enable-bcmath \ + --enable-calendar \ + --enable-ftp \ + --with-pspell=/usr \ + --with-enchant=/usr \ + --with-kerberos \ + --enable-sysvmsg \ + --with-ffi \ + --enable-zend-test \ + --with-ldap \ + --with-ldap-sasl \ + --with-password-argon2 \ + --enable-werror \ + --with-config-file-path=/etc \ + --with-config-file-scan-dir=/etc/php.d + displayName: 'Configure Build' diff --git a/azure/job.yml b/azure/job.yml index 50d1178968ae7..e4af6d631e039 100644 --- a/azure/job.yml +++ b/azure/job.yml @@ -11,62 +11,9 @@ jobs: vmImage: 'ubuntu-latest' steps: - template: apt.yml - - script: | - ./buildconf --force - ./configure ${{ parameters.configurationParameters }} \ - --enable-option-checking=fatal \ - --prefix=/usr \ - --enable-phpdbg \ - --enable-fpm \ - --with-pdo-mysql=mysqlnd \ - --with-mysqli=mysqlnd \ - --with-pgsql \ - --with-pdo-pgsql \ - --with-pdo-sqlite \ - --enable-intl \ - --without-pear \ - --enable-gd \ - --with-jpeg \ - --with-webp \ - --with-freetype \ - --with-xpm \ - --enable-exif \ - --with-zip \ - --with-zlib \ - --with-zlib-dir=/usr \ - --enable-soap \ - --enable-xmlreader \ - --with-xsl \ - --with-tidy \ - --with-xmlrpc \ - --enable-sysvsem \ - --enable-sysvshm \ - --enable-shmop \ - --enable-pcntl \ - --with-readline \ - --enable-mbstring \ - --with-curl \ - --with-gettext \ - --enable-sockets \ - --with-bz2 \ - --with-openssl \ - --with-gmp \ - --enable-bcmath \ - --enable-calendar \ - --enable-ftp \ - --with-pspell=/usr \ - --with-enchant=/usr \ - --with-kerberos \ - --enable-sysvmsg \ - --with-ffi \ - --enable-zend-test \ - --with-ldap \ - --with-ldap-sasl \ - --with-password-argon2 \ - --enable-werror \ - --with-config-file-path=/etc \ - --with-config-file-scan-dir=/etc/php.d - displayName: 'Configure Build' + - template: configure.yml + parameters: + configurationParameters: ${{ parameters.configurationParameters }} - script: make -j$(/usr/bin/nproc) >/dev/null displayName: 'Make Build' - script: | From cd8ce85083efe86da9f9f4c5b6a59d64fcf3eb30 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 27 Aug 2019 20:56:02 +0200 Subject: [PATCH 02/22] Prune azure-pipelines --- azure-pipelines.yml | 75 ++++----------------------------------------- 1 file changed, 6 insertions(+), 69 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index a4174940da8be..3346dd5d1dfb7 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -12,73 +12,10 @@ trigger: - UPGRADING.INTERNALS jobs: - - template: azure/job.yml + - template: azure/community_job.yml parameters: - configurationName: DEBUG_NTS - configurationParameters: '--enable-debug --disable-maintainer-zts' - - template: azure/job.yml - parameters: - configurationName: RELEASE_ZTS - configurationParameters: '--disable-debug --enable-maintainer-zts' - - template: azure/i386/job.yml - parameters: - configurationName: I386_DEBUG_ZTS - configurationParameters: '--enable-debug --enable-maintainer-zts' - - template: azure/macos/job.yml - parameters: - configurationName: MACOS_DEBUG_NTS - configurationParameters: '--enable-debug --disable-maintainer-zts' - - ${{ if eq(variables['Build.Reason'], 'Schedule') }}: - - template: azure/job.yml - parameters: - configurationName: DEBUG_ZTS - configurationParameters: '--enable-debug --enable-maintainer-zts' - - template: azure/job.yml - parameters: - configurationName: RELEASE_NTS - configurationParameters: '--disable-debug --disable-maintainer-zts' - - template: azure/i386/job.yml - parameters: - configurationName: I386_DEBUG_NTS - configurationParameters: '--enable-debug --disable-maintainer-zts' - - template: azure/i386/job.yml - parameters: - configurationName: I386_RELEASE_NTS - configurationParameters: '--disable-debug --disable-maintainer-zts' - - template: azure/i386/job.yml - parameters: - configurationName: I386_RELEASE_ZTS - configurationParameters: '--disable-debug --enable-maintainer-zts' - - template: azure/macos/job.yml - parameters: - configurationName: MACOS_DEBUG_ZTS - configurationParameters: '--enable-debug --enable-maintainer-zts' - - template: azure/macos/job.yml - parameters: - configurationName: MACOS_RELEASE_NTS - configurationParameters: '--disable-debug --disable-maintainer-zts' - - template: azure/macos/job.yml - parameters: - configurationName: MACOS_RELEASE_ZTS - configurationParameters: '--disable-debug --enable-maintainer-zts' - - template: azure/job.yml - parameters: - configurationName: DEBUG_ZTS_ASAN_UBSAN - configurationParameters: >- - --enable-debug --enable-maintainer-zts - CFLAGS='-fsanitize=undefined,address -DZEND_TRACK_ARENA_ALLOC' - LDFLAGS='-fsanitize=undefined,address' - runTestsParameters: --asan - timeoutInMinutes: 120 - - template: azure/msan_job.yml - parameters: - configurationName: DEBUG_ZTS_MSAN - configurationParameters: '--enable-debug --enable-maintainer-zts' - runTestsParameters: --asan - - template: azure/community_job.yml - parameters: - configurationName: COMMUNITY - configurationParameters: >- - --enable-debug --enable-maintainer-zts - CFLAGS='-fsanitize=undefined,address -DZEND_TRACK_ARENA_ALLOC' - LDFLAGS='-fsanitize=undefined,address' + configurationName: COMMUNITY + configurationParameters: >- + --enable-debug --enable-maintainer-zts + CFLAGS='-fsanitize=undefined,address -DZEND_TRACK_ARENA_ALLOC' + LDFLAGS='-fsanitize=undefined,address' From c535c764919e0565c80b27424d99557fca3796b9 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 27 Aug 2019 22:29:48 +0200 Subject: [PATCH 03/22] Add Symfony --- azure/community_job.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/azure/community_job.yml b/azure/community_job.yml index bf0879aaad74a..8aa9c74f884ad 100644 --- a/azure/community_job.yml +++ b/azure/community_job.yml @@ -35,3 +35,14 @@ jobs: exit 1 fi displayName: 'Test Laravel' + - script: | + git clone https://github.com/symfony/symfony.git --branch=master --depth=1 + cd symfony + php7.3 /usr/bin/composer install + export USE_ZEND_ALLOC=0 + php ./phpunit + status=$? + if [ $status -gt 128 ]; then + exit 1 + fi + displayName: 'Test Symfony' From 77bc746971702aa18b2e75da3ea7971c09e29097 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 27 Aug 2019 23:18:03 +0200 Subject: [PATCH 04/22] Try to avoid exit in phpunit We both don't care about the test results and exit() results in memory leaks, so maybe we can just avoid it in the first place? --- azure/community_job.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/azure/community_job.yml b/azure/community_job.yml index 8aa9c74f884ad..accd3217e6d04 100644 --- a/azure/community_job.yml +++ b/azure/community_job.yml @@ -29,11 +29,8 @@ jobs: cd framework php7.3 /usr/bin/composer install export USE_ZEND_ALLOC=0 + sed -i 's/$exit = true/$exit = false/g' vendor/phpunit/phpunit/src/TextUI/Command.php php vendor/bin/phpunit - status=$? - if [ $status -gt 128 ]; then - exit 1 - fi displayName: 'Test Laravel' - script: | git clone https://github.com/symfony/symfony.git --branch=master --depth=1 From 560716f08a2a9ad863e8984029f7259deb33f085 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 27 Aug 2019 23:19:12 +0200 Subject: [PATCH 05/22] Remove symfony Symfony does some really crazy stuff with it's phpunit setup, not going to bother with that. --- azure/community_job.yml | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/azure/community_job.yml b/azure/community_job.yml index accd3217e6d04..0c714c2cd9aae 100644 --- a/azure/community_job.yml +++ b/azure/community_job.yml @@ -32,14 +32,3 @@ jobs: sed -i 's/$exit = true/$exit = false/g' vendor/phpunit/phpunit/src/TextUI/Command.php php vendor/bin/phpunit displayName: 'Test Laravel' - - script: | - git clone https://github.com/symfony/symfony.git --branch=master --depth=1 - cd symfony - php7.3 /usr/bin/composer install - export USE_ZEND_ALLOC=0 - php ./phpunit - status=$? - if [ $status -gt 128 ]; then - exit 1 - fi - displayName: 'Test Symfony' From d6c273153fc76db7f65d874c7f90938f8270de30 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 27 Aug 2019 23:21:28 +0200 Subject: [PATCH 06/22] Add --no-interaction to composer install --- azure/community_job.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure/community_job.yml b/azure/community_job.yml index 0c714c2cd9aae..365f051edf826 100644 --- a/azure/community_job.yml +++ b/azure/community_job.yml @@ -27,7 +27,7 @@ jobs: - script: | git clone https://github.com/laravel/framework.git --branch=master --depth=1 cd framework - php7.3 /usr/bin/composer install + php7.3 /usr/bin/composer install --no-interaction export USE_ZEND_ALLOC=0 sed -i 's/$exit = true/$exit = false/g' vendor/phpunit/phpunit/src/TextUI/Command.php php vendor/bin/phpunit From b02a19d5813c6a405f31e26e8c83e401d2744d59 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Wed, 28 Aug 2019 09:25:50 +0200 Subject: [PATCH 07/22] USE_TRACKED_ALLOC=1 --- azure/community_job.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/azure/community_job.yml b/azure/community_job.yml index 365f051edf826..dcaabeb326437 100644 --- a/azure/community_job.yml +++ b/azure/community_job.yml @@ -29,6 +29,7 @@ jobs: cd framework php7.3 /usr/bin/composer install --no-interaction export USE_ZEND_ALLOC=0 + export USE_TRACKED_ALLOC=1 sed -i 's/$exit = true/$exit = false/g' vendor/phpunit/phpunit/src/TextUI/Command.php php vendor/bin/phpunit displayName: 'Test Laravel' From a34060b4bb890aa63868f9c89733c8d2e70d452a Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Wed, 28 Aug 2019 09:40:43 +0200 Subject: [PATCH 08/22] Use --no-progress --- azure/community_job.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure/community_job.yml b/azure/community_job.yml index dcaabeb326437..09988a5bf32e8 100644 --- a/azure/community_job.yml +++ b/azure/community_job.yml @@ -27,7 +27,7 @@ jobs: - script: | git clone https://github.com/laravel/framework.git --branch=master --depth=1 cd framework - php7.3 /usr/bin/composer install --no-interaction + php7.3 /usr/bin/composer install --no-progress export USE_ZEND_ALLOC=0 export USE_TRACKED_ALLOC=1 sed -i 's/$exit = true/$exit = false/g' vendor/phpunit/phpunit/src/TextUI/Command.php From 0ad7e95f4f2109861ceda3e7cef1adadd7884b14 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Wed, 28 Aug 2019 18:15:16 +0200 Subject: [PATCH 09/22] Patch test instead of using tracked alloc --- azure/community_job.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/azure/community_job.yml b/azure/community_job.yml index 09988a5bf32e8..12e2c9994b16d 100644 --- a/azure/community_job.yml +++ b/azure/community_job.yml @@ -29,7 +29,9 @@ jobs: cd framework php7.3 /usr/bin/composer install --no-progress export USE_ZEND_ALLOC=0 - export USE_TRACKED_ALLOC=1 sed -i 's/$exit = true/$exit = false/g' vendor/phpunit/phpunit/src/TextUI/Command.php + # Avoid test using exit(), which thus leaks. + # We can use USE_TRACKED_ALLOC=1 if more of these show up. + sed -i "s/function_exists('pcntl_fork')/false/" tests/Filesystem/FilesystemTest.php php vendor/bin/phpunit displayName: 'Test Laravel' From 6fcbfef18479835bc0353db2ee447a27f1db2797 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Wed, 28 Aug 2019 18:21:16 +0200 Subject: [PATCH 10/22] Revert "Remove symfony" This reverts commit 1bcc7ede10736aa7aa4bf56c5e2eb1fa5bdeca72. --- azure/community_job.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/azure/community_job.yml b/azure/community_job.yml index 12e2c9994b16d..93d0f4e56ea26 100644 --- a/azure/community_job.yml +++ b/azure/community_job.yml @@ -35,3 +35,14 @@ jobs: sed -i "s/function_exists('pcntl_fork')/false/" tests/Filesystem/FilesystemTest.php php vendor/bin/phpunit displayName: 'Test Laravel' + - script: | + git clone https://github.com/symfony/symfony.git --branch=master --depth=1 + cd symfony + php7.3 /usr/bin/composer install + export USE_ZEND_ALLOC=0 + php ./phpunit + status=$? + if [ $status -gt 128 ]; then + exit 1 + fi + displayName: 'Test Symfony' From 13945741dfa83b6ee8284e709e28d833a18a4293 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Wed, 28 Aug 2019 18:27:15 +0200 Subject: [PATCH 11/22] Run symfony with USE_TRACKED_ALLOC=1 --- azure/community_job.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/azure/community_job.yml b/azure/community_job.yml index 93d0f4e56ea26..4bc54f44bacb4 100644 --- a/azure/community_job.yml +++ b/azure/community_job.yml @@ -40,6 +40,7 @@ jobs: cd symfony php7.3 /usr/bin/composer install export USE_ZEND_ALLOC=0 + export USE_TRACKED_ALLOC=1 php ./phpunit status=$? if [ $status -gt 128 ]; then From 4f619365760c4e586c151cd92221cf3d429b4478 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 29 Aug 2019 12:40:54 +0200 Subject: [PATCH 12/22] Try to remove stdin when running symfony tests --- azure/community_job.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure/community_job.yml b/azure/community_job.yml index 4bc54f44bacb4..835e679a7c7a4 100644 --- a/azure/community_job.yml +++ b/azure/community_job.yml @@ -41,7 +41,7 @@ jobs: php7.3 /usr/bin/composer install export USE_ZEND_ALLOC=0 export USE_TRACKED_ALLOC=1 - php ./phpunit + php ./phpunit 0<&- status=$? if [ $status -gt 128 ]; then exit 1 From 84990e76975fee24721d5ed9905fb44bd5e82102 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 29 Aug 2019 13:08:10 +0200 Subject: [PATCH 13/22] Change asan exit code --- azure/community_job.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/azure/community_job.yml b/azure/community_job.yml index 835e679a7c7a4..9f10010efa9a8 100644 --- a/azure/community_job.yml +++ b/azure/community_job.yml @@ -41,6 +41,7 @@ jobs: php7.3 /usr/bin/composer install export USE_ZEND_ALLOC=0 export USE_TRACKED_ALLOC=1 + export ASAN_OPTIONS=exitcode=139 php ./phpunit 0<&- status=$? if [ $status -gt 128 ]; then From 8c302cec35a235d92d6404988466e9267d3bde98 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 29 Aug 2019 14:51:20 +0200 Subject: [PATCH 14/22] Add asan suppression for libcurl --- azure/community_job.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/azure/community_job.yml b/azure/community_job.yml index 9f10010efa9a8..750c4de2834ba 100644 --- a/azure/community_job.yml +++ b/azure/community_job.yml @@ -39,9 +39,11 @@ jobs: git clone https://github.com/symfony/symfony.git --branch=master --depth=1 cd symfony php7.3 /usr/bin/composer install + # This might be a legit issue, but I can't reproduce + echo "interceptor_via_lib:libcurl.so" > asan.supp export USE_ZEND_ALLOC=0 export USE_TRACKED_ALLOC=1 - export ASAN_OPTIONS=exitcode=139 + export ASAN_OPTIONS=exitcode=139:suppressions=asan.supp php ./phpunit 0<&- status=$? if [ $status -gt 128 ]; then From fbffc46f467aa3daf64489d71c1928bf5771870c Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 29 Aug 2019 15:35:55 +0200 Subject: [PATCH 15/22] Add amphp --- azure/community_job.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/azure/community_job.yml b/azure/community_job.yml index 750c4de2834ba..61849ee9211bf 100644 --- a/azure/community_job.yml +++ b/azure/community_job.yml @@ -35,12 +35,20 @@ jobs: sed -i "s/function_exists('pcntl_fork')/false/" tests/Filesystem/FilesystemTest.php php vendor/bin/phpunit displayName: 'Test Laravel' + - script: | + git clone https://github.com/amphp/amp.git --branch=master --depth=1 + cd amp + php7.3 /usr/bin/composer install --no-progress + export USE_ZEND_ALLOC=0 + sed -i 's/$exit = true/$exit = false/g' vendor/phpunit/phpunit/src/TextUI/Command.php + php vendor/bin/phpunit + displayName: 'Test Amphp' - script: | git clone https://github.com/symfony/symfony.git --branch=master --depth=1 cd symfony - php7.3 /usr/bin/composer install + php7.3 /usr/bin/composer install --no-progress # This might be a legit issue, but I can't reproduce - echo "interceptor_via_lib:libcurl.so" > asan.supp + echo "interceptor_via_fun:curl_multi_perform" > asan.supp export USE_ZEND_ALLOC=0 export USE_TRACKED_ALLOC=1 export ASAN_OPTIONS=exitcode=139:suppressions=asan.supp From e5dad73af43cd104ac57da52d1cc40c7b7e0b95c Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 29 Aug 2019 16:10:24 +0200 Subject: [PATCH 16/22] wat --- azure/community_job.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/azure/community_job.yml b/azure/community_job.yml index 61849ee9211bf..cebced08860d7 100644 --- a/azure/community_job.yml +++ b/azure/community_job.yml @@ -35,14 +35,6 @@ jobs: sed -i "s/function_exists('pcntl_fork')/false/" tests/Filesystem/FilesystemTest.php php vendor/bin/phpunit displayName: 'Test Laravel' - - script: | - git clone https://github.com/amphp/amp.git --branch=master --depth=1 - cd amp - php7.3 /usr/bin/composer install --no-progress - export USE_ZEND_ALLOC=0 - sed -i 's/$exit = true/$exit = false/g' vendor/phpunit/phpunit/src/TextUI/Command.php - php vendor/bin/phpunit - displayName: 'Test Amphp' - script: | git clone https://github.com/symfony/symfony.git --branch=master --depth=1 cd symfony @@ -58,3 +50,11 @@ jobs: exit 1 fi displayName: 'Test Symfony' + - script: | + git clone https://github.com/amphp/amp.git --branch=master --depth=1 + cd amp + php7.3 /usr/bin/composer install --no-progress --ignore-platform-reqs + export USE_ZEND_ALLOC=0 + sed -i 's/$exit = true/$exit = false/g' vendor/phpunit/phpunit/src/TextUI/Command.php + php vendor/bin/phpunit + displayName: 'Test Amphp' From 23db4266e3f6785e504c1a3db38d1bd2c7a96910 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 29 Aug 2019 16:27:54 +0200 Subject: [PATCH 17/22] Try to use pwd --- azure/community_job.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure/community_job.yml b/azure/community_job.yml index cebced08860d7..f275190acdb1e 100644 --- a/azure/community_job.yml +++ b/azure/community_job.yml @@ -43,7 +43,7 @@ jobs: echo "interceptor_via_fun:curl_multi_perform" > asan.supp export USE_ZEND_ALLOC=0 export USE_TRACKED_ALLOC=1 - export ASAN_OPTIONS=exitcode=139:suppressions=asan.supp + export ASAN_OPTIONS=exitcode=139:suppressions=$PWD/asan.supp php ./phpunit 0<&- status=$? if [ $status -gt 128 ]; then From 33370e1f0b0eb27bb392202737ac14df5cdbd82d Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 29 Aug 2019 17:04:00 +0200 Subject: [PATCH 18/22] No idea how to make suppressions work -- possibly only for clang? --- azure/community_job.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/azure/community_job.yml b/azure/community_job.yml index f275190acdb1e..140f477e7b100 100644 --- a/azure/community_job.yml +++ b/azure/community_job.yml @@ -39,17 +39,15 @@ jobs: git clone https://github.com/symfony/symfony.git --branch=master --depth=1 cd symfony php7.3 /usr/bin/composer install --no-progress - # This might be a legit issue, but I can't reproduce - echo "interceptor_via_fun:curl_multi_perform" > asan.supp export USE_ZEND_ALLOC=0 export USE_TRACKED_ALLOC=1 - export ASAN_OPTIONS=exitcode=139:suppressions=$PWD/asan.supp php ./phpunit 0<&- status=$? if [ $status -gt 128 ]; then exit 1 fi displayName: 'Test Symfony' + condition: or(succeeded(), failed()) - script: | git clone https://github.com/amphp/amp.git --branch=master --depth=1 cd amp @@ -58,3 +56,4 @@ jobs: sed -i 's/$exit = true/$exit = false/g' vendor/phpunit/phpunit/src/TextUI/Command.php php vendor/bin/phpunit displayName: 'Test Amphp' + condition: or(succeeded(), failed()) From 5b4633f5a8b4811cd710011853529962eb1ba2e0 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 29 Aug 2019 17:24:55 +0200 Subject: [PATCH 19/22] Restore exitcode --- azure/community_job.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/azure/community_job.yml b/azure/community_job.yml index 140f477e7b100..89d2f4dd9662c 100644 --- a/azure/community_job.yml +++ b/azure/community_job.yml @@ -41,6 +41,7 @@ jobs: php7.3 /usr/bin/composer install --no-progress export USE_ZEND_ALLOC=0 export USE_TRACKED_ALLOC=1 + export ASAN_OPTIONS=exitcode=139 php ./phpunit 0<&- status=$? if [ $status -gt 128 ]; then From ffcb99c7840e104b0fae519dfc088821237d8309 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 29 Aug 2019 19:10:44 +0200 Subject: [PATCH 20/22] Add --debug flag --- azure/community_job.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure/community_job.yml b/azure/community_job.yml index 89d2f4dd9662c..6039b21310441 100644 --- a/azure/community_job.yml +++ b/azure/community_job.yml @@ -42,7 +42,7 @@ jobs: export USE_ZEND_ALLOC=0 export USE_TRACKED_ALLOC=1 export ASAN_OPTIONS=exitcode=139 - php ./phpunit 0<&- + php ./phpunit --debug 0<&- status=$? if [ $status -gt 128 ]; then exit 1 From 2cd390e4ab1da8d4acf8bb93c247fa543e9a2ddd Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 29 Aug 2019 20:34:49 +0200 Subject: [PATCH 21/22] Try to build curl --- azure/community_job.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/azure/community_job.yml b/azure/community_job.yml index 6039b21310441..b28770c8bba94 100644 --- a/azure/community_job.yml +++ b/azure/community_job.yml @@ -10,6 +10,14 @@ jobs: vmImage: 'ubuntu-latest' steps: - template: apt.yml + - script: | + wget https://curl.haxx.se/download/curl-7.65.3.tar.gz + tar xzf curl-7.65.3.tar.gz + cd curl-7.65.3/ + ./configure + make -j2 + sudo make install + displayName: 'Build Curl' - template: configure.yml parameters: configurationParameters: ${{ parameters.configurationParameters }} From fecb18101b254c962e0010f5f55d3d2d821d20d2 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 29 Aug 2019 21:14:04 +0200 Subject: [PATCH 22/22] Finalize --- azure/community_job.yml | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/azure/community_job.yml b/azure/community_job.yml index b28770c8bba94..16efaed7fdf98 100644 --- a/azure/community_job.yml +++ b/azure/community_job.yml @@ -3,6 +3,15 @@ parameters: configurationParameters: '' timeoutInMinutes: 60 +# The purpose of the job is to test open-source community projects against an aggressive +# debug build, that enables assertions, as well as the address and UB sanitizers. However, +# we are only interested in finding assertion failures, segfaults and sanitizer violations, +# and don't care about the actual test results, as there will commonly be failures for +# pre-release versions of PHP. +# +# Because exit() in PHP results in an unclean shutdown, test runs are patching phpunit to +# avoid the exit, which allows us to also check for memory leaks. Otherwise we use +# USE_TRACKED_ALLOC=1 to avoid reporting of leaks that will be handled by ZMM. jobs: - job: ${{ parameters.configurationName }} timeoutInMinutes: ${{ parameters.timeoutInMinutes }} @@ -11,6 +20,8 @@ jobs: steps: - template: apt.yml - script: | + # Compile a newer version of curl, otherwise there will be an asan warning + # when running symfony tests. wget https://curl.haxx.se/download/curl-7.65.3.tar.gz tar xzf curl-7.65.3.tar.gz cd curl-7.65.3/ @@ -29,8 +40,10 @@ jobs: sudo chmod 777 /etc/php.d echo mysqli.default_socket=/var/run/mysqld/mysqld.sock > /etc/php.d/mysqli.ini echo pdo_mysql.default_socket=/var/run/mysqld/mysqld.sock > /etc/php.d/pdo_mysql.ini + # Run with opcache to also catch optimizer bugs. echo zend_extension=opcache.so > /etc/php.d/opcache.ini echo opcache.enable_cli=1 >> /etc/php.d/opcache.ini + echo opcache.protect_memory=1 >> /etc/php.d/opcache.ini displayName: 'Install Build' - script: | git clone https://github.com/laravel/framework.git --branch=master --depth=1 @@ -50,9 +63,9 @@ jobs: export USE_ZEND_ALLOC=0 export USE_TRACKED_ALLOC=1 export ASAN_OPTIONS=exitcode=139 - php ./phpunit --debug 0<&- - status=$? - if [ $status -gt 128 ]; then + # Close stdin because we hang on some kind of tty test otherwise. + php ./phpunit 0<&- + if [ $? -gt 128 ]; then exit 1 fi displayName: 'Test Symfony'