Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Managed TestCase Properties implemented #2611

Merged
6 commits merged into from
Nov 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
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
11 changes: 6 additions & 5 deletions NuGet.config
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@
<!--To inherit the global NuGet package sources remove the <clear/> line below -->
<add key="dotnet-core" value="https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json" />
<add key="api.nuget.org" value="https://api.nuget.org/v3/index.json" />
<add key="dotnet-eng" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json" />
<add key="test-tools" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/test-tools/nuget/v3/index.json" />
<add key="dotnet3.1" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet3.1/nuget/v3/index.json" />
<add key="dotnet3.1-transport" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet3.1-transport/nuget/v3/index.json" />
<add key="dotnet5" value="https://dnceng.pkgs.visualstudio.com/public/_packaging/dotnet5/nuget/v3/index.json" />

<add key="vstest.myget" value="https://dotnet.myget.org/F/vstest/api/v3/index.json" />
<add key="mstest.myget" value="https://dotnet.myget.org/F/mstestv2/api/v3/index.json" />
<add key="pdb2pdb.myget" value="https://dotnet.myget.org/F/symreader-converter/api/v3/index.json" />
<add key="vsunittesting.myget" value="https://dotnet.myget.org/F/vsunittesting/api/v3/index.json" />
<add key="dotnet3.1" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet3.1/nuget/v3/index.json" />
<add key="dotnet3.1-transport" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet3.1-transport/nuget/v3/index.json" />
<add key="dotnet5" value="https://dnceng.pkgs.visualstudio.com/public/_packaging/dotnet5/nuget/v3/index.json" />
<add key="dotnet-eng" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json" />
<add key="test-tools" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/test-tools/nuget/v3/index.json" />
</packageSources>
<fallbackPackageFolders>
<clear />
Expand Down
15 changes: 15 additions & 0 deletions TestPlatform.sln
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.TestPlatform.Exte
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "coverlet.collector", "test\coverlet.collector\coverlet.collector.csproj", "{074F5BD6-DC05-460B-B78F-044D125FD787}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.TestPlatform.ObjectModel.ManagedNameUtilities.UnitTests", "test\Microsoft.TestPlatform.ObjectModel.ManagedNameUtilities.UnitTests\Microsoft.TestPlatform.ObjectModel.ManagedNameUtilities.UnitTests.csproj", "{DCD0C39E-C78C-4A44-B0BD-7325254A2E97}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -781,6 +783,18 @@ Global
{074F5BD6-DC05-460B-B78F-044D125FD787}.Release|x64.Build.0 = Release|Any CPU
{074F5BD6-DC05-460B-B78F-044D125FD787}.Release|x86.ActiveCfg = Release|Any CPU
{074F5BD6-DC05-460B-B78F-044D125FD787}.Release|x86.Build.0 = Release|Any CPU
{DCD0C39E-C78C-4A44-B0BD-7325254A2E97}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DCD0C39E-C78C-4A44-B0BD-7325254A2E97}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DCD0C39E-C78C-4A44-B0BD-7325254A2E97}.Debug|x64.ActiveCfg = Debug|Any CPU
{DCD0C39E-C78C-4A44-B0BD-7325254A2E97}.Debug|x64.Build.0 = Debug|Any CPU
{DCD0C39E-C78C-4A44-B0BD-7325254A2E97}.Debug|x86.ActiveCfg = Debug|Any CPU
{DCD0C39E-C78C-4A44-B0BD-7325254A2E97}.Debug|x86.Build.0 = Debug|Any CPU
{DCD0C39E-C78C-4A44-B0BD-7325254A2E97}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DCD0C39E-C78C-4A44-B0BD-7325254A2E97}.Release|Any CPU.Build.0 = Release|Any CPU
{DCD0C39E-C78C-4A44-B0BD-7325254A2E97}.Release|x64.ActiveCfg = Release|Any CPU
{DCD0C39E-C78C-4A44-B0BD-7325254A2E97}.Release|x64.Build.0 = Release|Any CPU
{DCD0C39E-C78C-4A44-B0BD-7325254A2E97}.Release|x86.ActiveCfg = Release|Any CPU
{DCD0C39E-C78C-4A44-B0BD-7325254A2E97}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -849,6 +863,7 @@ Global
{236A71E3-01DA-4679-9DFF-16A8E079ACFF} = {5E7F18A8-F843-4C8A-AB02-4C7D9205C6CF}
{41248B96-6E15-4E5E-A78F-859897676814} = {020E15EA-731F-4667-95AF-226671E0C3AE}
{074F5BD6-DC05-460B-B78F-044D125FD787} = {B27FAFDF-2DBA-4AB0-BA85-FD5F21D359D6}
{DCD0C39E-C78C-4A44-B0BD-7325254A2E97} = {B27FAFDF-2DBA-4AB0-BA85-FD5F21D359D6}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {0541B30C-FF51-4E28-B172-83F5F3934BCD}
Expand Down
6 changes: 6 additions & 0 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,11 @@
<MicrosoftSourceLinkVersion>1.0.0-beta2-19554-01</MicrosoftSourceLinkVersion>
<MicrosoftDotNetSwaggerGeneratorMSBuildVersion>1.0.0-beta.20567.6</MicrosoftDotNetSwaggerGeneratorMSBuildVersion>
<XliffTasksVersion>1.0.0-beta.20055.1</XliffTasksVersion>

