]> granicus.if.org Git - php/commitdiff
Setup msan on azure
authorNikita Popov <nikita.ppv@gmail.com>
Mon, 1 Jul 2019 08:26:29 +0000 (10:26 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Mon, 1 Jul 2019 15:27:42 +0000 (17:27 +0200)
This uses a separate job template, because msan requires all used
libraries (apart from glibc) to be instrumented, so we can't link
any external libraries unless we recompile them. As such, we need
a much more minimal configure.

azure-pipelines.yml
azure/apt.yml
azure/msan_job.yml [new file with mode: 0644]
azure/test.yml

index c0be304b5e37c31bd7464051ff9bb416ab1e73a9..c6f047145ba8a72f7159a271b758ee45babe66cf 100644 (file)
@@ -64,3 +64,8 @@ jobs:
             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
index 843ae1daf197d3d1e40ec99d42f021e8c6f30114..5c0a9a0c55fab5c7b960bc969ef337e45b774f2d 100644 (file)
@@ -34,5 +34,6 @@ steps:
                        libargon2-0-dev \
                        postgresql \
                        postgresql-contrib \
+                       llvm \
                        ${{ parameters.packages }}
     displayName: 'APT'
diff --git a/azure/msan_job.yml b/azure/msan_job.yml
new file mode 100644 (file)
index 0000000..bae65e0
--- /dev/null
@@ -0,0 +1,76 @@
+parameters:
+  configurationName: ''
+  configurationParameters: ''
+  runTestsParameters: ''
+  timeoutInMinutes: 60
+
+jobs:
+  - job: ${{ parameters.configurationName }}
+    timeoutInMinutes: ${{ parameters.timeoutInMinutes }}
+    pool:
+      vmImage: 'ubuntu-latest'
+    steps:
+    - template: apt.yml
+    - script: |
+        export CC=clang
+        export CXX=clang++
+        export CFLAGS="-fsanitize=memory -DZEND_TRACK_ARENA_ALLOC"
+        export LDFLAGS="-fsanitize=memory"
+        ./buildconf --force
+        # msan requires all used libraries to be instrumented,
+        # so we should avoiding linking against anything but libc here
+        ./configure ${{ parameters.configurationParameters }} \
+            --prefix=/usr \
+            --without-sqlite3 \
+            --without-pdo-sqlite \
+            --without-libxml \
+            --disable-dom \
+            --disable-simplexml \
+            --disable-xml \
+            --disable-xmlreader \
+            --disable-xmlwriter \
+            --without-pcre-jit \
+            --enable-phpdbg \
+            --enable-fpm \
+            --with-pdo-mysql=mysqlnd \
+            --with-mysqli=mysqlnd \
+            --without-pear \
+            --enable-exif \
+            --enable-sysvsem \
+            --enable-sysvshm \
+            --enable-shmop \
+            --enable-pcntl \
+            --enable-mbstring \
+            --disable-mbregex \
+            --enable-sockets \
+            --enable-bcmath \
+            --enable-calendar \
+            --enable-ftp \
+            --enable-zend-test \
+            --enable-werror \
+            --with-config-file-path=/etc \
+            --with-config-file-scan-dir=/etc/php.d
+      displayName: 'Configure Build'
+    - 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
+      displayName: 'Install Build'
+    - script: |
+        mysql -uroot -proot -e "CREATE DATABASE IF NOT EXISTS test"
+      displayName: 'Setup'
+    - template: test.yml
+      parameters:
+        configurationName: ${{ parameters.configurationName }}
+        runTestsParameters: ${{ parameters.runTestsParameters }}
+    - template: test.yml
+      parameters:
+        configurationName: ${{ parameters.configurationName }}
+        runTestsName: 'OpCache'
+        runTestsParameters: >-
+          ${{ parameters.runTestsParameters }}
+          -d zend_extension=opcache.so -d opcache.enable_cli=1
index 9821010f11ce36219eca8563a45da4c722aa363b..3f6963c7067489b014888f3a9c5a29b302492066 100644 (file)
@@ -12,6 +12,7 @@ steps:
       export TEST_PHP_JUNIT=junit.xml
       export REPORT_EXIT_STATUS=no
       export SKIP_IO_CAPTURE_TESTS=1
+      export MSAN_SYMBOLIZER_PATH=/usr/lib/llvm-3.8/bin/llvm-symbolizer
       rm -rf junit.xml | true
       php run-tests.php -P -q \
           -j$(/usr/bin/nproc) \