coyote/Scripts/run-tests.ps1

71 строка
2.6 KiB
PowerShell
Исходник Обычный вид История

2020-02-29 03:01:21 +03:00
param(
[string]$dotnet = "dotnet",
2021-04-22 05:29:25 +03:00
[ValidateSet("all", "net5.0", "net462")]
[string]$framework = "all",
[ValidateSet("all", "rewriting", "testing", "tasks-testing", "actors", "actors-testing", "standalone")]
[string]$test = "all",
[string]$filter = "",
[string]$logger = "",
[ValidateSet("quiet", "minimal", "normal", "detailed", "diagnostic")]
[string]$v = "normal"
2020-02-29 03:01:21 +03:00
)
Import-Module $PSScriptRoot/powershell/common.psm1 -Force
2020-02-29 03:01:21 +03:00
$targets = [ordered]@{
"rewriting" = "Tests.Rewriting"
"testing" = "Tests.BugFinding"
"tasks-testing" = "Tests.Tasks.BugFinding"
2020-10-22 04:22:44 +03:00
"actors" = "Tests.Actors"
"actors-testing" = "Tests.Actors.BugFinding"
2020-10-22 01:39:52 +03:00
"standalone" = "Tests.Standalone"
2020-02-29 03:01:21 +03:00
}
2021-07-07 07:19:51 +03:00
$ilverify = FindProgram("ilverify")
if ($null -eq $ilverify) {
&dotnet tool install --global dotnet-ilverify
$ilverify = FindProgram("ilverify");
}
$dotnet_path = FindDotNet("dotnet");
[System.Environment]::SetEnvironmentVariable('COYOTE_CLI_TELEMETRY_OPTOUT', '1')
2020-02-29 03:01:21 +03:00
Write-Comment -prefix "." -text "Running the Coyote tests" -color "yellow"
# Run all enabled tests.
2020-10-22 04:22:44 +03:00
foreach ($kvp in $targets.GetEnumerator()) {
if (($test -ne "all") -and ($test -ne $($kvp.Name))) {
continue
}
2021-04-22 05:29:25 +03:00
$frameworks = Get-ChildItem -Path "$PSScriptRoot/../Tests/$($kvp.Value)/bin" | Where-Object Name -CNotIn "net48", "netstandard2.0", "netstandard2.1", "netcoreapp3.1" | Select-Object -expand Name
2020-10-22 04:22:44 +03:00
foreach ($f in $frameworks) {
if (($framework -ne "all") -and ($f -ne $framework)) {
continue
}
2021-04-22 05:29:25 +03:00
if (($($kvp.Name) -eq "standalone") -and ($f -eq "net462")) {
continue
}
$target = "$PSScriptRoot/../Tests/$($kvp.Value)/$($kvp.Value).csproj"
2021-07-07 07:19:51 +03:00
if ($f -eq "net5.0") {
$AssemblyName = GetAssemblyName($target)
$NetCoreApp = FindNetCoreApp -dotnet_path $dotnet_path -version "5.0"
$command = "$PSScriptRoot/../Tests/$($kvp.Value)/bin/net5.0/$AssemblyName.dll"
$command = $command + ' -r "' + "$PSScriptRoot/../Tests/$($kvp.Value)/bin/net5.0/*.dll" + '"'
$command = $command + ' -r "' + "$dotnet_path/packs/Microsoft.NETCore.App.Ref/5.0.0/ref/net5.0/*.dll" + '"'
$command = $command + ' -r "' + "$PSScriptRoot/../bin/net5.0/*.dll" + '"'
$command = $command + ' -r "' + $NetCoreApp + '/*.dll"'
Invoke-ToolCommand -tool $ilverify -cmd $command -error_msg "Verifying assembly failed"
}
Invoke-DotnetTest -dotnet $dotnet -project $($kvp.Name) -target $target -filter $filter -logger $logger -framework $f -verbosity $v
2020-02-29 03:01:21 +03:00
}
}
Write-Comment -prefix "." -text "Done" -color "green"