1 [CmdletBinding
(PositionalBinding
=$false)]
5 [string
]$corefxtests = "*",
6 [switch][Alias
('h')]$help
9 function Print-Usage
() {
10 Write-Host "Common settings:"
11 Write-Host " -fxversion Version passed to dotnet.exe"
12 Write-Host " -timeout Individual test timeout (default -1)"
13 Write-Host " -corefxtests CoreFx test to run, all or individual (defaul *)"
14 Write-Host " -help Print help and exit (short: -h)"
17 Write-Host "The above arguments can be shortened as much as to be unambiguous."
20 function RunCoreFxTest
($_netcore_version, $_timeout, $_testname, $_counter, $_tests_count) {
23 Write-Host "***************** $($_testname) $($_counter) / $($_tests_count) *********************"
24 Copy-Item -Path
"$PSScriptRoot\corefx\restore\corefx-restore.deps.json" -Destination
"$PSScriptRoot\corefx\tests\extracted\$_testname\$_testname.deps.json" -Force
25 Copy-Item -Path
"$PSScriptRoot\corefx\restore\corefx-restore.runtimeconfig.dev.json" -Destination
"$PSScriptRoot\corefx\tests\extracted\$_testname\$_testname.runtimeconfig.dev.json" -Force
26 Copy-Item -Path
"$PSScriptRoot\corefx\restore\corefx-restore.dll" -Destination
"$PSScriptRoot\corefx\tests\extracted\$_testname\corefx-restore.dll" -Force
27 (Get-Content "$PSScriptRoot\corefx\tests\extracted\$_testname\$_testname.runtimeconfig.json").replace
("""5.0.0""", """$_netcore_version""") | Set-Content "$PSScriptRoot\corefx\tests\extracted\$_testname\$_testname.runtimeconfig.json"
29 if ((Test-Path "$PSScriptRoot\corefx\tests\TestResult-$_testname.html" -PathType Leaf
)) {
30 Remove-Item -Path
"$PSScriptRoot\corefx\tests\TestResult-$_testname.html" -Force
33 if ((Test-Path "$PSScriptRoot\corefx\tests\TestResult-$_testname-netcore-xunit.xml" -PathType Leaf
)) {
34 Remove-Item -Path
"$PSScriptRoot\corefx\tests\TestResult-$_testname-netcore-xunit.xml" -Force
37 $_process_path = "$PSScriptRoot\dotnet.exe"
38 $_argument_list = "exec"
39 $_argument_list = $_argument_list + " --runtimeconfig $_testname.runtimeconfig.json"
40 $_argument_list = $_argument_list + " --additional-deps $_testname.deps.json"
41 $_argument_list = $_argument_list + " --fx-version ""$_netcore_version"""
42 $_argument_list = $_argument_list + " xunit.console.dll $_testname.dll"
43 $_argument_list = $_argument_list + " -html ""$PSScriptRoot\corefx\tests\TestResult-$_testname.html"""
44 $_argument_list = $_argument_list + " -xml ""$PSScriptRoot\corefx\tests\TestResult-$_testname-netcore-xunit.xml"""
45 $_argument_list = $_argument_list + " -notrait category=nonwindowstests ""@$PSScriptRoot\CoreFX.issues_windows.rsp"" ""@$PSScriptRoot\CoreFX.issues.rsp"""
47 $_process = Start-Process
-filePath
$_process_path -ArgumentList
$_argument_list -workingdirectory
"$PSScriptRoot\corefx\tests\extracted\$_testname" -PassThru
-NoNewWindow
48 if ($_timeout -eq
-1) {
49 Wait-Process
-InputObject
$_process
51 Wait-Process
-InputObject
$_process -Timeout
$_timeout -ErrorAction SilentlyContinue
-ErrorVariable _process_error
53 if ($_process_error) {
55 Write-Host "Error running $_testname, timeout"
60 $_process_exit = $_process.ExitCode
61 if ($_process_exit -ne
0) {
62 Write-Host "Error running $_testname, ExitCode=$($_process_exit)"
66 # Check for xunit XML file, if missing, treat as failure.
67 if (-Not
(Test-Path "$PSScriptRoot\corefx\tests\TestResult-$_testname-netcore-xunit.xml" -PathType Leaf
)) {
68 Write-Host "Error running $_testname, missing xunit XML file"
81 if ($corefxtests -eq
"*") {
82 if ((Test-Path "$PSScriptRoot\.failures" -PathType Leaf
)) {
83 Remove-Item -Path
"$PSScriptRoot\.failures" -Force
86 $tests = Get-ChildItem "$PSScriptRoot\corefx\tests\extracted\"
87 $tests_count = $tests.Count
89 for
($i=0; $i -lt
$tests_count; $i++) {
91 $testname=$tests[$i].Name
93 $result = RunCoreFxTest
$fxversion $timeout $testname $counter $tests_count
95 Add-Content -Path
"$PSScriptRoot\.failures" -Value
"$testname"
99 if (Get-Command "python.exe" -ErrorAction SilentlyContinue
) {
100 python
.exe
"$PSScriptRoot\xunit-summary.py" "$PSScriptRoot\corefx\tests"
102 Write-Host "Couldn't locate python.exe, skiping xunit-summary.py"
104 if ((Test-Path "$PSScriptRoot\.failures" -PathType Leaf
)) {
106 Write-Host "Failures in test suites:"
107 type "$PSScriptRoot\.failures"
112 if (-Not
(Test-Path "$PSScriptRoot\corefx\tests\extracted\$corefxtests" -PathType Container
)) {
113 Write-Host "Uknown test: $corefxtests"
116 $exit_code = RunCoreFxTest
$fxversion $timeout $corefxtests 1 1