1
0
Форкнуть 0

Updating scripts and retaining old scripts

This commit is contained in:
kartang 2016-05-06 11:30:54 -07:00
Родитель a3c43c6d61
Коммит b0a0693ca7
4 изменённых файлов: 137 добавлений и 28 удалений

Просмотреть файл

@ -1,7 +1,6 @@
#enable verbose mode
$VerbosePreference = "Continue";
[String]$dnxRoot = [System.Environment]::ExpandEnvironmentVariables('%USERPROFILE%\.nuget');
[String]$dnxRoot = [System.Environment]::ExpandEnvironmentVariables('%USERPROFILE%\.dnx');
rm -r $dnxRoot\packages -Force

7
CleanPackagesCore.ps1 Normal file
Просмотреть файл

@ -0,0 +1,7 @@
#enable verbose mode
$VerbosePreference = "Continue";
[String]$dnxRoot = [System.Environment]::ExpandEnvironmentVariables('%USERPROFILE%\.nuget');
rm -r $dnxRoot\packages -Force

Просмотреть файл

@ -2,13 +2,12 @@
$VerbosePreference = "Continue";
$TestProjects = @(
'.\test\Microsoft.ApplicationInsights.AspNetCore.Tests',
'.\test\MVCFramework45.FunctionalTests',
'.\test\WebApiShimFw46.FunctionalTests',
'.\test\EmptyApp.FunctionalTests'
'.\test\Microsoft.ApplicationInsights.AspNet.Tests',
'.\test\Mvc6Framework45.FunctionalTests',
'.\test\WebApiShimFw46.FunctionalTests'
)
Function Execute-DotnetProcess {
Function Execute-DnxProcess {
Param (
[Parameter(Mandatory=$True)]
[String]$RuntimePath,
@ -19,10 +18,10 @@ Function Execute-DotnetProcess {
)
$pinfo = New-Object System.Diagnostics.ProcessStartInfo;
$pinfo.FileName = $RuntimePath;
$pinfo.FileName = $dnxPath;
$pinfo.RedirectStandardOutput = $true;
$pinfo.UseShellExecute = $false;
$pinfo.Arguments = $Arguments;
$pinfo.Arguments = $arguments;
$pinfo.WorkingDirectory = $WorkingDirectory;
$p = New-Object System.Diagnostics.Process;
@ -39,29 +38,63 @@ Function Execute-DotnetProcess {
};
}
Function Get-DnxRuntimePaths {
[String]$runtimesRoot = [System.Environment]::ExpandEnvironmentVariables(
'%USERPROFILE%\.dnx\runtimes');
Write-Verbose "Start discovering DNX runtimes, rutimeRoot:$runtimesRoot";
[string[]]$results = @();
# lists folders only
Get-ChildItem $runtimesRoot | ?{ $_.PSIsContainer } |%{
$runtimePath = """$runtimesRoot\$($_.Name)\bin\dnx.exe""";
Write-Verbose "DNX runtime path discovered, path:$runtimePath";
$results += $runtimePath;
};
Write-Verbose "Stop discovering DNX runtimes";
Return $results;
}
[PSObject[]]$global:failed = @();
$global:WorkingDirectory = (pwd).Path;
$dotnetPath = "C:\Program Files\dotnet\dotnet.exe";
$dnxRuntimePaths = Get-DnxRuntimePaths;
$TestProjects |% {
[String]$arguments = "test";
[String]$currentWorkingDirectory = Join-Path $global:WorkingDirectory -ChildPath $_;
Write-Host "=========================================================";
Write-Host "== Executing tests";
Write-Host "== Working Folder: $currentWorkingDirectory";
Write-Host "== Runtime:$dotnetPath";
Write-Host "== Args:$arguments";
Write-Host "=========================================================";
$executeResult = Execute-DotnetProcess `
-RuntimePath $dotnetPath `
-Arguments $arguments `
-WorkingDirectory $currentWorkingDirectory;
Write-Host "Test process executed, ExitCode:$($executeResult.ExitCode)";
Write-Host "Output:";
Write-Host $executeResult.Output;
If ($executeResult.ExitCode -ne 0) {
$global:failed += $executeResult;
If ($dnxRuntimePaths.Count -ne 4){
Throw "Unexpected number of DNX runtimes were discovered, $($dnxRuntimePaths.Count)";
}
$dnxRuntimePaths |% {
$dnxPath = $_;
$TestProjects |% {
[String]$arguments = "test";
[String]$currentWorkingDirectory = Join-Path $global:WorkingDirectory -ChildPath $_;
Write-Host "=========================================================";
Write-Host "== Executing tests";
Write-Host "== Working Folder: $currentWorkingDirectory";
Write-Host "== Runtime:$dnxPath";
Write-Host "== Args:$arguments";
Write-Host "=========================================================";
$executeResult = Execute-DnxProcess `
-RuntimePath $dnxPath `
-Arguments $arguments `
-WorkingDirectory $currentWorkingDirectory;
Write-Host "Test process executed, ExitCode:$($executeResult.ExitCode)";
Write-Host "Output:";
Write-Host $executeResult.Output;
If ($executeResult.ExitCode -ne 0) {
$global:failed += $executeResult;
}
}
}

70
RunTestsCore.ps1 Normal file
Просмотреть файл

@ -0,0 +1,70 @@
#enable verbose mode
$VerbosePreference = "Continue";
$TestProjects = @(
'.\test\Microsoft.ApplicationInsights.AspNetCore.Tests',
'.\test\MVCFramework45.FunctionalTests',
'.\test\WebApiShimFw46.FunctionalTests',
'.\test\EmptyApp.FunctionalTests'
)
Function Execute-DotnetProcess {
Param (
[Parameter(Mandatory=$True)]
[String]$RuntimePath,
[Parameter(Mandatory=$True)]
[String]$Arguments,
[Parameter(Mandatory=$True)]
[String]$WorkingDirectory
)
$pinfo = New-Object System.Diagnostics.ProcessStartInfo;
$pinfo.FileName = $RuntimePath;
$pinfo.RedirectStandardOutput = $true;
$pinfo.UseShellExecute = $false;
$pinfo.Arguments = $Arguments;
$pinfo.WorkingDirectory = $WorkingDirectory;
$p = New-Object System.Diagnostics.Process;
$p.StartInfo = $pinfo;
$p.Start() | Out-Null;
$p.WaitForExit();
Return New-Object PSObject -Property @{
RuntimePath = [String]$RuntimePath;
Arguments = [String]$Arguments;
WorkingDirectory = [String]$WorkingDirectory;
Output = [String]$p.StandardOutput.ReadToEnd();
ExitCode = [int]$p.ExitCode;
};
}
[PSObject[]]$global:failed = @();
$global:WorkingDirectory = (pwd).Path;
$dotnetPath = "C:\Program Files\dotnet\dotnet.exe";
$TestProjects |% {
[String]$arguments = "test";
[String]$currentWorkingDirectory = Join-Path $global:WorkingDirectory -ChildPath $_;
Write-Host "=========================================================";
Write-Host "== Executing tests";
Write-Host "== Working Folder: $currentWorkingDirectory";
Write-Host "== Runtime:$dotnetPath";
Write-Host "== Args:$arguments";
Write-Host "=========================================================";
$executeResult = Execute-DotnetProcess `
-RuntimePath $dotnetPath `
-Arguments $arguments `
-WorkingDirectory $currentWorkingDirectory;
Write-Host "Test process executed, ExitCode:$($executeResult.ExitCode)";
Write-Host "Output:";
Write-Host $executeResult.Output;
If ($executeResult.ExitCode -ne 0) {
$global:failed += $executeResult;
}
}
If ($global:failed.Count -gt 0) {
Throw "Test execution failed";
}