summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2019-06-20 16:51:14 +0200
committerNikita Popov <nikita.ppv@gmail.com>2019-06-28 15:00:54 +0200
commit54dd762f596d4b0ea97d6d10e9d0c96e0f33e76e (patch)
tree4c8837cfc655c3215ee44b6002d9f6b3a60855ba
parentca6f41aa5a15a44f841e42c7255294d521c95d5d (diff)
downloadphp-git-54dd762f596d4b0ea97d6d10e9d0c96e0f33e76e.tar.gz
Set up asan+ubsan scheduled build on azure
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.
-rw-r--r--Zend/tests/concat_003.phpt5
-rw-r--r--azure-pipelines.yml9
-rw-r--r--azure/job.yml8
-rw-r--r--azure/lsan-suppressions.txt1
-rw-r--r--ext/fileinfo/tests/cve-2014-3538-nojit.phpt2
-rw-r--r--ext/opcache/tests/log_verbosity_bug.phpt5
-rw-r--r--ext/opcache/tests/preload_006.phpt5
-rw-r--r--ext/pcntl/tests/pcntl_unshare_02.phpt1
-rw-r--r--ext/pcre/tests/bug72685.phpt4
-rw-r--r--ext/pspell/tests/005.phpt1
-rw-r--r--ext/standard/tests/general_functions/get_cfg_var_variation8.phpt2
-rw-r--r--ext/xsl/tests/bug33853.phpt5
-rwxr-xr-xrun-tests.php12
-rw-r--r--sapi/cli/tests/upload_2G.phpt4
-rw-r--r--sapi/fpm/tests/bug68381-log-level-warning.phpt1
-rw-r--r--sapi/phpdbg/tests/watch_001.phpt3
-rw-r--r--sapi/phpdbg/tests/watch_002.phpt3
-rw-r--r--sapi/phpdbg/tests/watch_003.phpt3
-rw-r--r--sapi/phpdbg/tests/watch_004.phpt3
-rw-r--r--sapi/phpdbg/tests/watch_005.phpt3
-rw-r--r--sapi/phpdbg/tests/watch_006.phpt3
21 files changed, 78 insertions, 5 deletions
diff --git a/Zend/tests/concat_003.phpt b/Zend/tests/concat_003.phpt
index 13c6fdc087..dc22bae1a7 100644
--- a/Zend/tests/concat_003.phpt
+++ b/Zend/tests/concat_003.phpt
@@ -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
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
index 7653b3e7af..c0be304b5e 100644
--- a/azure-pipelines.yml
+++ b/azure-pipelines.yml
@@ -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
diff --git a/azure/job.yml b/azure/job.yml
index a7267f11c3..646faed755 100644
--- a/azure/job.yml
+++ b/azure/job.yml
@@ -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
index 0000000000..5c2ee76e46
--- /dev/null
+++ b/azure/lsan-suppressions.txt
@@ -0,0 +1 @@
+leak:acommon::DictInfoList::elements
diff --git a/ext/fileinfo/tests/cve-2014-3538-nojit.phpt b/ext/fileinfo/tests/cve-2014-3538-nojit.phpt
index 2dc5ddbc5e..0072ab2047 100644
--- a/ext/fileinfo/tests/cve-2014-3538-nojit.phpt
+++ b/ext/fileinfo/tests/cve-2014-3538-nojit.phpt
@@ -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');
?>
diff --git a/ext/opcache/tests/log_verbosity_bug.phpt b/ext/opcache/tests/log_verbosity_bug.phpt
index e23bb8758f..a2c2f4f30a 100644
--- a/ext/opcache/tests/log_verbosity_bug.phpt
+++ b/ext/opcache/tests/log_verbosity_bug.phpt
@@ -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");
diff --git a/ext/opcache/tests/preload_006.phpt b/ext/opcache/tests/preload_006.phpt
index 17d792ecd1..b597d8eff8 100644
--- a/ext/opcache/tests/preload_006.phpt
+++ b/ext/opcache/tests/preload_006.phpt
@@ -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";
diff --git a/ext/pcntl/tests/pcntl_unshare_02.phpt b/ext/pcntl/tests/pcntl_unshare_02.phpt
index a046759730..bdcb6120ef 100644
--- a/ext/pcntl/tests/pcntl_unshare_02.phpt
+++ b/ext/pcntl/tests/pcntl_unshare_02.phpt
@@ -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))) {
diff --git a/ext/pcre/tests/bug72685.phpt b/ext/pcre/tests/bug72685.phpt
index 7f6eabc182..31b2f9b0c7 100644
--- a/ext/pcre/tests/bug72685.phpt
+++ b/ext/pcre/tests/bug72685.phpt
@@ -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
diff --git a/ext/pspell/tests/005.phpt b/ext/pspell/tests/005.phpt
index 083b4c1871..3081227a31 100644
--- a/ext/pspell/tests/005.phpt
+++ b/ext/pspell/tests/005.phpt
@@ -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
diff --git a/ext/standard/tests/general_functions/get_cfg_var_variation8.phpt b/ext/standard/tests/general_functions/get_cfg_var_variation8.phpt
index b273e512d0..6b975cd496 100644
--- a/ext/standard/tests/general_functions/get_cfg_var_variation8.phpt
+++ b/ext/standard/tests/general_functions/get_cfg_var_variation8.phpt
@@ -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";
diff --git a/ext/xsl/tests/bug33853.phpt b/ext/xsl/tests/bug33853.phpt
index 16d7f73ced..a2e835ff6d 100644
--- a/ext/xsl/tests/bug33853.phpt
+++ b/ext/xsl/tests/bug33853.phpt
@@ -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
diff --git a/run-tests.php b/run-tests.php
index 60a1bed2b6..96df073a84 100755
--- a/run-tests.php
+++ b/run-tests.php
@@ -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
diff --git a/sapi/cli/tests/upload_2G.phpt b/sapi/cli/tests/upload_2G.phpt
index 34e3a7c288..a4bcc6860f 100644
--- a/sapi/cli/tests/upload_2G.phpt
+++ b/sapi/cli/tests/upload_2G.phpt
@@ -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
diff --git a/sapi/fpm/tests/bug68381-log-level-warning.phpt b/sapi/fpm/tests/bug68381-log-level-warning.phpt
index 8d4a9af4cc..b9066cd051 100644
--- a/sapi/fpm/tests/bug68381-log-level-warning.phpt
+++ b/sapi/fpm/tests/bug68381-log-level-warning.phpt
@@ -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
diff --git a/sapi/phpdbg/tests/watch_001.phpt b/sapi/phpdbg/tests/watch_001.phpt
index 86e5786e97..90ede3f952 100644
--- a/sapi/phpdbg/tests/watch_001.phpt
+++ b/sapi/phpdbg/tests/watch_001.phpt
@@ -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
diff --git a/sapi/phpdbg/tests/watch_002.phpt b/sapi/phpdbg/tests/watch_002.phpt
index 52336c08d0..ba2cad1abe 100644
--- a/sapi/phpdbg/tests/watch_002.phpt
+++ b/sapi/phpdbg/tests/watch_002.phpt
@@ -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
diff --git a/sapi/phpdbg/tests/watch_003.phpt b/sapi/phpdbg/tests/watch_003.phpt
index e054b6f324..ab6dc317a8 100644
--- a/sapi/phpdbg/tests/watch_003.phpt
+++ b/sapi/phpdbg/tests/watch_003.phpt
@@ -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
diff --git a/sapi/phpdbg/tests/watch_004.phpt b/sapi/phpdbg/tests/watch_004.phpt
index dcb37a4959..42e3fd3b26 100644
--- a/sapi/phpdbg/tests/watch_004.phpt
+++ b/sapi/phpdbg/tests/watch_004.phpt
@@ -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
diff --git a/sapi/phpdbg/tests/watch_005.phpt b/sapi/phpdbg/tests/watch_005.phpt
index 0bd44c9a01..aacc158f61 100644
--- a/sapi/phpdbg/tests/watch_005.phpt
+++ b/sapi/phpdbg/tests/watch_005.phpt
@@ -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
diff --git a/sapi/phpdbg/tests/watch_006.phpt b/sapi/phpdbg/tests/watch_006.phpt
index fa292005a4..5b5ca9ee57 100644
--- a/sapi/phpdbg/tests/watch_006.phpt
+++ b/sapi/phpdbg/tests/watch_006.phpt
@@ -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