diff --git a/Localize/LocProject.json b/Localize/LocProject.json new file mode 100644 index 0000000000..d9dcd328b8 --- /dev/null +++ b/Localize/LocProject.json @@ -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" + } + ] + } + ] +} diff --git a/scripts/build/TestFx.Versions.targets b/scripts/build/TestFx.Versions.targets index 2df000b88e..158a3facb9 100644 --- a/scripts/build/TestFx.Versions.targets +++ b/scripts/build/TestFx.Versions.targets @@ -1,7 +1,7 @@  - 16.10.0-preview-20210204-01 + 16.10.0-preview-20210211-01 11.0 \ No newline at end of file diff --git a/scripts/common.lib.ps1 b/scripts/common.lib.ps1 index 0e68a493ce..213eae1fe1 100644 --- a/scripts/common.lib.ps1 +++ b/scripts/common.lib.ps1 @@ -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." +} \ No newline at end of file diff --git a/scripts/test.ps1 b/scripts/test.ps1 index ab92c794d5..cdf2239303 100644 --- a/scripts/test.ps1 +++ b/scripts/test.ps1 @@ -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 # @@ -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. @@ -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) @@ -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) @@ -146,41 +154,41 @@ 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 @@ -188,10 +196,11 @@ 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 diff --git a/src/Adapter/PlatformServices.Desktop/packages.config b/src/Adapter/PlatformServices.Desktop/packages.config index 61e7ce1485..bb9a0947bc 100644 --- a/src/Adapter/PlatformServices.Desktop/packages.config +++ b/src/Adapter/PlatformServices.Desktop/packages.config @@ -1,7 +1,7 @@  - + diff --git a/src/Adapter/PlatformServices.Interface/packages.config b/src/Adapter/PlatformServices.Interface/packages.config index a67d602862..c9a95a65ba 100644 --- a/src/Adapter/PlatformServices.Interface/packages.config +++ b/src/Adapter/PlatformServices.Interface/packages.config @@ -1,7 +1,7 @@  - + diff --git a/src/Adapter/PlatformServices.Portable/packages.config b/src/Adapter/PlatformServices.Portable/packages.config index a67d602862..c9a95a65ba 100644 --- a/src/Adapter/PlatformServices.Portable/packages.config +++ b/src/Adapter/PlatformServices.Portable/packages.config @@ -1,7 +1,7 @@  - + diff --git a/test/ComponentTests/PlatformServices.Desktop.Component.Tests/packages.config b/test/ComponentTests/PlatformServices.Desktop.Component.Tests/packages.config index 06268e3a20..824ad62088 100644 --- a/test/ComponentTests/PlatformServices.Desktop.Component.Tests/packages.config +++ b/test/ComponentTests/PlatformServices.Desktop.Component.Tests/packages.config @@ -1,7 +1,7 @@  - + diff --git a/test/E2ETests/Automation.CLI/CLITestBase.cs b/test/E2ETests/Automation.CLI/CLITestBase.cs index 366e3fded6..4078eccfd2 100644 --- a/test/E2ETests/Automation.CLI/CLITestBase.cs +++ b/test/E2ETests/Automation.CLI/CLITestBase.cs @@ -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; diff --git a/test/E2ETests/Automation.CLI/packages.config b/test/E2ETests/Automation.CLI/packages.config index 074c34dd6b..6397bcbbf1 100644 --- a/test/E2ETests/Automation.CLI/packages.config +++ b/test/E2ETests/Automation.CLI/packages.config @@ -1,9 +1,9 @@  - - - - + + + + diff --git a/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/packages.config b/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/packages.config index 3ac937af7a..a3c4f1ee6e 100644 --- a/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/packages.config +++ b/test/UnitTests/MSTest.CoreAdapter.Unit.Tests/packages.config @@ -2,8 +2,8 @@ - - + + diff --git a/test/UnitTests/PlatformServices.Desktop.Unit.Tests/packages.config b/test/UnitTests/PlatformServices.Desktop.Unit.Tests/packages.config index 421493bc6b..dd85edb4a4 100644 --- a/test/UnitTests/PlatformServices.Desktop.Unit.Tests/packages.config +++ b/test/UnitTests/PlatformServices.Desktop.Unit.Tests/packages.config @@ -1,7 +1,7 @@  - + diff --git a/test/UnitTests/PlatformServices.NetCore.Unit.Tests/PlatformServices.NetCore.Unit.Tests.csproj b/test/UnitTests/PlatformServices.NetCore.Unit.Tests/PlatformServices.NetCore.Unit.Tests.csproj index 1977e37729..24dfdede8a 100644 --- a/test/UnitTests/PlatformServices.NetCore.Unit.Tests/PlatformServices.NetCore.Unit.Tests.csproj +++ b/test/UnitTests/PlatformServices.NetCore.Unit.Tests/PlatformServices.NetCore.Unit.Tests.csproj @@ -39,6 +39,7 @@ + diff --git a/test/UnitTests/PlatformServices.Portable.Unit.Tests/packages.config b/test/UnitTests/PlatformServices.Portable.Unit.Tests/packages.config index 55be081f8f..1ca2ed3739 100644 --- a/test/UnitTests/PlatformServices.Portable.Unit.Tests/packages.config +++ b/test/UnitTests/PlatformServices.Portable.Unit.Tests/packages.config @@ -1,7 +1,7 @@  - + diff --git a/test/UnitTests/PlatformServices.Universal.Unit.Tests/PlatformServices.Universal.Unit.Tests.csproj b/test/UnitTests/PlatformServices.Universal.Unit.Tests/PlatformServices.Universal.Unit.Tests.csproj index 90b2cc525c..61f57ff3f6 100644 --- a/test/UnitTests/PlatformServices.Universal.Unit.Tests/PlatformServices.Universal.Unit.Tests.csproj +++ b/test/UnitTests/PlatformServices.Universal.Unit.Tests/PlatformServices.Universal.Unit.Tests.csproj @@ -39,6 +39,9 @@ ..\..\..\packages\Castle.Core.4.0.0\lib\net45\Castle.Core.dll True + + ..\..\..\packages\Microsoft.TestPlatform.AdapterUtilities.$(TestPlatformVersion)\lib\uap10.0\Microsoft.TestPlatform.AdapterUtilities.dll + ..\..\..\packages\Microsoft.TestPlatform.ObjectModel.$(TestPlatformVersion)\lib\net451\Microsoft.TestPlatform.CoreUtilities.dll diff --git a/test/UnitTests/PlatformServices.Universal.Unit.Tests/packages.config b/test/UnitTests/PlatformServices.Universal.Unit.Tests/packages.config index c9431d230f..84b6308e52 100644 --- a/test/UnitTests/PlatformServices.Universal.Unit.Tests/packages.config +++ b/test/UnitTests/PlatformServices.Universal.Unit.Tests/packages.config @@ -1,7 +1,8 @@  - + +