Skip to content

Commit 5fa27e2

Browse files
committed
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1: Add unique entry point for extra tests
2 parents d9d4126 + b633720 commit 5fa27e2

File tree

6 files changed

+161
-3
lines changed

6 files changed

+161
-3
lines changed

.github/actions/apt-x32/action.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ runs:
66
run: |
77
set -x
88
9+
OPCACHE_TLS_TESTS_DEPS="gcc clang lld"
10+
911
export DEBIAN_FRONTEND=noninteractive
1012
dpkg --add-architecture i386
1113
apt-get update -y | true
@@ -50,4 +52,5 @@ runs:
5052
re2c \
5153
unzip \
5254
wget \
53-
zlib1g-dev:i386
55+
zlib1g-dev:i386 \
56+
$OPCACHE_TLS_TESTS_DEPS

.github/actions/apt-x64/action.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ runs:
66
run: |
77
set -x
88
9+
OPCACHE_TLS_TESTS_DEPS="gcc clang lld"
10+
911
sudo apt-get update
1012
sudo apt-get install \
1113
bison \
@@ -58,4 +60,5 @@ runs:
5860
libqdbm-dev \
5961
libjpeg-dev \
6062
libpng-dev \
61-
libfreetype6-dev
63+
libfreetype6-dev \
64+
$OPCACHE_TLS_TESTS_DEPS
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
name: Extra tests
2+
runs:
3+
using: composite
4+
steps:
5+
- shell: sh
6+
run: |
7+
sapi/cli/php run-extra-tests.php

.github/actions/freebsd/action.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ inputs:
33
configurationParameters:
44
default: ''
55
required: false
6+
runExtraTests:
7+
default: false
8+
required: false
69
runs:
710
using: composite
811
steps:
@@ -17,6 +20,8 @@ runs:
1720
prepare: |
1821
cd $GITHUB_WORKSPACE
1922
23+
OPCACHE_TLS_TESTS_DEPS="gcc"
24+
2025
kldload accf_http
2126
pkg install -y \
2227
autoconf \
@@ -41,9 +46,11 @@ runs:
4146
webp \
4247
libavif \
4348
`#sqlite3` \
44-
curl
49+
curl \
50+
$OPCACHE_TLS_TESTS_DEPS
4551
4652
./buildconf -f
53+
CC=clang CXX=clang++ \
4754
./configure \
4855
--prefix=/usr/local \
4956
--enable-debug \
@@ -107,3 +114,7 @@ runs:
107114
--show-slow 1000 \
108115
--set-timeout 120 \
109116
-d zend_extension=opcache.so
117+
118+
if test "${{ inputs.runExtraTests }}" = "true"; then
119+
sapi/cli/php run-extra-tests.php
120+
fi

.github/workflows/nightly.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ jobs:
8585
with:
8686
runTestsParameters: >-
8787
--asan -x
88+
- name: Extra tests
89+
uses: ./.github/actions/extra-tests
8890
ALPINE:
8991
if: inputs.run_alpine
9092
name: ALPINE_X64_ASAN_UBSAN_DEBUG_ZTS
@@ -134,6 +136,8 @@ jobs:
134136
--asan -x
135137
-d zend_extension=opcache.so
136138
-d opcache.enable_cli=1
139+
- name: Extra tests
140+
uses: ./.github/actions/extra-tests
137141
- name: Notify Slack
138142
if: failure()
139143
uses: ./.github/actions/notify-slack
@@ -266,6 +270,8 @@ jobs:
266270
${{ matrix.run_tests_parameters }}
267271
-d zend_extension=opcache.so
268272
-d opcache.enable_cli=1
273+
- name: Extra tests
274+
uses: ./.github/actions/extra-tests
269275
- name: Verify generated files are up to date
270276
uses: ./.github/actions/verify-generated-files
271277
- name: Notify Slack
@@ -355,6 +361,8 @@ jobs:
355361
${{ matrix.run_tests_parameters }}
356362
-d zend_extension=opcache.so
357363
-d opcache.enable_cli=1
364+
- name: Extra tests
365+
uses: ./.github/actions/extra-tests
358366
- name: Notify Slack
359367
if: failure()
360368
uses: ./.github/actions/notify-slack
@@ -414,6 +422,8 @@ jobs:
414422
runTestsParameters: >-
415423
-d zend_extension=opcache.so
416424
-d opcache.enable_cli=1
425+
- name: Extra tests
426+
uses: ./.github/actions/extra-tests
417427
- name: Verify generated files are up to date
418428
uses: ./.github/actions/verify-generated-files
419429
- name: Notify Slack
@@ -1076,3 +1086,4 @@ jobs:
10761086
with:
10771087
configurationParameters: >-
10781088
--${{ matrix.zts && 'enable' || 'disable' }}-zts
1089+
runExtraTests: true

