Skip to content
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
30 changes: 30 additions & 0 deletions docs/source/miscellaneous/writing-tests.rst
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,9 @@ An alternative to have a ``--CONFLICTS--`` section is to add a file named ``CONF
directory containing the tests. The contents of the ``CONFLICTS`` file must have the same format as
the contents of the ``--CONFLICTS--`` section.

Unlike a ``SCOPED_CONFLICTS`` file, a ``CONFLICTS`` file also prevents tests in its own directory
from running concurrently, regardless of whether the directory has a ``MAX_CONCURRENCY`` file.

**Required:** No.

**Format:** One conflict key per line. Comment lines starting with # are also allowed.
Expand All @@ -696,6 +699,33 @@ Example 1 (snippet):

Example 1 (full): :ref:`conflicts_1.phpt`

``SCOPED_CONFLICTS`` file
-------------------------

**Description:** This file is only relevant for parallel test execution. It specifies directory
conflict keys that tests in the same directory may share. Tests outside the directory that use the
same key remain mutually exclusive with the directory. Use this when a directory may run internally
in parallel but must not overlap another user of the same shared resource.

This does not limit concurrency within the directory. Add a ``MAX_CONCURRENCY`` file separately if a
numerical cap is also required.

**Required:** No.

**Format:** One conflict key per line. Comment lines starting with # are also allowed.

``MAX_CONCURRENCY`` file
------------------------

**Description:** This file is only relevant for parallel test execution. It limits how many workers
may simultaneously execute tests from its directory. It does not change the behavior of
``CONFLICTS`` or ``SCOPED_CONFLICTS``. This allows a bounded amount of parallelism for tests that
are safe to overlap but would otherwise contend excessively for a shared resource.

**Required:** No.

**Format:** A positive integer. Comment lines starting with # are also allowed.

``--WHITESPACE_SENSITIVE--``
----------------------------

Expand Down
1 change: 0 additions & 1 deletion ext/curl/tests/CONFLICTS

This file was deleted.

