Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 48 additions & 4 deletions eng/verify-nupkgs.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ Param(
[string] $configuration,

[Parameter(Mandatory)]
[string] $versionPrefix
[string] $versionPrefix,

[Parameter(Mandatory)]
[string] $currentBranch
)

$ErrorActionPreference = 'Stop'
Expand All @@ -16,13 +19,13 @@ function Verify-Nuget-Packages {
$expectedNumOfFiles = @{
"Microsoft.CodeCoverage" = 59;
"Microsoft.NET.Test.Sdk" = 16;
"Microsoft.TestPlatform" = 607;
"Microsoft.TestPlatform" = 606;
"Microsoft.TestPlatform.Build" = 21;
"Microsoft.TestPlatform.CLI" = 472;
"Microsoft.TestPlatform.CLI" = 471;
"Microsoft.TestPlatform.Extensions.TrxLogger" = 35;
"Microsoft.TestPlatform.ObjectModel" = 93;
"Microsoft.TestPlatform.AdapterUtilities" = 34;
"Microsoft.TestPlatform.Portable" = 595;
"Microsoft.TestPlatform.Portable" = 592;
"Microsoft.TestPlatform.TestHost" = 63;
"Microsoft.TestPlatform.TranslationLayer" = 123;
"Microsoft.TestPlatform.Internal.Uwp" = 39;
Expand Down Expand Up @@ -89,6 +92,10 @@ function Verify-Nuget-Packages {
if ($expectedNumOfFiles[$packageKey] -ne $actualNumOfFiles) {
$errors += "Number of files are not equal for '$packageBaseName', expected: $($expectedNumOfFiles[$packageKey]) actual: $actualNumOfFiles"
}

if ($packageKey -eq "Microsoft.TestPlatform") {
Verify-Version -nugetDir $unzipNugetPackageDir -errors $errors
}
}
finally {
if ($null -ne $unzipNugetPackageDir -and (Test-Path $unzipNugetPackageDir)) {
Expand All @@ -112,4 +119,41 @@ function Unzip {
[System.IO.Compression.ZipFile]::ExtractToDirectory($zipfile, $outpath)
}

function Match-VersionAgainstBranch {
param ([string]$vsTestVersion, [string]$branchName, [string[]]$errors)

# Output useful info.
Write-Host "VSTest Product Version: `"$vsTestVersion`""
Write-Host "Current Branch: `"$branchName`""

$versionIsRTM = $vsTestVersion -match "^\d+\.\d+\.\d+$"
$versionIsRelease = $vsTestVersion -match "^\d+\.\d+\.\d+\-release\-\d{8}\-\d{2}$"
$versionIsPreview = $vsTestVersion -match "^\d+\.\d+\.\d+\-preview\-\d{8}\-\d{2}$"

$isReleaseBranch = $branchName -like "rel/*"
$isPreviewBranch = $branchName -like "main"

if (!$isReleaseBranch -and !$isPreviewBranch) {
Write-Host "Skipping check since branch is neither `"release`" nor `"preview`""
return
}

Write-Host "Matching branch against product version ... "
if ($isReleaseBranch -and !$versionIsRTM -and !$versionIsRelease) {
$errors += "Release version `"$vsTestVersion`" should either be RTM, or contain a `"release`" suffix."
}
if ($isPreviewBranch -and !$versionIsPreview) {
$errors += "Preview version `"$vsTestVersion`" should contain a `"preview`" suffix."
}
}

function Verify-Version {
param ([string]$nugetDir, [string[]] $errors)

$vsTestExe = "$nugetDir/tools/net462/Common7/IDE/Extensions/TestPlatform/vstest.console.exe"
$vsTestProductVersion = (Get-Item $vsTestExe).VersionInfo.ProductVersion

Match-VersionAgainstBranch -vsTestVersion $vsTestProductVersion -branchName $currentBranch -errors $errors
}

Verify-Nuget-Packages
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
<file src="$TesthostRuntimeconfig$\testhost-5.0.runtimeconfig.json" target="contentFiles\any\netcoreapp3.1" />
<file src="$TesthostRuntimeconfig$\testhost-6.0.runtimeconfig.json" target="contentFiles\any\netcoreapp3.1" />
<file src="$TesthostRuntimeconfig$\testhost-7.0.runtimeconfig.json" target="contentFiles\any\netcoreapp3.1" />
<file src="$TesthostRuntimeconfig$\testhost-8.0.runtimeconfig.json" target="contentFiles\any\netcoreapp3.1" />
<file src="$TesthostRuntimeconfig$\testhost-latest.runtimeconfig.json" target="contentFiles\any\netcoreapp3.1" />
<file src="netcoreapp3.1\testhost.dll" target="contentFiles\any\netcoreapp3.1" />
<file src="netcoreapp3.1\testhost.deps.json" target="contentFiles\any\netcoreapp3.1" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
<file src="$TesthostRuntimeconfig$\testhost-5.0.runtimeconfig.json" target="contentFiles\any\$SourceBuildTfm$" />
<file src="$TesthostRuntimeconfig$\testhost-6.0.runtimeconfig.json" target="contentFiles\any\$SourceBuildTfm$" />
<file src="$TesthostRuntimeconfig$\testhost-7.0.runtimeconfig.json" target="contentFiles\any\$SourceBuildTfm$" />
<file src="$TesthostRuntimeconfig$\testhost-8.0.runtimeconfig.json" target="contentFiles\any\$SourceBuildTfm$" />
<file src="$TesthostRuntimeconfig$\testhost-latest.runtimeconfig.json" target="contentFiles\any\$SourceBuildTfm$" />
<file src="$SourceBuildTfm$\testhost.dll" target="contentFiles\any\$SourceBuildTfm$" />
<file src="$SourceBuildTfm$\testhost.deps.json" target="contentFiles\any\$SourceBuildTfm$" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,7 @@
<file src="$TesthostRuntimeconfig$\testhost-5.0.runtimeconfig.json" target="tools\net462\Common7\IDE\Extensions\TestPlatform\TestHostNet\testhost-5.0.runtimeconfig.json" />
<file src="$TesthostRuntimeconfig$\testhost-6.0.runtimeconfig.json" target="tools\net462\Common7\IDE\Extensions\TestPlatform\TestHostNet\testhost-6.0.runtimeconfig.json" />
<file src="$TesthostRuntimeconfig$\testhost-7.0.runtimeconfig.json" target="tools\net462\Common7\IDE\Extensions\TestPlatform\TestHostNet\testhost-7.0.runtimeconfig.json" />
<file src="$TesthostRuntimeconfig$\testhost-8.0.runtimeconfig.json" target="tools\net462\Common7\IDE\Extensions\TestPlatform\TestHostNet\testhost-8.0.runtimeconfig.json" />
<file src="$TesthostRuntimeconfig$\testhost-latest.runtimeconfig.json" target="tools\net462\Common7\IDE\Extensions\TestPlatform\TestHostNet\testhost-latest.runtimeconfig.json" />
<file src="netcoreapp3.1\testhost.deps.json" target="tools\net462\Common7\IDE\Extensions\TestPlatform\TestHostNet\testhost.deps.json" />
<file src="netcoreapp3.1\testhost.dll" target="tools\net462\Common7\IDE\Extensions\TestPlatform\TestHostNet\testhost.dll" />
Expand Down
9 changes: 9 additions & 0 deletions temp/testhost/testhost-8.0.runtimeconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"runtimeOptions": {
"tfm": "net8.0",
"framework": {
"name": "Microsoft.NETCore.App",
"version": "8.0.0-preview.0"
}
}
}