forked from shanepowell/DbgHelpUtils
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRunAllBuildHeapDumpTests.ps1
87 lines (75 loc) · 3.66 KB
/
RunAllBuildHeapDumpTests.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
Param
(
[ValidateSet("vs2019", "vs2022")][string]$Compiler = "vs2022",
[string] $ResultFile,
[switch] $CheckOnly,
[switch] $GenerateHeapLogs,
[switch] $LastReport,
[int] $ConcurrentLimit = 0,
[switch] $Verbose,
[switch] $ExitOnFailure
)
Function Test-Admin {
$currentUser = New-Object Security.Principal.WindowsPrincipal $([Security.Principal.WindowsIdentity]::GetCurrent())
$currentUser.IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator)
}
if($Verbose)
{
$VerbosePreference = "continue"
}
if (!$CheckOnly -and (Test-Admin) -eq $false)
{
Write-Host "This script can only be run with Administrator"
exit
}
if(!$ResultFile)
{
$compilerResultsFile = @{
"vs2019" = "ReportVs2019.log";
"vs2022" = "ReportVs2022.log";
}
$ResultFile = $compilerResultsFile[$Compiler]
}
if(!$LastReport)
{
Remove-Item $ResultFile -ErrorAction:SilentlyContinue | Out-Null
# run release / x64
Write-Host "Running $Compiler Release x64 tests"
Write-Verbose "Command: \RunHeapDumpTests.ps1 -TestX86:`$false -TestDebug:`$false -CheckOnly:`$$CheckOnly -GenerateHeapLogs:`$$GenerateHeapLogs -Verbose:`$$Verbose -ResultFile:$ResultFile -Compiler:$Compiler -ExitOnFailure:`$$ExitOnFailure -ConcurrentLimit:$ConcurrentLimit"
.\RunHeapDumpTests.ps1 -TestX86:$false -TestDebug:$false -CheckOnly:$CheckOnly -GenerateHeapLogs:$GenerateHeapLogs -Verbose:$Verbose -ResultFile:$ResultFile -Compiler:$Compiler -ExitOnFailure:$ExitOnFailure -ConcurrentLimit:$ConcurrentLimit
# run release / x86
Write-Host "Running $Compiler Release x86 tests"
Write-Verbose "Command: \RunHeapDumpTests.ps1 -TestX86:`$true -TestDebug:`$false -CheckOnly:`$$CheckOnly -GenerateHeapLogs:`$$GenerateHeapLogs -Verbose:`$$Verbose -ResultFile:$ResultFile -Compiler:$Compiler -ExitOnFailure:`$$ExitOnFailure -ConcurrentLimit:$ConcurrentLimit"
.\RunHeapDumpTests.ps1 -TestX86:$true -TestDebug:$false -CheckOnly:$CheckOnly -GenerateHeapLogs:$GenerateHeapLogs -Verbose:$Verbose -ResultFile:$ResultFile -Compiler:$Compiler -ExitOnFailure:$ExitOnFailure -ConcurrentLimit:$ConcurrentLimit
# run debug / x64
Write-Host "Running $Compiler Debug x64 tests"
Write-Verbose "Command: \RunHeapDumpTests.ps1 -TestX86:`$false -TestDebug:`$true -CheckOnly:`$$CheckOnly -GenerateHeapLogs:`$$GenerateHeapLogs -Verbose:`$$Verbose -ResultFile:$ResultFile -Compiler:$Compiler -ExitOnFailure:`$$ExitOnFailure -ConcurrentLimit:$ConcurrentLimit"
.\RunHeapDumpTests.ps1 -TestX86:$false -TestDebug:$true -CheckOnly:$CheckOnly -GenerateHeapLogs:$GenerateHeapLogs -Verbose:$Verbose -ResultFile:$ResultFile -Compiler:$Compiler -ExitOnFailure:$ExitOnFailure -ConcurrentLimit:$ConcurrentLimit
# run debug / x86
Write-Host "Running $Compiler Debug x86 tests"
Write-Verbose "Command: \RunHeapDumpTests.ps1 -TestX86:`$true -TestDebug:`$true -CheckOnly:`$$CheckOnly -GenerateHeapLogs:`$$GenerateHeapLogs -Verbose:`$$Verbose -ResultFile:$ResultFile -Compiler:$Compiler -ExitOnFailure:`$$ExitOnFailure -ConcurrentLimit:$ConcurrentLimit"
.\RunHeapDumpTests.ps1 -TestX86:$true -TestDebug:$true -CheckOnly:$CheckOnly -GenerateHeapLogs:$GenerateHeapLogs -Verbose:$Verbose -ResultFile:$ResultFile -Compiler:$Compiler -ExitOnFailure:$ExitOnFailure -ConcurrentLimit:$ConcurrentLimit
}
$errorLines = ""
$log = Get-Content $ResultFile
foreach ($line in $log)
{
if ($line -like "ERROR:*")
{
if($errorLines)
{
$errorLines += "`n"
}
$errorLines += $line
}
}
if($errorLines)
{
Write-Host "Complete with Errors:"
Write-Host $errorLines
Write-Host "Completed with Errors"
}
else
{
Write-Host "Successful Complete"
}