Skip to content

Commit fa7ed01

Browse files
committed
Fix and improve running tests
1 parent f3c45bf commit fa7ed01

16 files changed

+161
-78
lines changed

.github/workflows/php.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ jobs:
4949
arch: [x64, x86]
5050
ts: [nts, ts]
5151
opcache: [opcache, nocache]
52+
test-type: [php, ext]
5253
runs-on: windows-2022
5354
needs: artifacts
5455
steps:
@@ -69,14 +70,15 @@ jobs:
6970
Invoke-PhpTests -PhpVersion ${{inputs.php-version}} `
7071
-Arch ${{matrix.arch}} `
7172
-Ts ${{matrix.ts}} `
72-
-Opcache ${{matrix.opcache}}
73+
-Opcache ${{matrix.opcache}} `
74+
-TestType ${{matrix.test-type}}
7375
7476
- name: Upload artifacts
7577
uses: actions/upload-artifact@v5
7678
continue-on-error: true
7779
with:
78-
name: test-results-${{matrix.arch}}-${{matrix.ts}}-${{matrix.opcache}}
79-
path: test-${{matrix.arch}}-${{matrix.ts}}-${{matrix.opcache}}.xml
80+
name: test-results-${{matrix.arch}}-${{matrix.ts}}-${{matrix.opcache}}-${{matrix.test-type}}
81+
path: test-${{matrix.arch}}-${{matrix.ts}}-${{matrix.opcache}}-${{matrix.test-type}}.xml
8082
upload:
8183
runs-on: ubuntu-latest
8284
needs: tests

.github/workflows/test.yml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,27 +14,25 @@ jobs:
1414
arch: [x64, x86]
1515
ts: [nts, ts]
1616
opcache: [opcache, nocache]
17+
test-type: [php, ext]
1718
runs-on: windows-2022
1819
steps:
1920
- name: Checkout
2021
uses: actions/checkout@v5
2122

22-
- name: Setup MySQL
23-
uses: ankane/setup-mysql@v1
24-
with:
25-
database: test
26-
27-
- name: Test PHP
23+
- name: Run Tests
2824
shell: pwsh
25+
continue-on-error: true
2926
run: |
3027
Import-Module (Join-Path $(pwd).Path '\php\BuildPhp') -Force
3128
Invoke-PhpTests -PhpVersion ${{inputs.php-version}} `
3229
-Arch ${{matrix.arch}} `
3330
-Ts ${{matrix.ts}} `
34-
-Opcache ${{matrix.opcache}}
31+
-Opcache ${{matrix.opcache}} `
32+
-TestType ${{matrix.test-type}}
3533
3634
- name: Upload artifacts
3735
uses: actions/upload-artifact@v5
3836
with:
39-
name: test-results-${{matrix.arch}}-${{matrix.ts}}-${{matrix.opcache}}
40-
path: test-${{matrix.arch}}-${{matrix.ts}}-${{matrix.opcache}}.xml
37+
name: test-results-${{matrix.arch}}-${{matrix.ts}}-${{matrix.opcache}}-${{matrix.test-type}}
38+
path: test-${{matrix.arch}}-${{matrix.ts}}-${{matrix.opcache}}-${{matrix.test-type}}.xml

php/BuildPhp/BuildPhp.psd1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@
8383
'Set-MySqlTestEnvironment',
8484
'Set-NetSecurityProtocolType',
8585
'Set-OdbcTestEnvironment',
86+
'Set-OpenSslTestEnvironment',
8687
'Set-PgSqlTestEnvironment',
8788
'Set-PhpIniForTests',
8889
'Set-SnmpTestEnvironment',
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,4 @@ ext\xmlreader\tests
2424
ext\xmlwriter\tests
2525
ext\xml\tests
2626
ext\zip\tests
27-
ext\zlib\tests
28-
Sapi\cgi\tests
29-
Sapi\cli\tests
30-
tests
31-
Zend\tests
27+
ext\zlib\tests
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
opcache.memory_consumption=256
22
opcache.interned_strings_buffer=16
33
opcache.max_accelerated_files=8000
4-
opcache.jit_buffer_size=32M
54
opcache.revalidate_freq=60
65
opcache.fast_shutdown=1
76
opcache.enable=1
@@ -10,3 +9,7 @@ opcache.error_log=OPCACHE_ERROR_LOG_PATH
109
opcache.log_verbosity_level=2
1110
opcache.file_cache=OPCACHE_FILE_CACHE_PATH
1211
opcache.file_cache_fallback=1
12+
opcache.protect_memory=1
13+
opcache.jit_buffer_size=64M
14+
opcache.jit=tracing
15+
opcache.record_warnings=1
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
opcache.memory_consumption=128
22
opcache.interned_strings_buffer=8
33
opcache.max_accelerated_files=4000
4-
opcache.jit_buffer_size=16M
54
opcache.revalidate_freq=60
65
opcache.fast_shutdown=1
76
opcache.enable=1
@@ -10,3 +9,7 @@ opcache.error_log=OPCACHE_ERROR_LOG_PATH
109
opcache.log_verbosity_level=2
1110
opcache.file_cache=OPCACHE_FILE_CACHE_PATH
1211
opcache.file_cache_fallback=1
12+
opcache.protect_memory=1
13+
opcache.jit_buffer_size=64M
14+
opcache.jit=tracing
15+
opcache.record_warnings=1
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Sapi\cgi\tests
2+
Sapi\cli\tests
3+
tests
4+
Zend\tests

