Skip to content

Commit

Permalink
Bumped the Test Platform version to 16.10.0-preview-20210211-01. (#770
Browse files Browse the repository at this point in the history
)
  • Loading branch information
Haplois authored Feb 16, 2021
1 parent f55dc39 commit 2be41ed
Show file tree
Hide file tree
Showing 16 changed files with 200 additions and 84 deletions.
40 changes: 40 additions & 0 deletions Localize/LocProject.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"Projects": [
{
"LanguageSet": "VS_Main_Languages",
"LocItems": [
{
"SourceFile": "src\\Adapter\\MSTest.CoreAdapter\\Resources\\xlf\\Resource.xlf",
"Languages": "",
"CopyOption": "LangIDOnName",
"OutputPath": "src\\Adapter\\MSTest.CoreAdapter\\Resources\\xlf\\",
"LclFile": "Localize\\lcl\\{Lang}\\src\\Adapter\\MSTest.CoreAdapter\\Resources\\xlf\\Resource.xlf.lcl"
}
]
},
{
"LanguageSet": "VS_Main_Languages",
"LocItems": [
{
"SourceFile": "src\\Adapter\\PlatformServices.Shared\\netstandard1.3\\Resources\\xlf\\Resource.xlf",
"Languages": "",
"CopyOption": "LangIDOnName",
"OutputPath": "src\\Adapter\\PlatformServices.Shared\\netstandard1.3\\Resources\\xlf\\",
"LclFile": "Localize\\lcl\\{Lang}\\src\\Adapter\\PlatformServices.Shared\\netstandard1.3\\Resources\\xlf\\Resource.xlf.lcl"
}
]
},
{
"LanguageSet": "VS_Main_Languages",
"LocItems": [
{
"SourceFile": "src\\TestFramework\\MSTest.Core\\Resources\\xlf\\FrameworkMessages.xlf",
"Languages": "",
"CopyOption": "LangIDOnName",
"OutputPath": "src\\TestFramework\\MSTest.Core\\Resources\\xlf\\",
"LclFile": "Localize\\lcl\\{Lang}\\src\\TestFramework\\MSTest.Core\\Resources\\xlf\\FrameworkMessages.xlf.lcl"
}
]
}
]
}
2 changes: 1 addition & 1 deletion scripts/build/TestFx.Versions.targets
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<TestPlatformVersion Condition=" '$(TestPlatformVersion)' == '' ">16.10.0-preview-20210204-01</TestPlatformVersion>
<TestPlatformVersion Condition=" '$(TestPlatformVersion)' == '' ">16.10.0-preview-20210211-01</TestPlatformVersion>
<MinimumVisualStudioVersion>11.0</MinimumVisualStudioVersion>
</PropertyGroup>
</Project>
62 changes: 62 additions & 0 deletions scripts/common.lib.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -175,3 +175,65 @@ function Write-Log ([string] $message, $messageColor = "Green") {
}
$Host.UI.RawUI.ForegroundColor = $currentColor
}

