@@ -14,6 +14,16 @@ The blob feed for the .NET Core CLI. If not specified, it will determined automa
14
14
. PARAMETER RestoreSources
15
15
A list of additional NuGet feeds. If not specified, it will determined automatically if possible.
16
16
17
+ . PARAMETER TestRuntimeIdentifier
18
+ Filter the tests by which RID they publish for. If empty (default), tests are run for
19
+ * none (portable)
20
+ * osx-x64
21
+ * linux-x64
22
+ * win-x64
23
+
24
+ . PARAMETER HostRid
25
+ The RID of the platform running the tests. (Determined automatically if possible)
26
+
17
27
. PARAMETER ProdConManifestUrl
18
28
The prodcon build.xml file
19
29
26
36
$AssetRootUrl = $env: PB_AccessRootUrl ,
27
37
$AccessTokenSuffix = $env: PB_AccessTokenSuffix ,
28
38
$RestoreSources = $env: PB_RestoreSources ,
39
+ [ValidateSet (' none' , ' osx-x64' , ' linux-x64' , ' win-x64' )]
40
+ $TestRuntimeIdentifier ,
41
+ $HostRid ,
29
42
$ProdConManifestUrl ,
30
43
$ProcConChannel = ' release/2.2'
31
44
)
@@ -36,12 +49,40 @@ Set-StrictMode -Version 1
36
49
$repoRoot = Resolve-Path " $PSScriptRoot /../../"
37
50
Import-Module " $repoRoot /scripts/common.psm1" - Scope Local - Force
38
51
52
+ if (-not $HostRid ) {
53
+ if (Test-Path Variable:/ IsCoreCLR) {
54
+ $HostRid = if ($IsWindows ) { ' win-x64' } `
55
+ elseif ($IsLinux ) { ' linux-x64' } `
56
+ elseif ($IsMacOS ) { ' osx-x64' }
57
+ }
58
+ else {
59
+ $HostRid = ' win-x64'
60
+ }
61
+ }
62
+
63
+ if (-not $HostRid ) {
64
+ throw ' Could not determine which platform this script is running on. Add -HostRid $rid where $rid = the .NET Core SDK to install'
65
+ }
66
+
67
+ switch ($HostRid ) {
68
+ ' win-x64' {
69
+ $dotnetFileName = ' dotnet.exe'
70
+ $archiveExt = ' .zip'
71
+ }
72
+ default {
73
+ $dotnetFileName = ' dotnet'
74
+ $archiveExt = ' .tar.gz'
75
+ }
76
+ }
77
+
39
78
Push-Location $PSScriptRoot
40
79
try {
41
80
New-Item - Type Directory " $PSScriptRoot /obj/" - ErrorAction Ignore | Out-Null
42
81
$sdkVersion = ' '
43
82
44
83
if (-not $ci -or $ProdConManifestUrl ) {
84
+ # Workaround for pwsh 6 dumping progress info
85
+ $ProgressPreference = ' SilentlyContinue'
45
86
46
87
if (-not $ProdConManifestUrl ) {
47
88
Write-Host - ForegroundColor Magenta " Running tests for the latest ProdCon build"
@@ -76,14 +117,21 @@ try {
76
117
@ { sdk = @ { version = $sdkVersion } } | ConvertTo-Json | Set-Content " $PSScriptRoot /global.json"
77
118
78
119
$dotnetRoot = " $repoRoot /.dotnet"
79
- $dotnet = " $dotnetRoot /dotnet.exe "
120
+ $dotnet = " $dotnetRoot /$dotnetFileName "
80
121
81
122
if (-not (Test-Path " $dotnetRoot /sdk/$sdkVersion /dotnet.dll" )) {
82
123
Remove-Item - Recurse - Force $dotnetRoot - ErrorAction Ignore | Out-Null
83
- $cliUrl = " $AssetRootUrl /Sdk/$sdkVersion /dotnet-sdk-$sdkVersion -win-x64.zip"
124
+ $cliUrl = " $AssetRootUrl /Sdk/$sdkVersion /dotnet-sdk-$sdkVersion -$HostRid$archiveExt "
125
+ $cliArchiveFile = " $PSScriptRoot /obj/dotnet$archiveExt "
84
126
Write-Host " Downloading $cliUrl "
85
- Invoke-WebRequest - UseBasicParsing " ${cliUrl}${AccessTokenSuffix} " - OutFile " $PSScriptRoot /obj/dotnet.zip"
86
- Expand-Archive " $PSScriptRoot /obj/dotnet.zip" - DestinationPath $dotnetRoot
127
+ Invoke-WebRequest - UseBasicParsing " ${cliUrl}${AccessTokenSuffix} " - OutFile $cliArchiveFile
128
+ if ($archiveExt -eq ' .zip' ) {
129
+ Expand-Archive $cliArchiveFile - DestinationPath $dotnetRoot
130
+ }
131
+ else {
132
+ New-Item - Type Directory $dotnetRoot - ErrorAction Ignore | Out-Null
133
+ Invoke-Block { & tar xzf $cliArchiveFile - C $dotnetRoot }
134
+ }
87
135
}
88
136
89
137
# Set a clean test environment
@@ -96,11 +144,18 @@ try {
96
144
# Required by the tests. It is assumed packages on this feed will end up on nuget.org
97
145
$env: NUGET_PACKAGE_SOURCE = $RestoreSources
98
146
147
+ [string []] $filterArgs = @ ()
148
+
149
+ if ($TestRuntimeIdentifier ) {
150
+ $filterArgs += ' --filter' , " rid: $TestRuntimeIdentifier "
151
+ }
152
+
99
153
Invoke-Block { & $dotnet test `
100
154
-- logger " console;verbosity=detailed" `
101
155
-- logger " trx;LogFileName=$repoRoot /artifacts/logs/e2etests.trx" `
102
156
" -p:DotNetRestoreSources=$RestoreSources " `
103
- " -bl:$repoRoot /artifacts/logs/e2etests.binlog" }
157
+ " -bl:$repoRoot /artifacts/logs/e2etests.binlog" `
158
+ @filterArgs }
104
159
}
105
160
finally {
106
161
Pop-Location
0 commit comments