php/BuildPhp/private/Add-TestRequirements.ps1

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -70,29 +70,19 @@ function Add-TestRequirements {
7070
[System.IO.Compression.ZipFile]::ExtractToDirectory($testZipFilePath, $testsDirectoryPath)
7171
}
7272

73-
$ldapDll = Join-Path $binDirectoryPath 'php_ldap.dll'
74-
Remove-Item -LiteralPath $ldapDll -Force -ErrorAction SilentlyContinue
75-
76-
$phpExePath = Join-Path $binDirectoryPath 'php.exe'
77-
$phpCgiPath = Join-Path $binDirectoryPath 'php-cgi.exe'
78-
try { & editbin "/stack:8388608" $phpExePath | Out-Null } catch {}
79-
try { & editbin "/stack:8388608" $phpCgiPath | Out-Null } catch {}
80-
81-
$Env:TEST_PHPDBG_EXECUTABLE = (Join-Path $binDirectoryPath 'phpdbg.exe')
82-
8373
Get-PhpSdk
8474
$env:DEPS_DIR = "$currentDirectory/../deps"
8575
New-Item "$env:DEPS_DIR" -ItemType "directory" -Force > $null 2>&1
8676
$branch = if ($PhpVersion -eq 'master') {'master'} else {($PhpVersion -split '\.')[0..1] -join '.'}
87-
& "$currentDirectory\php-sdk\bin\phpsdk_deps.bat" --update --no-backup --branch $branch --stability staging --deps $env:DEPS_DIR --crt $VsVersion --arch $Arch
88-
89-
Set-MySqlTestEnvironment
90-
Set-PgSqlTestEnvironment
91-
Set-OdbcTestEnvironment
92-
Set-MsSqlTestEnvironment
93-
Set-FirebirdTestEnvironment
94-
Set-EnchantTestEnvironment
95-
Set-SnmpTestEnvironment -TestsDirectoryPath $testsDirectoryPath
77+
$env:PHP_SDK_VS = $VsVersion
78+
$env:PHP_SDK_ARCH = $Arch
79+
$bat_content = @()
80+
$bat_content += "cmd /c phpsdk_deps --update --force --no-backup --branch $branch --stability staging --deps $env:DEPS_DIR"
81+
$bat_content += "editbin /stack:8388608 $binDirectoryPath\php.exe"
82+
$bat_content += "editbin /stack:8388608 $binDirectoryPath\php-cgi.exe"
83+
Set-Content -Encoding "ASCII" -Path vs.bat -Value $bat_content
84+
& "$currentDirectory\php-sdk\phpsdk-starter.bat" -c $VsVersion -a $Arch -t vs.bat
85+
Add-Path "$env:DEPS_DIR\bin"
9686
}
9787
end {
9888
}

php/BuildPhp/private/Get-TestsList.ps1

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,25 @@ function Get-TestsList {
44
Get the PHP test list.
55
.PARAMETER OutputFile
66
Output file
7+
.PARAMETER Type
8+
Test type
79
#>
810
[OutputType()]
911
param (
1012
[Parameter(Mandatory = $true, Position=0, HelpMessage='Output file')]
1113
[ValidateNotNull()]
1214
[ValidateLength(1, [int]::MaxValue)]
13-
[string] $OutputFile
15+
[string] $OutputFile,
16+
[Parameter(Mandatory = $true, Position=1, HelpMessage='Test type')]
17+
[ValidateNotNull()]
18+
[ValidateSet('php', 'ext')]
19+
[string] $Type
1420
)
1521
begin {
1622
}
1723
process {
1824
Remove-Item $OutputFile -ErrorAction "Ignore"
19-
foreach ($line in Get-Content "$PSScriptRoot\..\config\test_directories") {
25+
foreach ($line in Get-Content "$PSScriptRoot\..\config\${Type}_test_directories") {
2026
$ttr = Get-ChildItem -Path $line -Filter "*.phpt" -Recurse
2127
foreach ($t in $ttr) {
2228
Add-Content $OutputFile ($t | Resolve-Path -Relative)

php/BuildPhp/private/Set-FirebirdTestEnvironment.ps1

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,13 @@ function Set-FirebirdTestEnvironment {
3939

4040
$setupSql = Join-Path $destDir 'setup.sql'
4141
Set-Content -Path $setupSql -Value "create database '$($env:PDO_FIREBIRD_TEST_DATABASE)' user '$($env:PDO_FIREBIRD_TEST_USER)' password '$($env:PDO_FIREBIRD_TEST_PASS)';" -Encoding ASCII
42-
43-
& (Join-Path $destDir 'instsvc.exe') install -n TestInstance | Out-Null
44-
& (Join-Path $destDir 'isql') -q -i $setupSql | Out-Null
45-
& (Join-Path $destDir 'isql') -q -i $createUserSql -user sysdba $env:PDO_FIREBIRD_TEST_DATABASE | Out-Null
46-
& (Join-Path $destDir 'instsvc.exe') start -n TestInstance | Out-Null
42+
if(-not(Test-Path pdo_firebird_db_created)) {
43+
& (Join-Path $destDir 'instsvc.exe') install -n TestInstance | Out-Null
44+
& (Join-Path $destDir 'isql') -q -i $setupSql | Out-Null
45+
& (Join-Path $destDir 'isql') -q -i $createUserSql -user sysdba $env:PDO_FIREBIRD_TEST_DATABASE | Out-Null
46+
& (Join-Path $destDir 'instsvc.exe') start -n TestInstance | Out-Null
47+
Set-Content -Path pdo_firebird_db_created -Value "db_created" -Encoding ASCII
48+
}
4749

4850
Add-Path $destDir
4951
}

0 commit comments

Comments
 (0)