<!-- Roslyn -->
<!-- WARNING: Depending on Roslyn in code that also supports unmanaged scenarios (e.g. C++,
Haplois marked this conversation as resolved.
Show resolved Hide resolved
JS etc.) is risky. This can break setup authoring and cause runtime failures in workloads
where Rolsyn is not installed. -->
<MicrosoftCodeAnalysisVersion>3.8.0-3.20427.2</MicrosoftCodeAnalysisVersion>
</PropertyGroup>
</Project>
9 changes: 4 additions & 5 deletions scripts/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ Param(

[Parameter(Mandatory=$false)]
[Alias("noloc")]
[Switch] $DisableLocalizedBuild = $false,
[Switch] $DisableLocalizedBuild,

[Parameter(Mandatory=$false)]
[Alias("ci")]
[Switch] $CIBuild = $false,
[Switch] $CIBuild,

[Parameter(Mandatory=$false)]
[Alias("pt")]
[Switch] $PublishTestArtifacts = $false,
[Switch] $PublishTestArtifacts,

# Build specific projects
[Parameter(Mandatory=$false)]
Expand Down Expand Up @@ -119,7 +119,7 @@ $language = @("cs", "de", "es", "fr", "it", "ja", "ko", "pl", "pt-BR", "ru", "tr
# Capture error state in any step globally to modify return code
$Script:ScriptFailed = $false

Import-Module "$($CurrentScriptDir.FullName)\verify-nupkgs.ps1"
Import-Module -Name "$($CurrentScriptDir.FullName)\verify-nupkgs.ps1" -Scope Local
Haplois marked this conversation as resolved.
Show resolved Hide resolved

# Update the version in the dependencies props to be the TPB_version version, this is not ideal but because changing how this is resolved would
# mean that we need to change the whole build process this is a solution with the least amount of impact, that does not require us to keep track of
Expand Down Expand Up @@ -253,7 +253,6 @@ function Invoke-TestAssetsBuild
Write-Log "Invoke-TestAssetsBuild: Start test assets build."
$dotnetExe = Get-DotNetPath


Write-Log ".. .. Build: Source: $TPB_TestAssets_Solution"
Write-Verbose "$dotnetExe build $TPB_TestAssets_Solution --configuration $TPB_Configuration -v:minimal -p:Version=$TPB_Version -p:CIBuild=$TPB_CIBuild"
& $dotnetExe build $TPB_TestAssets_Solution --configuration $TPB_Configuration -v:minimal -p:CIBuild=$TPB_CIBuild -p:LocalizedBuild=$TPB_LocalizedBuild -bl:"$($env:TP_ROOT_DIR)\TestAssets.binlog"
Expand Down
3 changes: 1 addition & 2 deletions scripts/verify-nupkgs.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ function Unzip
[System.IO.Compression.ZipFile]::ExtractToDirectory($zipfile, $outpath)
}


function Verify-Nuget-Packages($packageDirectory)
{
Write-Log "Starting Verify-Nuget-Packages."
Expand Down Expand Up @@ -59,4 +58,4 @@ function Verify-Nuget-Packages($packageDirectory)
}

Write-Log "Completed Verify-Nuget-Packages."
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

namespace Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Extensions
{
using System;
using System.Reflection;

public static partial class ReflectionExtensions
{
#if NETSTANDARD1_0 || NETSTANDARD1_3 || WINDOWS_UWP
private static readonly Type methodBase = typeof(MethodBase);

private const string MemberTypePropertyName = "MemberType";
private const string ReflectedTypePropertyName = "ReflectedType";
private const string MethodHandlePropertyName = "MethodHandle";

private static readonly PropertyInfo memberTypeProperty = methodBase.GetRuntimeProperty(MemberTypePropertyName);
private static readonly PropertyInfo reflectedTypeProperty = methodBase.GetRuntimeProperty(ReflectedTypePropertyName);
private static readonly PropertyInfo methodHandleProperty = methodBase.GetRuntimeProperty(MethodHandlePropertyName);
#endif

public static bool IsMethod(this MethodBase method)
{
#if !NETSTANDARD1_0 && !NETSTANDARD1_3 && !WINDOWS_UWP
return method.MemberType == MemberTypes.Method;
#else
AssertSupport(memberTypeProperty, MemberTypePropertyName, methodBase.FullName);

return (int)memberTypeProperty.GetValue(method) == 8;
#endif
}

public static Type GetReflectedType(this MethodBase method)
{
#if !NETSTANDARD1_0 && !NETSTANDARD1_3 && !WINDOWS_UWP
return method.ReflectedType;
#else
AssertSupport(memberTypeProperty, ReflectedTypePropertyName, methodBase.FullName);

return reflectedTypeProperty.GetValue(method) as Type;
#endif
}

public static RuntimeMethodHandle GetMethodHandle(this MethodBase method)
{
#if !NETSTANDARD1_0 && !NETSTANDARD1_3 && !WINDOWS_UWP
return method.MethodHandle;
#else
AssertSupport(memberTypeProperty, MethodHandlePropertyName, methodBase.FullName);

return (RuntimeMethodHandle)methodHandleProperty.GetValue(method);
#endif
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

namespace Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Extensions
{
using System;
using System.Reflection;

public static partial class ReflectionExtensions
{
public static bool IsGenericType(this Type type)
{
#if !NETSTANDARD1_0 && !NETSTANDARD1_3 && !WINDOWS_UWP
return type.IsGenericType;
#else
return type.GetTypeInfo().IsGenericType;
#endif
}

public static MethodBase GetDeclaringMethod(this Type type)
{
#if !NETSTANDARD1_0 && !NETSTANDARD1_3 && !WINDOWS_UWP
return type.DeclaringMethod;
#else
return type.GetTypeInfo().DeclaringMethod;
#endif
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

namespace Microsoft.VisualStudio.TestPlatform.PlatformAbstractions.Extensions
{
using Microsoft.VisualStudio.TestPlatform.CoreUtilities.Resources;

using System;

public static partial class ReflectionExtensions
{
private static void AssertSupport<T>(T obj, string methodName, string className)
where T : class
{
if (obj == null)
{
throw new NotImplementedException(string.Format(Resources.MethodNotImplementedOnPlatform, className, methodName));
}
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -165,4 +165,10 @@
<data name="Utility_ProcessNameWhenCannotGetIt" xml:space="preserve">
<value>Error getting process name.</value>
</data>
<data name="MethodNotImplementedOnPlatform" xml:space="preserve">
<value>'{0}.{1}' is not implemented on this platform!</value>
<comment>'{className}.{methodName}' is not implemented on this platform!

Example: 'System.Reflection.MethodBase' is not implemented on this platform!</comment>
</data>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,13 @@
<target state="translated">Hostitele {0} nešlo najít. Ujistěte se, jestli je {0} nainstalovaný na počítači a dostupný v cestě určené proměnnou prostředí PATH.</target>
<note />
</trans-unit>
<trans-unit id="MethodNotImplementedOnPlatform">
<source>'{0}.{1}' is not implemented on this platform!</source>
<target state="new">'{0}.{1}' is not implemented on this platform!</target>
<note>'{className}.{methodName}' is not implemented on this platform!

Example: 'System.Reflection.MethodBase' is not implemented on this platform!</note>
</trans-unit>
</body>
</file>
</xliff>
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,13 @@
<target state="translated">Der Host "{0}" wurde nicht gefunden. Stellen Sie sicher, dass "{0}" auf dem Computer installiert und in der PATH-Umgebungsvariablen verfügbar ist.</target>
<note />
</trans-unit>
<trans-unit id="MethodNotImplementedOnPlatform">
<source>'{0}.{1}' is not implemented on this platform!</source>
<target state="new">'{0}.{1}' is not implemented on this platform!</target>
<note>'{className}.{methodName}' is not implemented on this platform!

Example: 'System.Reflection.MethodBase' is not implemented on this platform!</note>
</trans-unit>
</body>
</file>
</xliff>
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,13 @@
<target state="translated">No se pudo encontrar el host "{0}". Asegúrese de que "{0}" está instalado en el equipo y está disponible en la variable de entorno PATH.</target>
<note />
</trans-unit>
<trans-unit id="MethodNotImplementedOnPlatform">
<source>'{0}.{1}' is not implemented on this platform!</source>
<target state="new">'{0}.{1}' is not implemented on this platform!</target>
<note>'{className}.{methodName}' is not implemented on this platform!

Example: 'System.Reflection.MethodBase' is not implemented on this platform!</note>
</trans-unit>
</body>
</file>
</xliff>
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,13 @@
<target state="translated">L'hôte '{0}' est introuvable. Vérifiez que '{0}' est installé sur la machine et qu'il est disponible dans la variable d'environnement PATH.</target>
<note />
</trans-unit>
<trans-unit id="MethodNotImplementedOnPlatform">
<source>'{0}.{1}' is not implemented on this platform!</source>
<target state="new">'{0}.{1}' is not implemented on this platform!</target>
<note>'{className}.{methodName}' is not implemented on this platform!

Example: 'System.Reflection.MethodBase' is not implemented on this platform!</note>
</trans-unit>
</body>
</file>
</xliff>
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,13 @@
<target state="translated">L'host '{0}' non è stato trovato. Assicurarsi che '{0}' sia installato nel computer e che sia disponibile nella variabile di ambiente PATH.</target>
<note />
</trans-unit>
<trans-unit id="MethodNotImplementedOnPlatform">
<source>'{0}.{1}' is not implemented on this platform!</source>
<target state="new">'{0}.{1}' is not implemented on this platform!</target>
<note>'{className}.{methodName}' is not implemented on this platform!

Example: 'System.Reflection.MethodBase' is not implemented on this platform!</note>
</trans-unit>
</body>
</file>
</xliff>
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,13 @@
<target state="translated">'{0}' ホストが見つかりませんでした。'{0}' がコンピューターにインストールされており、PATH 環境変数で使用できることを確認してください。</target>
<note />
</trans-unit>
<trans-unit id="MethodNotImplementedOnPlatform">
<source>'{0}.{1}' is not implemented on this platform!</source>
<target state="new">'{0}.{1}' is not implemented on this platform!</target>
<note>'{className}.{methodName}' is not implemented on this platform!

Example: 'System.Reflection.MethodBase' is not implemented on this platform!</note>
</trans-unit>
</body>
</file>
</xliff>
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,13 @@
<target state="translated">‘{0}’ 호스트를 찾을 수 없습니다. ‘{0}’이(가) 컴퓨터에 설치되어 있고 PATH 환경 변수에서 사용할 수 있는지 확인하세요.</target>
<note />
</trans-unit>
<trans-unit id="MethodNotImplementedOnPlatform">
<source>'{0}.{1}' is not implemented on this platform!</source>
<target state="new">'{0}.{1}' is not implemented on this platform!</target>
<note>'{className}.{methodName}' is not implemented on this platform!

Example: 'System.Reflection.MethodBase' is not implemented on this platform!</note>
</trans-unit>
</body>
</file>
</xliff>
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,13 @@
<target state="translated">Nie można znaleźć hosta „{0}”. Upewnij się, że element „{0}” jest zainstalowany na maszynie i jest dostępny w zmiennej środowiskowej PATH.</target>
<note />
</trans-unit>
<trans-unit id="MethodNotImplementedOnPlatform">
<source>'{0}.{1}' is not implemented on this platform!</source>
<target state="new">'{0}.{1}' is not implemented on this platform!</target>
<note>'{className}.{methodName}' is not implemented on this platform!

Example: 'System.Reflection.MethodBase' is not implemented on this platform!</note>
</trans-unit>
</body>
</file>
</xliff>
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,13 @@
<target state="translated">Não foi possível encontrar o host '{0}'. Verifique se o '{0}' está instalado no computador e está disponível na variável de ambiente PATH.</target>
<note />
</trans-unit>
<trans-unit id="MethodNotImplementedOnPlatform">
<source>'{0}.{1}' is not implemented on this platform!</source>
<target state="new">'{0}.{1}' is not implemented on this platform!</target>
<note>'{className}.{methodName}' is not implemented on this platform!

Example: 'System.Reflection.MethodBase' is not implemented on this platform!</note>
</trans-unit>
</body>
</file>
</xliff>
Loading