forked from microsoft/msquic
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.ps1
208 lines (159 loc) · 5.56 KB
/
test.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
<#
.SYNOPSIS
This script provides helpers for running executing the MsQuic tests.
.PARAMETER Config
Specifies the build configuration to test.
.PARAMETER Arch
The CPU architecture to test.
.PARAMETER Tls
The TLS library test.
.PARAMETER Filter
A filter to include test cases from the list to execute. Multiple filters
are separated by :. Negative filters are prefixed with -.
.PARAMETER ListTestCases
Lists all the test cases.
.PARAMETER ExecutionMode
Controls the execution mode when running each test case.
.PARAMETER IsolationMode
Controls the isolation mode when running each test case.
.PARAMETER KeepOutputOnSuccess
Don't discard console output or logs on success.
.PARAMETER GenerateXmlResults
Generates an xml Test report for the run.
.PARAMETER Debugger
Attaches the debugger to each test case run.
.PARAMETER InitialBreak
Debugger starts broken into the process to allow setting breakpoints, etc.
.PARAMETER BreakOnFailure
Triggers a break point on a test failure.
.PARAMETER LogProfile
The name of the profile to use for log collection.
.PARAMETER CompressOutput
Compresses the output files generated for failed test cases.
.PARAMETER NoProgress
Disables the progress bar.
.Parameter EnableAppVerifier
Enables all basic Application Verifier checks on test binaries.
.EXAMPLE
test.ps1
.EXAMPLE
test.ps1 -ListTestCases
.EXAMPLE
test.ps1 -ListTestCases -Filter ParameterValidation*
.EXAMPLE
test.ps1 -Filter ParameterValidation*
.EXAMPLE
test.ps1 -LogProfile Full.Light
.EXAMPLE
test.ps1 -LogProfile Full.Verbose -Compress
#>
param (
[Parameter(Mandatory = $false)]
[ValidateSet("Debug", "Release")]
[string]$Config = "Debug",
[Parameter(Mandatory = $false)]
[ValidateSet("x86", "x64", "arm", "arm64")]
[string]$Arch = "x64",
[Parameter(Mandatory = $false)]
[ValidateSet("schannel", "openssl", "stub", "mitls")]
[string]$Tls = "",
[Parameter(Mandatory = $false)]
[string]$Filter = "",
[Parameter(Mandatory = $false)]
[switch]$ListTestCases = $false,
[Parameter(Mandatory = $false)]
[ValidateSet("Serial", "Parallel")]
[string]$ExecutionMode = "Serial",
[Parameter(Mandatory = $false)]
[ValidateSet("Batch", "Isolated")]
[string]$IsolationMode = "Batch",
[Parameter(Mandatory = $false)]
[switch]$KeepOutputOnSuccess = $false,
[Parameter(Mandatory = $false)]
[switch]$GenerateXmlResults = $false,
[Parameter(Mandatory = $false)]
[switch]$Debugger = $false,
[Parameter(Mandatory = $false)]
[switch]$InitialBreak = $false,
[Parameter(Mandatory = $false)]
[switch]$BreakOnFailure = $false,
[Parameter(Mandatory = $false)]
[ValidateSet("None", "Basic.Light", "Basic.Verbose", "Full.Light", "Full.Verbose")]
[string]$LogProfile = "None",
[Parameter(Mandatory = $false)]
[switch]$CompressOutput = $false,
[Parameter(Mandatory = $false)]
[switch]$NoProgress = $false,
[Parameter(Mandatory = $false)]
[switch]$EnableAppVerifier = $false
)
Set-StrictMode -Version 'Latest'
$PSDefaultParameterValues['*:ErrorAction'] = 'Stop'
# Default TLS based on current platform.
if ("" -eq $Tls) {
if ($IsWindows) {
$Tls = "schannel"
} else {
$Tls = "openssl"
}
}
# Root directory of the project.
$RootDir = Split-Path $PSScriptRoot -Parent
# Path to the run-gtest Powershell script.
$RunTest = Join-Path $RootDir "scripts/run-gtest.ps1"
# Path to the msquictest exectuable.
$MsQuicTest = $null
$MsQuicCoreTest = $null
$MsQuicPlatTest = $null
if ($IsWindows) {
$MsQuicTest = Join-Path $RootDir "\artifacts\windows\$($Arch)_$($Config)_$($Tls)\msquictest.exe"
$MsQuicCoreTest = Join-Path $RootDir "\artifacts\windows\$($Arch)_$($Config)_$($Tls)\msquiccoretest.exe"
$MsQuicPlatTest = Join-Path $RootDir "\artifacts\windows\$($Arch)_$($Config)_$($Tls)\msquicplatformtest.exe"
} else {
$MsQuicTest = Join-Path $RootDir "/artifacts/linux/$($Arch)_$($Config)_$($Tls)/msquictest"
$MsQuicCoreTest = Join-Path $RootDir "/artifacts/linux/$($Arch)_$($Config)_$($Tls)/msquiccoretest"
$MsQuicPlatTest = Join-Path $RootDir "/artifacts/linux/$($Arch)_$($Config)_$($Tls)/msquicplatformtest"
}
# Make sure the build is present.
if (!(Test-Path $MsQuicTest)) {
Write-Error "Build does not exist!`n `nRun the following to generate it:`n `n $(Join-Path $RootDir "scripts" "build.ps1") -Config $Config -Arch $Arch -Tls $Tls`n"
}
# Build up all the arguments to pass to the Powershell script.
$TestArguments = "-ExecutionMode $($ExecutionMode) -IsolationMode $($IsolationMode)"
if ("" -ne $Filter) {
$TestArguments += " -Filter $($Filter)"
}
if ($ListTestCases) {
$TestArguments += " -ListTestCases"
}
if ($KeepOutputOnSuccess) {
$TestArguments += " -KeepOutputOnSuccess"
}
if ($GenerateXmlResults) {
$TestArguments += " -GenerateXmlResults"
}
if ($Debugger) {
$TestArguments += " -Debugger"
}
if ($InitialBreak) {
$TestArguments += " -InitialBreak"
}
if ($BreakOnFailure) {
$TestArguments += " -BreakOnFailure"
}
if ("None" -ne $LogProfile) {
$TestArguments += " -LogProfile $($LogProfile) -ConvertLogs"
}
if ($CompressOutput) {
$TestArguments += " -CompressOutput"
}
if ($NoProgress) {
$TestArguments += " -NoProgress"
}
if ($EnableAppVerifier) {
$TestArguments += " -EnableAppVerifier"
}
# Run the script.
Invoke-Expression ($RunTest + " -Path $($MsQuicCoreTest) " + $TestArguments)
Invoke-Expression ($RunTest + " -Path $($MsQuicPlatTest) " + $TestArguments)
Invoke-Expression ($RunTest + " -Path $($MsQuicTest) " + $TestArguments)