]> granicus.if.org Git - php/commitdiff
Set up asan+ubsan scheduled build on azure
authorNikita Popov <nikita.ppv@gmail.com>
Thu, 20 Jun 2019 14:51:14 +0000 (16:51 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Fri, 28 Jun 2019 13:00:54 +0000 (15:00 +0200)
Also adds an --asan flag to run-tests.php to setup all the necessary
environment variables. Some tests are marked as skipped because they
are incompatible with asan or too slow.

I'm basing this on the DEBUG_ZTS build, which seems to give us the
most mileage.

21 files changed:
Zend/tests/concat_003.phpt
azure-pipelines.yml
azure/job.yml
azure/lsan-suppressions.txt [new file with mode: 0644]
ext/fileinfo/tests/cve-2014-3538-nojit.phpt
ext/opcache/tests/log_verbosity_bug.phpt
ext/opcache/tests/preload_006.phpt
ext/pcntl/tests/pcntl_unshare_02.phpt
ext/pcre/tests/bug72685.phpt
ext/pspell/tests/005.phpt
ext/standard/tests/general_functions/get_cfg_var_variation8.phpt
ext/xsl/tests/bug33853.phpt
run-tests.php
sapi/cli/tests/upload_2G.phpt
sapi/fpm/tests/bug68381-log-level-warning.phpt
sapi/phpdbg/tests/watch_001.phpt
sapi/phpdbg/tests/watch_002.phpt
sapi/phpdbg/tests/watch_003.phpt
sapi/phpdbg/tests/watch_004.phpt
sapi/phpdbg/tests/watch_005.phpt
sapi/phpdbg/tests/watch_006.phpt

index 13c6fdc087b137043442a60280197374b9890e70..dc22bae1a720665a1db2d62d1694e9f5e6239ac3 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 Concatenating many small strings should not slowdown allocations
 --SKIPIF--
-<?php if (PHP_DEBUG) { die ("skip debug version is slow"); } ?>
+<?php
+if (PHP_DEBUG) { die ("skip debug version is slow"); }
+if (getenv('SKIP_PERF_SENSITIVE')) die("skip performance sensitive test");
+?>
 --FILE--
 <?php
 
index 7653b3e7afcb0bedde49843b9fed4a26e409de7b..c0be304b5e37c31bd7464051ff9bb416ab1e73a9 100644 (file)
@@ -55,3 +55,12 @@ jobs:
       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
index a7267f11c3ac67cf2e07a5828ee709f3f4870993..646faed75597558b745bc32fe6317fad82bd4fc0 100644 (file)
@@ -1,9 +1,12 @@
 parameters:
   configurationName: ''
   configurationParameters: ''
+  runTestsParameters: ''
+  timeoutInMinutes: 60
 
 jobs:
   - job: ${{ parameters.configurationName }}
+    timeoutInMinutes: ${{ parameters.timeoutInMinutes }}
     pool:
       vmImage: 'ubuntu-latest'
     steps:
@@ -80,8 +83,11 @@ jobs:
     - template: test.yml
       parameters:
         configurationName: ${{ parameters.configurationName }}
+        runTestsParameters: ${{ parameters.runTestsParameters }}
     - template: test.yml
       parameters:
         configurationName: ${{ parameters.configurationName }}
         runTestsName: 'OpCache'
-        runTestsParameters: -d zend_extension=opcache.so -d opcache.enable_cli=1
+        runTestsParameters: >-
+          ${{ parameters.runTestsParameters }}
+          -d zend_extension=opcache.so -d opcache.enable_cli=1
diff --git a/azure/lsan-suppressions.txt b/azure/lsan-suppressions.txt
new file mode 100644 (file)
index 0000000..5c2ee76
--- /dev/null
@@ -0,0 +1 @@
+leak:acommon::DictInfoList::elements
index 2dc5ddbc5eefa652ef3b4f9ae78113846d1d9102..0072ab20470947a4e0f994f598bc8d23d5e4def9 100644 (file)
@@ -4,6 +4,8 @@ Bug #66731: file: extensive backtraking, with pcre.jit=0
 <?php
 if (defined("PHP_DEBUG") && PHP_DEBUG)
        die("skip not suitable for debug build");
+if (getenv('SKIP_PERF_SENSITIVE'))
+    die("skip performance sensitive test");
 if (!class_exists('finfo'))
        die('skip no fileinfo extension');
 ?>
index e23bb8758f58d19b4a3e55326623606ccdcd4250..a2c2f4f30af4c46585565b7fa55652821e89afce 100644 (file)
@@ -12,7 +12,10 @@ opcache.file_cache_fallback=0
 opcache.memory_consumption=999999999
 opcache.log_verbosity_level=-1
 --SKIPIF--
-<?php require_once('skipif.inc'); ?>
+<?php
+require_once('skipif.inc');
+if (getenv('SKIP_ASAN')) die('xfail Startup failure leak');
+?>
 --FILE--
 <?php
 var_dump("Script should fail");
index 17d792ecd12742e5d61c520102f143ae0eac9638..b597d8eff8afca7da03e940646a2ecc0a44a6b11 100644 (file)
@@ -6,7 +6,10 @@ opcache.enable_cli=1
 opcache.optimization_level=-1
 opcache.preload={PWD}/preload_inheritance_error_ind.inc
 --SKIPIF--
-<?php require_once('skipif.inc'); ?>
+<?php
+require_once('skipif.inc');
+if (getenv('SKIP_ASAN')) die('xfail Startup failure leak');
+?>
 --FILE--
 <?php
 echo "Foobar\n";
index a0467597305739d0556b0abe84844719995b9785..bdcb6120efdbc347d198e3e27d0af9c49ca3b3cd 100644 (file)
@@ -6,6 +6,7 @@ if (!extension_loaded("pcntl")) die("skip");
 if (!extension_loaded("posix")) die("skip posix extension not available");
 if (!function_exists("pcntl_unshare")) die("skip pcntl_unshare is not available");
 if (!defined("CLONE_NEWPID")) die("skip flag unavailable");
+if (getenv("SKIP_ASAN")) die("skip asan chokes on this");
 if (posix_getuid() !== 0 &&
     (!defined("CLONE_NEWUSER") ||
     (pcntl_unshare(CLONE_NEWUSER) == false && pcntl_get_last_error() == PCNTL_EPERM))) {
index 7f6eabc182bcd1f6b50d781bc59a79bfd52d0b8b..31b2f9b0c77c9e65f8d33655363b25390b30071d 100644 (file)
@@ -1,5 +1,9 @@
 --TEST--
 Bug #72685: Same string is UTF-8 validated repeatedly
+--SKIPIF--
+<?php
+if (getenv('SKIP_PERF_SENSITIVE')) die("skip performance sensitive test");
+?>
 --FILE--
 <?php
 
index 083b4c1871d81acb564e608a06842a92313806b2..3081227a3126ddfb1520d9442e2cf749ee6d4608 100644 (file)
@@ -4,6 +4,7 @@ pspell configs
 <?php
 if (!extension_loaded('pspell')) die('skip');
 if (!@pspell_new('en')) die('skip English dictionary is not available');
+if (getenv('SKIP_ASAN')) die('skip pspell leaks memory for invalid dicationaries');
 ?>
 --FILE--
 <?php
index b273e512d09b38f8d6fc43065ef283c9c55dd6e2..6b975cd4963f80fd81ef975c97f95de3f5f25b1e 100644 (file)
@@ -5,6 +5,8 @@ Francesco Fullone ff@ideato.it
 #PHPTestFest Cesena Italia on 2009-06-20
 --INI--
 magic_quotes_gpc=1
+--SKIPIF--
+<?php if (getenv('SKIP_ASAN')) die('xfail Startup failure leak'); ?>
 --FILE--
 <?php
 echo "*** Test by calling method or function with deprecated option ***\n";
index 16d7f73ced31116e8e5a7eaaf6a035e666007d10..a2e835ff6d484ef60dd3da80f14351e4f98ee1d1 100644 (file)
@@ -1,7 +1,10 @@
 --TEST--
 Bug #33853 (php:function call __autoload with lowercase param)
 --SKIPIF--
-<?php if (!extension_loaded('xsl')) die('skip xsl not loaded'); ?>
+<?php
+if (!extension_loaded('xsl')) die('skip xsl not loaded');
+if (getenv('SKIP_ASAN')) die('xfail bailing out across foreign C code');
+?>
 --FILE--
 <?php
 
index 60a1bed2b6e1a79cc5db3d56a6e29adfe218ce8a..96df073a84e258f51ae5d430aba0613f26fc02cc 100755 (executable)
@@ -517,6 +517,18 @@ NO_PROC_OPEN_ERROR;
                                        case '--shuffle':
                                                $shuffle = true;
                                                break;
+                                       case '--asan':
+                                               $environment['USE_ZEND_ALLOC'] = 0;
+                                               $environment['USE_TRACKED_ALLOC'] = 1;
+                                               $environment['SKIP_ASAN'] = 1;
+                                               $environment['SKIP_PERF_SENSITIVE'] = 1;
+
+                                               $lsanSuppressions = __DIR__ . '/azure/lsan-suppressions.txt';
+                                               if (file_exists($lsanSuppressions)) {
+                                                       $environment['LSAN_OPTIONS'] = 'suppressions=' . $lsanSuppressions
+                                                               . ':print_suppressions=0';
+                                               }
+                                               break;
                                        //case 'w'
                                        case '-':
                                                // repeat check with full switch
index 34e3a7c28898b7c79d93830f23e135dd6fc26d11..a4bcc6860f716ed29ab4cf6fa5536299fe527c1d 100644 (file)
@@ -25,6 +25,10 @@ if (empty($enough_free_ram)) {
 if (getenv('TRAVIS')) {
     die("skip Fails intermittently on travis");
 }
+
+if (getenv('SKIP_PERF_SENSITIVE')) {
+    die("skip Test may be very slow if PHP is instrumented");
+}
 ?>
 --FILE--
 <?php
index 8d4a9af4cc543123fe343495ee8e3c3875c72c06..b9066cd05164f66cdd5b30b8aa242f0b7070aea9 100644 (file)
@@ -3,6 +3,7 @@ FPM: bug68381 - Log messages with warning level only
 --SKIPIF--
 <?php
 include "skipif.inc";
+if (getenv("SKIP_ASAN")) die("skip Often fails on azure with asan for unknown reason");
 ?>
 --FILE--
 <?php
index 86e5786e97cc94b332460976469a0e92e3b43de2..90ede3f9524ff52ea811b22a9a47c32f12e83c8a 100644 (file)
@@ -5,6 +5,9 @@ Test simple recursive watchpoint
 if (PHP_INT_SIZE == 4) {
     die("xfail There may be flaws in the implementation of watchpoints that cause failures");
 }
+if (getenv('SKIP_ASAN')) {
+    die("skip intentionally causes segfaults");
+}
 ?>
 --INI--
 opcache.optimization_level=0
index 52336c08d0b0248e51744908a0d73d02b4539d21..ba2cad1abee60cd9cde3a3a2fb86d48b6e35a1ca 100644 (file)
@@ -5,6 +5,9 @@ Test simple array watchpoint with replace
 if (PHP_INT_SIZE == 4) {
     die("xfail There may be flaws in the implementation of watchpoints that cause failures");
 }
+if (getenv('SKIP_ASAN')) {
+    die("skip intentionally causes segfaults");
+}
 ?>
 --PHPDBG--
 b 6
index e054b6f324fa7a6b0f71bf7583e8c8aa1a7a9d56..ab6dc317a87b458d7e00866a35b23218e40b640e 100644 (file)
@@ -5,6 +5,9 @@ Test simple watchpoint with replace
 if (PHP_INT_SIZE == 4) {
     die("xfail There may be flaws in the implementation of watchpoints that cause failures");
 }
+if (getenv('SKIP_ASAN')) {
+    die("skip intentionally causes segfaults");
+}
 ?>
 --PHPDBG--
 b 6
index dcb37a49595dd701fd6ed5470213ffc601922ec6..42e3fd3b2686cd3e5b30e3bfcae9ee36b16f49bb 100644 (file)
@@ -5,6 +5,9 @@ Test detection of inline string manipulations on zval watch
 if (PHP_INT_SIZE == 4) {
     die("xfail There may be flaws in the implementation of watchpoints that cause failures");
 }
+if (getenv('SKIP_ASAN')) {
+    die("skip intentionally causes segfaults");
+}
 ?>
 --INI--
 opcache.optimization_level=0
index 0bd44c9a012670383a074c2a1795575b30e3db0a..aacc158f61740a501164a21bee3e9b78c70096ba 100644 (file)
@@ -5,6 +5,9 @@ Test proper watch comparisons when having multiple levels of indirection from a
 if (PHP_INT_SIZE == 4) {
     die("xfail There may be flaws in the implementation of watchpoints that cause failures");
 }
+if (getenv('SKIP_ASAN')) {
+    die("skip intentionally causes segfaults");
+}
 ?>
 --PHPDBG--
 b 3
index fa292005a499aba2d2ad643a70021f42b31756aa..5b5ca9ee57c0e6e249e64c9e45b188813a340429 100644 (file)
@@ -5,6 +5,9 @@ Test multiple watch elements pointing to the same watchpoint
 if (PHP_INT_SIZE == 4) {
     die("xfail There may be flaws in the implementation of watchpoints that cause failures");
 }
+if (getenv('SKIP_ASAN')) {
+    die("skip intentionally causes segfaults");
+}
 ?>
 --PHPDBG--
 b 4