Skip to content

Commit 27bb0ff

Browse files
committed
Update cirrus environment for opcache.preload_user tests
1 parent 32a144b commit 27bb0ff

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

.cirrus.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ asan_task:
6868
libjpeg-dev
6969
libpng-dev
7070
libfreetype6-dev
71+
- useradd testuser
7172
build_script:
7273
- ./buildconf -f
7374
- >-
@@ -155,8 +156,6 @@ asan_task:
155156
- mkdir -p /etc/php.d
156157
- echo opcache.enable_cli=1 > /etc/php.d/opcache.ini
157158
- echo opcache.protect_memory=1 >> /etc/php.d/opcache.ini
158-
# Specify opcache.preload_user as we're running as root.
159-
- echo opcache.preload_user=root >> /etc/php.d/opcache.ini
160159
tests_script:
161160
- export SKIP_IO_CAPTURE_TESTS=1
162161
- export CI_NO_IPV6=1
@@ -166,6 +165,8 @@ asan_task:
166165
- export PDO_MYSQL_TEST_DSN="mysql:host=mysql;dbname=test"
167166
- export PDO_MYSQL_TEST_USER=root
168167
- export PDO_MYSQL_TEST_PASS=root
168+
- export TEST_NON_ROOT_USER=testuser
169+
- export TEST_FPM_RUN_AS_ROOT=1
169170
- >-
170171
sapi/cli/php run-tests.php
171172
-P -q -x -j2
@@ -188,6 +189,7 @@ freebsd_task:
188189
#- pkg upgrade -y
189190
- kldload accf_http
190191
- pkg install -y autoconf bison gmake re2c icu libiconv png freetype2 enchant2 bzip2 krb5 t1lib gmp tidyp libsodium libzip libxml2 libxslt openssl oniguruma pkgconf webp libavif
192+
- pw useradd testuser
191193
script:
192194
- ./buildconf -f
193195
- ./configure --prefix=/usr/local --enable-debug --enable-option-checking=fatal --enable-fpm --with-pdo-sqlite --without-pear --with-bz2 --with-avif --with-jpeg --with-webp --with-freetype --enable-gd --enable-exif --with-zip --with-zlib --enable-soap --enable-xmlreader --with-xsl --with-libxml --enable-shmop --enable-pcntl --enable-mbstring --with-curl --enable-sockets --with-openssl --with-iconv=/usr/local --enable-bcmath --enable-calendar --enable-ftp --with-kerberos --with-ffi --enable-zend-test --enable-dl-test=shared --enable-intl --with-mhash --with-sodium --enable-werror --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d
@@ -196,9 +198,9 @@ freebsd_task:
196198
- gmake install
197199
- echo opcache.enable_cli=1 > /etc/php.d/opcache.ini
198200
- echo opcache.protect_memory=1 >> /etc/php.d/opcache.ini
199-
# Specify opcache.preload_user as we're running as root.
200-
- echo opcache.preload_user=root >> /etc/php.d/opcache.ini
201201
tests_script:
202202
- export SKIP_IO_CAPTURE_TESTS=1
203203
- export CI_NO_IPV6=1
204+
- export TEST_NON_ROOT_USER=testuser
205+
- export TEST_FPM_RUN_AS_ROOT=1
204206
- sapi/cli/php run-tests.php -P -q -j2 -g FAIL,BORK,LEAK,XLEAK --no-progress --offline --show-diff --show-slow 1000 --set-timeout 120 -d zend_extension=opcache.so

ext/opcache/tests/preload_user_002.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ posix
1414
<?php
1515
if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
1616
if (posix_geteuid() !== 0) die('skip Test needs root user');
17+
if (getenv('SKIP_ASAN')) die('skip ASAN can not attach to thread after setuid()');
1718
?>
1819
--FILE--
1920
<?php

ext/opcache/tests/preload_user_004.phpt

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,18 +52,13 @@ $args = [
5252

5353
$tester = new FPM\Tester($cfg, $code);
5454
$tester->start($args);
55-
var_dump($tester->getLogLines(1));
55+
$tester->expectLogPattern('#Fatal Error "opcache.preload" requires "opcache.preload_user" when running under uid 0#');
5656
$tester->terminate();
5757
$tester->close();
5858

5959
?>
6060
Done
6161
--EXPECTF--
62-
array(1) {
63-
[0]=>
64-
string(%d) "%sFatal Error "opcache.preload" requires "opcache.preload_user" when running under uid 0
65-
"
66-
}
6762
Done
6863
--CLEAN--
6964
<?php

0 commit comments

Comments
 (0)