-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for custom test runner for extensions
- Loading branch information
1 parent
22e7ccb
commit 0e0e7e0
Showing
6 changed files
with
72 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
Function Invoke-Tests { | ||
<# | ||
.SYNOPSIS | ||
Build the extension | ||
.PARAMETER Config | ||
Extension Configuration | ||
#> | ||
[OutputType()] | ||
param( | ||
[Parameter(Mandatory = $true, Position=0, HelpMessage='Extension Configuration')] | ||
[PSCustomObject] $Config | ||
) | ||
begin { | ||
} | ||
process { | ||
$currentDirectory = (Get-Location).Path | ||
$php_dir = Join-Path $currentDirectory php-bin | ||
$env:TEST_PHP_EXECUTABLE = "$php_dir\php.exe" | ||
$env:REPORT_EXIT_STATUS = 1 | ||
$env:XDEBUG_MODE = "" | ||
$env:TEMP=$((Get-Item -LiteralPath $Env:TEMP).FullName) | ||
$env:TMP=$((Get-Item -LiteralPath $Env:TMP).FullName) | ||
$php_args = @( | ||
'-n' | ||
) | ||
if ((Select-String -Path 'config.w32' -Pattern 'ZEND_EXTENSION\(' -Quiet) -eq $true) { | ||
$php_args += @( | ||
"-d zend_extension=$currentDirectory\$($Config.build_directory)\php_$($Config.name).dll" | ||
) | ||
} | ||
$env:TEST_PHP_ARGS = $php_args -join ' ' | ||
if ($null -eq $env:TEST_RUNNER) { | ||
$env:TEST_RUNNER = 'run-tests.php' | ||
} elseif(-not(Test-Path $env:TEST_RUNNER)) { | ||
throw "Test runner $env:TEST_RUNNER does not exist." | ||
} | ||
$test_runner_args = @( | ||
'-j8', | ||
'-q', | ||
'--offline', | ||
'--show-diff', | ||
'--show-slow 1000', | ||
'--set-timeout 120', | ||
'-g FAIL,XFAIL,BORK,WARN,LEAK,SKIP', | ||
'--temp-source ' + $env:TEMP, | ||
'--temp-target ' + $env:TEMP | ||
) | ||
$phpExpression = "php $env:TEST_RUNNER " + ($test_runner_args -join ' ') | ||
chcp 65001 | ||
Write-Output "Running tests... $phpExpression" | ||
Write-Output "TEST_PHP_ARGS $env:TEST_PHP_ARGS" | ||
Write-Output "TEST_PHP_EXECUTABLE $env:TEST_PHP_EXECUTABLE" | ||
Invoke-Expression $phpExpression | ||
} | ||
end { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters