Skip to content

[wip] Define TEST_NON_ROOT_USER in CI #9688

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ asan_task:
libjpeg-dev
libpng-dev
libfreetype6-dev
- useradd testuser
build_script:
- ./buildconf -f
- >-
Expand Down Expand Up @@ -157,8 +158,6 @@ asan_task:
- mkdir -p /etc/php.d
- echo opcache.enable_cli=1 > /etc/php.d/opcache.ini
- echo opcache.protect_memory=1 >> /etc/php.d/opcache.ini
# Specify opcache.preload_user as we're running as root.
- echo opcache.preload_user=root >> /etc/php.d/opcache.ini
tests_script:
- export SKIP_IO_CAPTURE_TESTS=1
- export CI_NO_IPV6=1
Expand All @@ -168,10 +167,11 @@ asan_task:
- export PDO_MYSQL_TEST_DSN="mysql:host=127.0.0.1;dbname=test"
- export PDO_MYSQL_TEST_USER=root
- export PDO_MYSQL_TEST_PASS=root
- export TEST_NON_ROOT_USER=testuser
- export TEST_FPM_RUN_AS_ROOT=1
- >-
sapi/cli/php run-tests.php
-P -q -x -j2
-g FAIL,BORK,LEAK,XLEAK
--no-progress
--offline
--show-diff
Expand All @@ -192,6 +192,7 @@ freebsd_task:
#- pkg upgrade -y
- kldload accf_http
- 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
- pw useradd testuser
script:
- ./buildconf -f
- ./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
Expand All @@ -200,12 +201,12 @@ freebsd_task:
- gmake install
- echo opcache.enable_cli=1 > /etc/php.d/opcache.ini
- echo opcache.protect_memory=1 >> /etc/php.d/opcache.ini
# Specify opcache.preload_user as we're running as root.
- echo opcache.preload_user=root >> /etc/php.d/opcache.ini
tests_script:
- export SKIP_IO_CAPTURE_TESTS=1
- export CI_NO_IPV6=1
- export STACK_LIMIT_DEFAULTS_CHECK=1
- export TEST_NON_ROOT_USER=testuser
- export TEST_FPM_RUN_AS_ROOT=1
- 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

arm_task:
Expand Down
1 change: 1 addition & 0 deletions ext/opcache/tests/gh10405.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ posix
<?php
if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
if (posix_geteuid() !== 0) die('skip Test needs root user');
if (getenv('SKIP_ASAN')) die('xfail Leaks memory with ASAN');
?>
--FILE--
<?php
Expand Down
1 change: 1 addition & 0 deletions ext/opcache/tests/preload_user_002.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ posix
<?php
if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
if (posix_geteuid() !== 0) die('skip Test needs root user');
if (getenv('SKIP_ASAN')) die('skip ASAN can not attach to thread after setuid()');
?>
--FILE--
<?php
Expand Down
7 changes: 1 addition & 6 deletions ext/opcache/tests/preload_user_004.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,13 @@ $args = [

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

?>
Done
--EXPECTF--
array(1) {
[0]=>
string(%d) "%sFatal Error "opcache.preload" requires "opcache.preload_user" when running under uid 0
"
}
Done
--CLEAN--
<?php
Expand Down