Skip to content

Commit 54dd762

Browse files
committed
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.
1 parent ca6f41a commit 54dd762

File tree

21 files changed

+78
-5
lines changed

21 files changed

+78
-5
lines changed

Zend/tests/concat_003.phpt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
--TEST--
22
Concatenating many small strings should not slowdown allocations
33
--SKIPIF--
4-
<?php if (PHP_DEBUG) { die ("skip debug version is slow"); } ?>
4+
<?php
5+
if (PHP_DEBUG) { die ("skip debug version is slow"); }
6+
if (getenv('SKIP_PERF_SENSITIVE')) die("skip performance sensitive test");
7+
?>
58
--FILE--
69
<?php
710

azure-pipelines.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,12 @@ jobs:
5555
parameters:
5656
configurationName: MACOS_RELEASE_ZTS
5757
configurationParameters: '--disable-debug --enable-maintainer-zts'
58+
- template: azure/job.yml
59+
parameters:
60+
configurationName: DEBUG_ZTS_ASAN_UBSAN
61+
configurationParameters: >-
62+
--enable-debug --enable-maintainer-zts
63+
CFLAGS='-fsanitize=undefined,address -DZEND_TRACK_ARENA_ALLOC'
64+
LDFLAGS='-fsanitize=undefined,address'
65+
runTestsParameters: --asan
66+
timeoutInMinutes: 120

azure/job.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
parameters:
22
configurationName: ''
33
configurationParameters: ''
4+
runTestsParameters: ''
5+
timeoutInMinutes: 60
46

57
jobs:
68
- job: ${{ parameters.configurationName }}
9+
timeoutInMinutes: ${{ parameters.timeoutInMinutes }}
710
pool:
811
vmImage: 'ubuntu-latest'
912
steps:
@@ -80,8 +83,11 @@ jobs:
8083
- template: test.yml
8184
parameters:
8285
configurationName: ${{ parameters.configurationName }}
86+
runTestsParameters: ${{ parameters.runTestsParameters }}
8387
- template: test.yml
8488
parameters:
8589
configurationName: ${{ parameters.configurationName }}
8690
runTestsName: 'OpCache'
87-
runTestsParameters: -d zend_extension=opcache.so -d opcache.enable_cli=1
91+
runTestsParameters: >-
92+
${{ parameters.runTestsParameters }}
93+
-d zend_extension=opcache.so -d opcache.enable_cli=1

azure/lsan-suppressions.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
leak:acommon::DictInfoList::elements

ext/fileinfo/tests/cve-2014-3538-nojit.phpt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ Bug #66731: file: extensive backtraking, with pcre.jit=0
44
<?php
55
if (defined("PHP_DEBUG") && PHP_DEBUG)
66
die("skip not suitable for debug build");
7+
if (getenv('SKIP_PERF_SENSITIVE'))
8+
die("skip performance sensitive test");
79
if (!class_exists('finfo'))
810
die('skip no fileinfo extension');
911
?>

ext/opcache/tests/log_verbosity_bug.phpt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ opcache.file_cache_fallback=0
1212
opcache.memory_consumption=999999999
1313
opcache.log_verbosity_level=-1
1414
--SKIPIF--
15-
<?php require_once('skipif.inc'); ?>
15+
<?php
16+
require_once('skipif.inc');
17+
if (getenv('SKIP_ASAN')) die('xfail Startup failure leak');
18+
?>
1619
--FILE--
1720
<?php
1821
var_dump("Script should fail");

ext/opcache/tests/preload_006.phpt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ opcache.enable_cli=1
66
opcache.optimization_level=-1
77
opcache.preload={PWD}/preload_inheritance_error_ind.inc
88
--SKIPIF--
9-
<?php require_once('skipif.inc'); ?>
9+
<?php
10+
require_once('skipif.inc');
11+
if (getenv('SKIP_ASAN')) die('xfail Startup failure leak');
12+
?>
1013
--FILE--
1114
<?php
1215
echo "Foobar\n";

ext/pcntl/tests/pcntl_unshare_02.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ if (!extension_loaded("pcntl")) die("skip");
66
if (!extension_loaded("posix")) die("skip posix extension not available");
77
if (!function_exists("pcntl_unshare")) die("skip pcntl_unshare is not available");
88
if (!defined("CLONE_NEWPID")) die("skip flag unavailable");
9+
if (getenv("SKIP_ASAN")) die("skip asan chokes on this");
910
if (posix_getuid() !== 0 &&
1011
(!defined("CLONE_NEWUSER") ||
1112
(pcntl_unshare(CLONE_NEWUSER) == false && pcntl_get_last_error() == PCNTL_EPERM))) {

ext/pcre/tests/bug72685.phpt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
--TEST--
22
Bug #72685: Same string is UTF-8 validated repeatedly
3+
--SKIPIF--
4+
<?php
5+
if (getenv('SKIP_PERF_SENSITIVE')) die("skip performance sensitive test");
6+
?>
37
--FILE--
48
<?php
59

ext/pspell/tests/005.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ pspell configs
44
<?php
55
if (!extension_loaded('pspell')) die('skip');
66
if (!@pspell_new('en')) die('skip English dictionary is not available');
7+
if (getenv('SKIP_ASAN')) die('skip pspell leaks memory for invalid dicationaries');
78
?>
89
--FILE--
910
<?php

0 commit comments

Comments
 (0)