function Install-DotNetCli
{
Write-Log "Install-DotNetCli: Get dotnet-install.ps1 script..."
$dotnetInstallRemoteScript = "https://raw.githubusercontent.com/dotnet/cli/master/scripts/obtain/dotnet-install.ps1"
$dotnetInstallScript = Join-Path $env:TF_TOOLS_DIR "dotnet-install.ps1"
if (-not (Test-Path $env:TF_TOOLS_DIR)) {
New-Item $env:TF_TOOLS_DIR -Type Directory | Out-Null
}

$dotnet_dir= Join-Path $env:TF_TOOLS_DIR "dotnet"

if (-not (Test-Path $dotnet_dir)) {
New-Item $dotnet_dir -Type Directory | Out-Null
}

(New-Object System.Net.WebClient).DownloadFile($dotnetInstallRemoteScript, $dotnetInstallScript)

if (-not (Test-Path $dotnetInstallScript)) {
Write-Error "Failed to download dotnet install script."
}

Unblock-File $dotnetInstallScript

Write-Log "Install-DotNetCli: Get the latest dotnet cli toolset..."
$dotnetInstallPath = Join-Path $env:TF_TOOLS_DIR "dotnet"
New-Item -ItemType directory -Path $dotnetInstallPath -Force | Out-Null
& $dotnetInstallScript -Channel "master" -InstallDir $dotnetInstallPath -Version $env:DOTNET_CLI_VERSION

& $dotnetInstallScript -InstallDir "$dotnetInstallPath" -Runtime 'dotnet' -Version '2.1.0' -Channel '2.1.0' -Architecture x64 -NoPath
$env:DOTNET_ROOT= $dotnetInstallPath

& $dotnetInstallScript -InstallDir "${dotnetInstallPath}_x86" -Runtime 'dotnet' -Version '2.1.0' -Channel '2.1.0' -Architecture x86 -NoPath
${env:DOTNET_ROOT(x86)} = "${dotnetInstallPath}_x86"

& $dotnetInstallScript -InstallDir "$dotnetInstallPath" -Runtime 'dotnet' -Version '3.1.0' -Channel '3.1.0' -Architecture x64 -NoPath
$env:DOTNET_ROOT= $dotnetInstallPath

& $dotnetInstallScript -InstallDir "${dotnetInstallPath}_x86" -Runtime 'dotnet' -Version '3.1.0' -Channel '3.1.0' -Architecture x86 -NoPath
${env:DOTNET_ROOT(x86)} = "${dotnetInstallPath}_x86"

& $dotnetInstallScript -InstallDir "$dotnetInstallPath" -Runtime 'dotnet' -Version '5.0.1' -Channel '5.0.1' -Architecture x64 -NoPath
$env:DOTNET_ROOT= $dotnetInstallPath

& $dotnetInstallScript -InstallDir "${dotnetInstallPath}_x86" -Runtime 'dotnet' -Version '5.0.1' -Channel '5.0.1' -Architecture x86 -NoPath
${env:DOTNET_ROOT(x86)} = "${dotnetInstallPath}_x86"

$env:DOTNET_MULTILEVEL_LOOKUP=0

"---- dotnet environment variables"
Get-ChildItem "Env:\dotnet_*"

"`n`n---- x64 dotnet"
& "$env:DOTNET_ROOT\dotnet.exe" --info

"`n`n---- x86 dotnet"
# avoid erroring out because we don't have the sdk for x86 that global.json requires
try {
& "${env:DOTNET_ROOT(x86)}\dotnet.exe" --info 2> $null
} catch {}
Write-Log "Install-DotNetCli: Complete."
}
147 changes: 78 additions & 69 deletions scripts/test.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,25 @@ Param(
[Switch] $Help = $false
)

. $PSScriptRoot\common.lib.ps1

#
# Script Preferences
#
$ErrorActionPreference = "Stop"

$CurrentScriptDir = (Get-Item (Split-Path $MyInvocation.MyCommand.Path))

#
# Variables
#
$env:TF_ROOT_DIR = $CurrentScriptDir.Parent.FullName
$env:TF_TOOLS_DIR = Join-Path $env:TF_ROOT_DIR "tools"
$env:DOTNET_CLI_VERSION = "6.0.100-alpha.1.21067.8"
$env:TF_TESTS_OUTDIR_PATTERN = "*.Tests"
$env:TF_UNITTEST_FILES_PATTERN = "*.UnitTests*.dll"
$env:TF_COMPONENTTEST_FILES_PATTERN = "*.ComponentTests*.dll"
$env:TF_E2ETEST_FILES_PATTERN = "*.E2ETests*.dll"
$env:TF_NetCoreContainers =@("MSTestAdapter.PlatformServices.NetCore.UnitTests.dll")