1 change: 1 addition & 0 deletions ext/curl/tests/MAX_CONCURRENCY
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
4
4 changes: 2 additions & 2 deletions ext/curl/tests/bug48203_multi.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ if (curl_version()['version_number'] === 0x080a00) {
<?php
include 'server.inc';
function checkForClosedFilePointer($target_url, $curl_option, $description) {
$fp = fopen(__DIR__ . '/bug48203.tmp', 'w');
$fp = fopen(__DIR__ . '/bug48203_multi.tmp', 'w');

$ch1 = curl_init();
$ch2 = curl_init();
Expand Down Expand Up @@ -70,7 +70,7 @@ foreach($options_to_check as $option) {

?>
--CLEAN--
<?php @unlink(__DIR__ . '/bug48203.tmp'); ?>
<?php @unlink(__DIR__ . '/bug48203_multi.tmp'); ?>
--EXPECTF--
Warning: curl_multi_add_handle(): CURLOPT_STDERR resource has gone away, resetting to stderr in %s on line %d
%A
Expand Down
4 changes: 2 additions & 2 deletions ext/curl/tests/bug54798-unix.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ if(substr(PHP_OS, 0, 3) == 'WIN' ) {
<?php

function checkForClosedFilePointer($host, $curl_option, $description) {
$fp = fopen(__DIR__ . '/bug54798.tmp', 'w+');
$fp = fopen(__DIR__ . '/bug54798-unix.tmp', 'w+');

$ch = curl_init();

Expand Down Expand Up @@ -52,7 +52,7 @@ foreach($options_to_check as $option) {

?>
--CLEAN--
<?php @unlink(__DIR__ . '/bug54798.tmp'); ?>
<?php @unlink(__DIR__ . '/bug54798-unix.tmp'); ?>
--EXPECTF--
%a
%aOk for CURLOPT_STDERR
Expand Down
1 change: 1 addition & 0 deletions ext/openssl/tests/MAX_CONCURRENCY
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
10
File renamed without changes.
2 changes: 1 addition & 1 deletion ext/openssl/tests/ServerClientTestCase.inc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function phpt_has_sslv3() {
if (!is_null($result)) {
return $result;
}
$server = @stream_socket_server('sslv3://127.0.0.1:10013');
$server = @stream_socket_server('sslv3://127.0.0.1:0');
if ($result = !!$server) {
fclose($server);
}
Expand Down
4 changes: 2 additions & 2 deletions ext/openssl/tests/gh20802.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ $serverCode = <<<'CODE'
]
]
]);
$server = stream_socket_server('tls://127.0.0.1:12443', $errno, $errstr, $flags, $ctx);
$server = stream_socket_server('tls://127.0.0.1:0', $errno, $errstr, $flags, $ctx);
phpt_notify_server_start($server);
stream_socket_accept($server, 3);
CODE;
Expand All @@ -42,7 +42,7 @@ $ctx = stream_context_create([
'verify_peer' => false
]
]);
@stream_socket_client("tls://127.0.0.1:12443", $errno, $errstr, 1, $flags, $ctx);
@stream_socket_client("tls://{{ ADDR }}", $errno, $errstr, 1, $flags, $ctx);
CODE;

include 'CertificateGenerator.inc';
Expand Down
4 changes: 2 additions & 2 deletions ext/openssl/tests/openssl_cms_verify_der.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ if ($contentfile === false) {
die("failed to get a temporary filename!");
}

$pkcsfile = __DIR__ . "/openssl_cms_verify__pkcsfile.tmp";
$pkcsfile = __DIR__ . "/openssl_cms_verify_der__pkcsfile.tmp";
$eml = __DIR__ . "/signed.eml";
$wrong = "wrong";
$empty = "";
Expand Down Expand Up @@ -45,7 +45,7 @@ if (file_exists($contentfile)) {
?>
--CLEAN--
<?php
unlink(__DIR__ . DIRECTORY_SEPARATOR . '/openssl_cms_verify__pkcsfile.tmp');
unlink(__DIR__ . DIRECTORY_SEPARATOR . '/openssl_cms_verify_der__pkcsfile.tmp');
?>
--EXPECT--
bool(false)
Expand Down
4 changes: 2 additions & 2 deletions ext/openssl/tests/openssl_pkcs12_export_to_file_error.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ openssl_pkcs12_export_to_file() error tests
openssl
--FILE--
<?php
$pkcsfile = __DIR__ . "/openssl_pkcs12_export_to_file__pkcsfile.tmp";
$pkcsfile = __DIR__ . "/openssl_pkcs12_export_to_file_error.tmp";

$cert_file = __DIR__ . "/public.crt";
$cert = file_get_contents($cert_file);
Expand All @@ -21,7 +21,7 @@ var_dump(openssl_pkcs12_export_to_file($cert, '.', $priv, $pass));
?>
--CLEAN--
<?php
$pkcsfile = __DIR__ . "/openssl_pkcs12_export_to_file__pkcsfile.tmp";
$pkcsfile = __DIR__ . "/openssl_pkcs12_export_to_file_error.tmp";
if (file_exists($pkcsfile)) {
unlink($pkcsfile);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ if (!function_exists("proc_open")) die("skip no proc_open");
?>
--FILE--
<?php
$certFile = __DIR__ . DIRECTORY_SEPARATOR . 'session_resumption_serialize.pem.tmp';
$certFile = __DIR__ . DIRECTORY_SEPARATOR . 'session_resumption_import_export.pem.tmp';

$serverCode = <<<'CODE'
$flags = STREAM_SERVER_BIND|STREAM_SERVER_LISTEN;
Expand Down Expand Up @@ -76,7 +76,7 @@ ServerClientTestCase::getInstance()->run($clientCode, $serverCode);
?>
--CLEAN--
<?php
@unlink(__DIR__ . DIRECTORY_SEPARATOR . 'session_resumption_serialize.pem.tmp');
@unlink(__DIR__ . DIRECTORY_SEPARATOR . 'session_resumption_import_export.pem.tmp');
?>
--EXPECTF--
string(%d) "-----BEGIN SSL SESSION PARAMETERS-----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,5 @@ try {
echo $e->getMessage() . "\n";
}
?>
--CLEAN--
<?php
@unlink(__DIR__ . DIRECTORY_SEPARATOR . 'session_cache_disabled.pem.tmp');
?>
--EXPECT--
Failed to import session data
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ if (!function_exists("proc_open")) die("skip no proc_open");
?>
--FILE--
<?php
$certFile = __DIR__ . DIRECTORY_SEPARATOR . 'session_external_proper.pem.tmp';
$certFile = __DIR__ . DIRECTORY_SEPARATOR . 'session_external_proper_tls12.pem.tmp';

$serverCode = <<<'CODE'
$sessionStore = [];
Expand Down Expand Up @@ -105,7 +105,7 @@ ServerClientTestCase::getInstance()->run($clientCode, $serverCode);
?>
--CLEAN--
<?php
@unlink(__DIR__ . DIRECTORY_SEPARATOR . 'session_external_proper.pem.tmp');
@unlink(__DIR__ . DIRECTORY_SEPARATOR . 'session_external_proper_tls12.pem.tmp');
?>
--EXPECTF--
Client first connection resumed: no
Expand Down
8 changes: 4 additions & 4 deletions ext/openssl/tests/stream_server_reneg_limit.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ $certFile = __DIR__ . DIRECTORY_SEPARATOR . 'stream_server_reneg_limit.pem.tmp';

$serverCode = <<<'CODE'
$printed = false;
$serverUri = "ssl://127.0.0.1:64321";
$serverUri = "ssl://127.0.0.1:0";
$serverFlags = STREAM_SERVER_BIND | STREAM_SERVER_LISTEN;
$serverCtx = stream_context_create(['ssl' => [
'local_cert' => '%s',
Expand All @@ -42,7 +42,7 @@ $serverCode = <<<'CODE'
]]);

$server = stream_socket_server($serverUri, $errno, $errstr, $serverFlags, $serverCtx);
phpt_notify();
phpt_notify(message: stream_socket_get_name($server, false));

$clients = [];
while (1) {
Expand Down Expand Up @@ -71,9 +71,9 @@ CODE;
$serverCode = sprintf($serverCode, $certFile);

$clientCode = <<<'CODE'
phpt_wait();
$addr = trim(phpt_wait());

$cmd = 'openssl s_client -connect 127.0.0.1:64321';
$cmd = 'openssl s_client -connect ' . escapeshellarg($addr);
$descriptorSpec = [["pipe", "r"], ["pipe", "w"], ["pipe", "w"]];
$process = proc_open($cmd, $descriptorSpec, $pipes);

Expand Down
Loading
Loading