Skip to content

Commit a12ebc2

Browse files
committed
Add job for community projects
Run some open-source projects through an aggressive debug configuration with asan and ubsan. We don't care about test results, only check that we don't assert or crash. Currently testing laravel, symfony and amp.
1 parent ae59a6d commit a12ebc2

File tree

4 files changed

+151
-56
lines changed

4 files changed

+151
-56
lines changed

azure-pipelines.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,10 @@ jobs:
7575
configurationName: DEBUG_ZTS_MSAN
7676
configurationParameters: '--enable-debug --enable-maintainer-zts'
7777
runTestsParameters: --asan
78+
- template: azure/community_job.yml
79+
parameters:
80+
configurationName: COMMUNITY
81+
configurationParameters: >-
82+
--enable-debug --enable-maintainer-zts
83+
CFLAGS='-fsanitize=undefined,address -DZEND_TRACK_ARENA_ALLOC'
84+
LDFLAGS='-fsanitize=undefined,address'

azure/community_job.yml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
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())

azure/configure.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
parameters:
2+
configurationParameters: ''
3+
4+
steps:
5+
- script: |
6+
./buildconf --force
7+
./configure ${{ parameters.configurationParameters }} \
8+
--enable-option-checking=fatal \
9+
--prefix=/usr \
10+
--enable-phpdbg \
11+
--enable-fpm \
12+
--with-pdo-mysql=mysqlnd \
13+
--with-mysqli=mysqlnd \
14+
--with-pgsql \
15+
--with-pdo-pgsql \
16+
--with-pdo-sqlite \
17+
--enable-intl \
18+
--without-pear \
19+
--enable-gd \
20+
--with-jpeg \
21+
--with-webp \
22+
--with-freetype \
23+
--with-xpm \
24+
--enable-exif \
25+
--with-zip \
26+
--with-zlib \
27+
--with-zlib-dir=/usr \
28+
--enable-soap \
29+
--enable-xmlreader \
30+
--with-xsl \
31+
--with-tidy \
32+
--with-xmlrpc \
33+
--enable-sysvsem \
34+
--enable-sysvshm \
35+
--enable-shmop \
36+
--enable-pcntl \
37+
--with-readline \
38+
--enable-mbstring \
39+
--with-curl \
40+
--with-gettext \
41+
--enable-sockets \
42+
--with-bz2 \
43+
--with-openssl \
44+
--with-gmp \
45+
--enable-bcmath \
46+
--enable-calendar \
47+
--enable-ftp \
48+
--with-pspell=/usr \
49+
--with-enchant=/usr \
50+
--with-kerberos \
51+
--enable-sysvmsg \
52+
--with-ffi \
53+
--enable-zend-test \
54+
--with-ldap \
55+
--with-ldap-sasl \
56+
--with-password-argon2 \
57+
--enable-werror \
58+
--with-config-file-path=/etc \
59+
--with-config-file-scan-dir=/etc/php.d
60+
displayName: 'Configure Build'

azure/job.yml

Lines changed: 3 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -11,62 +11,9 @@ jobs:
1111
vmImage: 'ubuntu-latest'
1212
steps:
1313
- template: apt.yml
14-
- script: |
15-
./buildconf --force
16-
./configure ${{ parameters.configurationParameters }} \
17-
--enable-option-checking=fatal \
18-
--prefix=/usr \
19-
--enable-phpdbg \
20-
--enable-fpm \
21-
--with-pdo-mysql=mysqlnd \
22-
--with-mysqli=mysqlnd \
23-
--with-pgsql \
24-
--with-pdo-pgsql \
25-
--with-pdo-sqlite \
26-
--enable-intl \
27-
--without-pear \
28-
--enable-gd \
29-
--with-jpeg \
30-
--with-webp \
31-
--with-freetype \
32-
--with-xpm \
33-
--enable-exif \
34-
--with-zip \
35-
--with-zlib \
36-
--with-zlib-dir=/usr \
37-
--enable-soap \
38-
--enable-xmlreader \
39-
--with-xsl \
40-
--with-tidy \
41-
--with-xmlrpc \
42-
--enable-sysvsem \
43-
--enable-sysvshm \
44-
--enable-shmop \
45-
--enable-pcntl \
46-
--with-readline \
47-
--enable-mbstring \
48-
--with-curl \
49-
--with-gettext \
50-
--enable-sockets \
51-
--with-bz2 \
52-
--with-openssl \
53-
--with-gmp \
54-
--enable-bcmath \
55-
--enable-calendar \
56-
--enable-ftp \
57-
--with-pspell=/usr \
58-
--with-enchant=/usr \
59-
--with-kerberos \
60-
--enable-sysvmsg \
61-
--with-ffi \
62-
--enable-zend-test \
63-
--with-ldap \
64-
--with-ldap-sasl \
65-
--with-password-argon2 \
66-
--enable-werror \
67-
--with-config-file-path=/etc \
68-
--with-config-file-scan-dir=/etc/php.d
69-
displayName: 'Configure Build'
14+
- template: configure.yml
15+
parameters:
16+
configurationParameters: ${{ parameters.configurationParameters }}
7017
- script: make -j$(/usr/bin/nproc) >/dev/null
7118
displayName: 'Make Build'
7219
- script: |

0 commit comments

Comments
 (0)