run-extra-tests.php

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
#!/usr/bin/env php
2+
<?php
3+
/*
4+
+----------------------------------------------------------------------+
5+
| Copyright (c) The PHP Group |
6+
+----------------------------------------------------------------------+
7+
| This source file is subject to version 3.01 of the PHP license, |
8+
| that is bundled with this package in the file LICENSE, and is |
9+
| available through the world-wide-web at the following url: |
10+
| https://www.php.net/license/3_01.txt |
11+
| If you did not receive a copy of the PHP license and are unable to |
12+
| obtain it through the world-wide-web, please send a note to |
13+
| [email protected] so we can mail you a copy immediately. |
14+
+----------------------------------------------------------------------+
15+
*/
16+
17+
/* This is a single entrypoint for non-phpt tests. */
18+
19+
class Environment
20+
{
21+
public function __construct(
22+
public string $os,
23+
public string $cpuArch,
24+
public bool $zts,
25+
public bool $debug,
26+
public bool $githubAction,
27+
) {}
28+
}
29+
30+
function show_usage(): void
31+
{
32+
echo <<<HELP
33+
Synopsis:
34+
php run-extra-tests.php
35+
36+
Environment variables:
37+
TEST_PHP_OS: One of 'Windows NT', 'Linux', 'FreeBSD', 'Darwin'
38+
TEST_PHP_CPU_ARCH: One of 'x86', 'x86_64', 'aarch64'
39+
40+
HELP;
41+
}
42+
43+
function main(int $argc, array $argv): void
44+
{
45+
if ($argc !== 1) {
46+
show_usage();
47+
exit(1);
48+
}
49+
50+
$environment = new Environment(
51+
detect_os(),
52+
detect_cpu_arch(),
53+
PHP_ZTS,
54+
PHP_DEBUG,
55+
getenv('GITHUB_ACTIONS') === 'true',
56+
);
57+
58+
echo "=====================================================================\n";
59+
echo "OS: {$environment->os}\n";
60+
echo "CPU Arch: {$environment->cpuArch}\n";
61+
echo "ZTS: " . ($environment->zts ? 'Yes' : 'No') . "\n";
62+
echo "DEBUG: " . ($environment->debug ? 'Yes' : 'No') . "\n";
63+
echo "=====================================================================\n";
64+
65+
echo "No tests in this branch yet.\n";
66+
67+
echo "All OK\n";
68+
}
69+
70+
function output_group_start(Environment $environment, string $name): void
71+
{
72+
if ($environment->githubAction) {
73+
printf("::group::%s\n", $name);
74+
} else {
75+
printf("%s\n", $name);
76+
}
77+
}
78+
79+
function output_group_end(Environment $environment): void
80+
{
81+
if ($environment->githubAction) {
82+
printf("::endgroup::\n");
83+
}
84+
}
85+
86+
/**
87+
* Returns getenv('TEST_PHP_OS') if defined, otherwise returns one of
88+
* 'Windows NT', 'Linux', 'FreeBSD', 'Darwin', ...
89+
*/
90+
function detect_os(): string
91+
{
92+
$os = (string) getenv('TEST_PHP_OS');
93+
if ($os !== '') {
94+
return $os;
95+
}
96+
97+
return php_uname('s');
98+
}
99+
100+
/**
101+
* Returns getenv('TEST_PHP_CPU_ARCH') if defined, otherwise returns one of
102+
* 'x86', 'x86_64', 'aarch64', ...
103+
*/
104+
function detect_cpu_arch(): string
105+
{
106+
$cpu = (string) getenv('TEST_PHP_CPU_ARCH');
107+
if ($cpu !== '') {
108+
return $cpu;
109+
}
110+
111+
$cpu = php_uname('m');
112+
if (strtolower($cpu) === 'amd64') {
113+
$cpu = 'x86_64';
114+
} else if (in_array($cpu, ['i386', 'i686'])) {
115+
$cpu = 'x86';
116+
} else if ($cpu === 'arm64') {
117+
$cpu = 'aarch64';
118+
}
119+
120+
return $cpu;
121+
}
122+
123+
main($argc, $argv);

0 commit comments

Comments
 (0)