#
# Test configuration
#
Expand All @@ -49,7 +53,9 @@ $TFT_Configuration = $Configuration
$TFT_Pattern = $Pattern
$TFT_Parallel = $Parallel
$TFT_All = $All
$TestFramework = ".NETCoreApp,Version=v2.1"
$TestFramework = ".NETCoreApp2.1"

. $PSScriptRoot\common.lib.ps1

#
# Prints help text for the switches this script supports.
Expand All @@ -75,52 +81,54 @@ function Print-Help {

function Invoke-Test
{
& dotnet --info

$timer = Start-Timer

Write-Log "Run-Test: Started."
Write-Log " Computing Test Containers."
# Get all the test project folders. They should all be ending with ".Tests"
$outDir = Join-Path $env:TF_OUT_DIR -ChildPath $TFT_Configuration
$testFolders = Get-ChildItem $outDir -Directory -Filter $env:TF_TESTS_OUTDIR_PATTERN | %{$_.FullName}
$outDir = Join-Path $env:TF_OUT_DIR -ChildPath $TFT_Configuration
$testFolders = Get-ChildItem $outDir -Directory -Filter $env:TF_TESTS_OUTDIR_PATTERN | %{$_.FullName}

# Get test assemblies from these folders that match the pattern specified.
foreach($container in $testFolders)
{
$testContainer = Get-ChildItem $container\* -Recurse -Include $env:TF_UNITTEST_FILES_PATTERN, $env:TF_COMPONENTTEST_FILES_PATTERN, $env:TF_E2ETEST_FILES_PATTERN
foreach($container in $testFolders)
{
$testContainer = Get-ChildItem $container\* -Recurse -Include $env:TF_UNITTEST_FILES_PATTERN, $env:TF_COMPONENTTEST_FILES_PATTERN, $env:TF_E2ETEST_FILES_PATTERN
$testContainerName = $testContainer.Name
$testContainerPath = $testContainer.FullName
$allContainers += ,"$testContainerName"

if($TFT_All)
{
if($env:TF_NetCoreContainers -Contains $testContainerName)
{
$netCoreTestContainers += ,"$testContainerPath"
}
else
{
$testContainers += ,"$testContainerPath"
}
if($env:TF_NetCoreContainers -Contains $testContainerName)
{
$netCoreTestContainers += ,"$testContainerPath"
}
else
{
$testContainers += ,"$testContainerPath"
}
}
else
{
if($testContainerPath -match $TFT_Pattern)
{
if($env:TF_NetCoreContainers -Contains $testContainerName)
{
$netCoreTestContainers += ,"$testContainerPath"

}
else
{
$testContainers += ,"$testContainerPath"
}
if($env:TF_NetCoreContainers -Contains $testContainerName)
{
$netCoreTestContainers += ,"$testContainerPath"

}
else
{
$testContainers += ,"$testContainerPath"
}
}
}
}
}
if($testContainers.Count -gt 0 -Or $netCoreTestContainers.Count -gt 0)
{
$testContainersString = [system.String]::Join(",",$testContainers)
Expand All @@ -133,8 +141,8 @@ function Invoke-Test
Write-Log " None of the test containers matched the pattern $TFT_Pattern."
Write-Log " Test Containers available: $allContainersString."
}
Write-Log "Run-Test: Complete. {$(Get-ElapsedTime($timer))}"
Write-Log "Run-Test: Complete. {$(Get-ElapsedTime($timer))}"
}

function Run-Test([string[]] $testContainers, [string[]] $netCoreTestContainers)
Expand All @@ -146,52 +154,53 @@ function Run-Test([string[]] $testContainers, [string[]] $netCoreTestContainers)
{
$additionalArguments += "/parallel"
}
if($testContainers.Count -gt 0)
{
if(!(Test-Path $vstestPath))
{
Write-Error "Unable to find vstest.console.exe at $vstestPath. Test aborted."
}
Write-Verbose "$vstestPath $testContainers $additionalArguments /logger:trx"
& $vstestPath $testContainers $additionalArguments /logger:trx

if ($lastExitCode -ne 0)
{
throw "Tests failed."
}
}
if($netCoreTestContainers.Count -gt 0)
{
Try
{
Write-Verbose "dotnet test $netCoreTestContainers /framework:$TestFramework $additionalArguments /logger:trx"
& dotnet test $netCoreTestContainers /framework:$TestFramework $additionalArguments /logger:trx
}

Catch [System.Management.Automation.CommandNotFoundException]
{
Write-Error "Unable to find dotnet.exe. Test aborted."
}

if ($lastExitCode -ne 0)
{
throw "Tests failed."
}
}
if($testContainers.Count -gt 0)
{
if(!(Test-Path $vstestPath))
{
Write-Error "Unable to find vstest.console.exe at $vstestPath. Test aborted."
}
Write-Verbose "$vstestPath $testContainers $additionalArguments /logger:trx"
& $vstestPath $testContainers $additionalArguments /logger:trx

if ($lastExitCode -ne 0)
{
throw "Tests failed."
}
}
if($netCoreTestContainers.Count -gt 0)
{
Try
{
Write-Verbose "dotnet test $netCoreTestContainers /framework:`"$TestFramework`" $additionalArguments /logger:trx"
& dotnet test $netCoreTestContainers /framework:"$TestFramework" $additionalArguments /logger:trx
}

Catch [System.Management.Automation.CommandNotFoundException]
{
Write-Error "Unable to find dotnet.exe. Test aborted."
}

if ($lastExitCode -ne 0)
{
throw "Tests failed."
}
}
}

function Get-VSTestPath
{
$versionsFile = "$PSScriptRoot\build\TestFx.Versions.targets"
$TestPlatformVersion = (([XML](Get-Content $versionsFile)).Project.PropertyGroup.TestPlatformVersion).InnerText

$vsInstallPath = "$PSScriptRoot\..\packages\Microsoft.TestPlatform.$TestPlatformVersion\"
$vstestPath = Join-Path -path $vsInstallPath "tools\net451\Common7\IDE\Extensions\TestPlatform\vstest.console.exe"
return Resolve-Path -path $vstestPath
$vsInstallPath = "$PSScriptRoot\..\packages\Microsoft.TestPlatform.$TestPlatformVersion\"
$vstestPath = Join-Path -path $vsInstallPath "tools\net451\Common7\IDE\Extensions\TestPlatform\vstest.console.exe"
return Resolve-Path -path $vstestPath
}

Print-Help
Install-DotNetCli
Invoke-Test
2 changes: 1 addition & 1 deletion src/Adapter/PlatformServices.Desktop/packages.config
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="MicroBuild.Core" version="0.2.0" targetFramework="net451" developmentDependency="true" />
<package id="Microsoft.TestPlatform.ObjectModel" version="16.10.0-preview-20210204-01" targetFramework="net45" />
<package id="Microsoft.TestPlatform.ObjectModel" version="16.10.0-preview-20210211-01" targetFramework="net45" />
<package id="NuGet.Frameworks" version="5.0.0" targetFramework="net45" />
<package id="StyleCop.Analyzers" version="1.0.0" targetFramework="net45" developmentDependency="true" />
<package id="System.Collections.Immutable" version="1.5.0" targetFramework="net45" />
Expand Down
2 changes: 1 addition & 1 deletion src/Adapter/PlatformServices.Interface/packages.config
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="MicroBuild.Core" version="0.2.0" targetFramework="portable45-net45+win8+wp8+wpa81" developmentDependency="true" />
<package id="Microsoft.TestPlatform.ObjectModel" version="16.10.0-preview-20210204-01" targetFramework="portable45-net45+win8+wp8+wpa81" />
<package id="Microsoft.TestPlatform.ObjectModel" version="16.10.0-preview-20210211-01" targetFramework="portable45-net45+win8+wp8+wpa81" />
<package id="StyleCop.Analyzers" version="1.0.0" targetFramework="portable45-net45+win8+wp8+wpa81" developmentDependency="true" />
<package id="System.Collections" version="4.3.0" targetFramework="portable45-net45+win8+wp8+wpa81" />
<package id="System.ComponentModel" version="4.3.0" targetFramework="portable45-net45+win8+wp8+wpa81" />
Expand Down
2 changes: 1 addition & 1 deletion src/Adapter/PlatformServices.Portable/packages.config
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="MicroBuild.Core" version="0.2.0" targetFramework="portable45-net45+win8+wp8+wpa81" developmentDependency="true" />
<package id="Microsoft.TestPlatform.ObjectModel" version="16.10.0-preview-20210204-01" targetFramework="portable45-net45+win8+wp8+wpa81" />
<package id="Microsoft.TestPlatform.ObjectModel" version="16.10.0-preview-20210211-01" targetFramework="portable45-net45+win8+wp8+wpa81" />
<package id="StyleCop.Analyzers" version="1.0.0" targetFramework="portable45-net45+win8+wp8+wpa81" developmentDependency="true" />
<package id="System.Collections" version="4.3.0" targetFramework="portable45-net45+win8+wp8+wpa81" />
<package id="System.ComponentModel" version="4.3.0" targetFramework="portable45-net45+win8+wp8+wpa81" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Castle.Core" version="4.2.1" targetFramework="net451" />
<package id="Microsoft.TestPlatform.ObjectModel" version="16.10.0-preview-20210204-01" targetFramework="net451" />
<package id="Microsoft.TestPlatform.ObjectModel" version="16.10.0-preview-20210211-01" targetFramework="net451" />
<package id="Moq" version="4.8.2" targetFramework="net451" />
<package id="NuGet.Frameworks" version="5.0.0" targetFramework="net451" />
<package id="StyleCop.Analyzers" version="1.0.0" targetFramework="net451" developmentDependency="true" />
Expand Down
2 changes: 1 addition & 1 deletion test/E2ETests/Automation.CLI/CLITestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class CLITestBase
private const string PackagesFolder = "packages";

// This value is automatically updated by "build.ps1" script.
private const string TestPlatformCLIPackage = @"Microsoft.TestPlatform.16.10.0-preview-20210204-01";
private const string TestPlatformCLIPackage = @"Microsoft.TestPlatform.16.10.0-preview-20210211-01";
private const string VstestConsoleRelativePath = @"tools\net451\Common7\IDE\Extensions\TestPlatform\vstest.console.exe";

private static VsTestConsoleWrapper vsTestConsoleWrapper;
Expand Down
8 changes: 4 additions & 4 deletions test/E2ETests/Automation.CLI/packages.config
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.TestPlatform" version="16.10.0-preview-20210204-01" targetFramework="net46" />
<package id="Microsoft.TestPlatform.ObjectModel" version="16.10.0-preview-20210204-01" targetFramework="net46" />
<package id="Microsoft.TestPlatform.TranslationLayer" version="16.10.0-preview-20210204-01" targetFramework="net46" />
<package id="Microsoft.TestPlatform.AdapterUtilities" version="16.10.0-preview-20210204-01" targetFramework="net452" />
<package id="Microsoft.TestPlatform" version="16.10.0-preview-20210211-01" targetFramework="net46" />
<package id="Microsoft.TestPlatform.ObjectModel" version="16.10.0-preview-20210211-01" targetFramework="net46" />
<package id="Microsoft.TestPlatform.TranslationLayer" version="16.10.0-preview-20210211-01" targetFramework="net46" />
<package id="Microsoft.TestPlatform.AdapterUtilities" version="16.10.0-preview-20210211-01" targetFramework="net452" />
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net46" />
<package id="NuGet.Frameworks" version="5.0.0" targetFramework="net46" />
<package id="StyleCop.Analyzers" version="1.0.0" targetFramework="net46" developmentDependency="true" />
Expand Down
Loading

0 comments on commit 2be41ed

Please sign in to comment.