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

Improve terminal logger #4877

Merged
merged 26 commits into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from 23 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
9 changes: 9 additions & 0 deletions eng/SourceBuildPrebuiltBaseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,14 @@
<!-- Caused by multi-targeting source build for repo builds/CI. Product source build only targets NetCurrent. -->
<UsagePattern IdentityGlob="Microsoft.AspNetCore.App.Ref/8.0.0" />
<UsagePattern IdentityGlob="Microsoft.NETCore.App.Host.linux-x64/8.0.0" />
<!-- Caused by upgrade to MSBuild sdks -->
<UsagePattern IdentityGlob="Microsoft.Build.Framework/17.8.3" />
<UsagePattern IdentityGlob="Microsoft.Build.Utilities.Core/17.8.3" />
<UsagePattern IdentityGlob="Microsoft.NET.StringTools/17.8.3" />
<UsagePattern IdentityGlob="Microsoft.VisualStudio.Setup.Configuration.Interop/3.2.2146" />
<UsagePattern IdentityGlob="System.Configuration.ConfigurationManager/7.0.0" />
<UsagePattern IdentityGlob="System.Diagnostics.EventLog/7.0.0" />
<UsagePattern IdentityGlob="System.Security.Cryptography.ProtectedData/7.0.0" />

</IgnorePatterns>
</UsageData>
10 changes: 8 additions & 2 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,15 @@
</PropertyGroup>
<PropertyGroup Label="VSTest dependencies">
<CoverletCoverageVersion>1.2.0</CoverletCoverageVersion>
<MicrosoftBuildFrameworkPackageVersion>16.0.461</MicrosoftBuildFrameworkPackageVersion>
<!--
When updating the version of Microsoft.Build.Utilities.Core, go check on nuget.org which TFMs it targets.
Because you will need to update Microsoft.TestPlatform.Build.UnitTests to build using that concrete .NET TFM, e.g. net8.0 for 17.8.3.
Otherwise it will restore the netstandard2.0 *reference* library into test project bin, and the test project will fail
with File not found error.
-->
<MicrosoftBuildFrameworkPackageVersion>17.8.3</MicrosoftBuildFrameworkPackageVersion>
<MicrosoftBuildPackageVersion>$(MicrosoftBuildFrameworkPackageVersion)</MicrosoftBuildPackageVersion>
<MicrosoftBuildUtilitiesCorePackageVersion>$(MicrosoftBuildPackageVersion)</MicrosoftBuildUtilitiesCorePackageVersion>
<MicrosoftBuildUtilitiesCorePackageVersion>$(MicrosoftBuildFrameworkPackageVersion)</MicrosoftBuildUtilitiesCorePackageVersion>
<MicrosoftCodeAnalysisVersion>3.11.0</MicrosoftCodeAnalysisVersion>
<MicrosoftCodeAnalysisBannedApiAnalyzersVersion>3.11.0-beta1.23525.2</MicrosoftCodeAnalysisBannedApiAnalyzersVersion>
<MicrosoftCodeAnalysisPublicApiAnalyzersVersion>3.11.0-beta1.23525.2</MicrosoftCodeAnalysisPublicApiAnalyzersVersion>
Expand Down
4 changes: 2 additions & 2 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "9.0.100-alpha.1.23615.4",
"version": "9.0.100-alpha.1.24073.1",
"rollForward": "minor",
"allowPrerelease": false,
"architecture": "x64"
Expand Down Expand Up @@ -29,7 +29,7 @@
},
"xcopy-msbuild": "17.8.1-2",
"vswhere": "2.2.7",
"dotnet": "9.0.100-alpha.1.23615.4"
"dotnet": "9.0.100-alpha.1.24073.1"
},
"msbuild-sdks": {
"Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.24076.5"
Expand Down
4 changes: 2 additions & 2 deletions playground/TestPlatform.Playground/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ static void Main()
{
// This project references TranslationLayer, vstest.console, TestHostProvider, testhost and MSTest1 projects, to make sure
// we build all the dependencies of that are used to run tests via VSTestConsoleWrapper. It then copies the components from
// their original build locations, to $(TargetDir)\vstest.console directory, and its subfolders to create an executable
// their original build locations, to $(TargetDir)\netfx\vstest.console directory, and its subfolders to create an executable
// copy of TestPlatform that is similar to what we ship.
//
// The copying might trigger only on re-build, if you see outdated dependencies, Rebuild this project instead of just Build.
Expand All @@ -37,7 +37,7 @@ static void Main()
var here = Path.GetDirectoryName(thisAssemblyPath)!;
var playground = Path.GetFullPath(Path.Combine(here, "..", "..", "..", ".."));

var console = Path.Combine(here, "vstest.console", "vstest.console.exe");
var console = Path.Combine(here, "vstest.console", "netfx", "vstest.console.exe");

var sourceSettings = $$$"""
<RunSettings>
Expand Down
63 changes: 43 additions & 20 deletions playground/TestPlatform.Playground/TestPlatform.Playground.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
<ProjectReference Include="$(RepoRoot)src\vstest.console\vstest.console.csproj" />
<ProjectReference Include="$(RepoRoot)playground\MSTest1\MSTest1.csproj" />
<ProjectReference Include="$(RepoRoot)src\AttachVS\AttachVS.csproj" />
<ProjectReference Include="..\..\src\Microsoft.TestPlatform.Extensions.HtmlLogger\Microsoft.TestPlatform.Extensions.HtmlLogger.csproj" />
<ProjectReference Include="$(RepoRoot)src\Microsoft.TestPlatform.Build\Microsoft.TestPlatform.Build.csproj" />
<ProjectReference Include="$(RepoRoot)src\Microsoft.TestPlatform.Extensions.HtmlLogger\Microsoft.TestPlatform.Extensions.HtmlLogger.csproj" />
</ItemGroup>
<ItemGroup Condition=" $(TargetFramework.StartsWith('net4')) AND '$(OS)' != 'Windows_NT' ">
<Reference Include="System" />
Expand All @@ -47,31 +48,53 @@
</PropertyGroup>

<ItemGroup>
<FileToCopy Include="$(SourcePath)bin\vstest.console\$(Configuration)\$(NetFrameworkMinimum)\win7-x64\**\*.*" SubFolder="" />
<FileToCopy Include="$(SourcePath)bin\Microsoft.TestPlatform.TestHostProvider\$(Configuration)\$(NetFrameworkMinimum)\**\*.*" SubFolder="Extensions\" />
<!-- .NET Framework console -->
<FileToCopy Include="$(SourcePath)bin\vstest.console\$(Configuration)\$(NetFrameworkMinimum)\win7-x64\**\*.*" SubFolder="netfx" />
<FileToCopy Include="$(SourcePath)bin\Microsoft.TestPlatform.TestHostProvider\$(Configuration)\$(NetFrameworkMinimum)\**\*.*" SubFolder="netfx\Extensions\" />

<!-- copy net462, net47, net471, net472 and net48 testhosts -->
<FileToCopy Include="$(SourcePath)bin\testhost.x86\$(Configuration)\$(NetFrameworkMinimum)\win7-x86\**\*.*" SubFolder="TestHostNetFramework\" />
<FileToCopy Include="$(SourcePath)bin\testhost\$(Configuration)\$(NetFrameworkMinimum)\win7-x64\**\*.*" SubFolder="TestHostNetFramework\" />
<FileToCopy Include="$(SourcePath)bin\testhost.x86\$(Configuration)\net47\win7-x86\**\*.*" SubFolder="TestHostNetFramework\" />
<FileToCopy Include="$(SourcePath)bin\testhost\$(Configuration)\net47\win7-x64\**\*.*" SubFolder="TestHostNetFramework\" />
<FileToCopy Include="$(SourcePath)bin\testhost.x86\$(Configuration)\net471\win7-x86\**\*.*" SubFolder="TestHostNetFramework\" />
<FileToCopy Include="$(SourcePath)bin\testhost\$(Configuration)\net471\win7-x64\**\*.*" SubFolder="TestHostNetFramework\" />
<FileToCopy Include="$(SourcePath)bin\testhost.x86\$(Configuration)\net472\win7-x86\**\*.*" SubFolder="TestHostNetFramework\" />
<FileToCopy Include="$(SourcePath)bin\testhost\$(Configuration)\net472\win7-x64\**\*.*" SubFolder="TestHostNetFramework\" />
<FileToCopy Include="$(SourcePath)bin\testhost.x86\$(Configuration)\net48\win7-x86\**\*.*" SubFolder="TestHostNetFramework\" />
<FileToCopy Include="$(SourcePath)bin\testhost\$(Configuration)\net48\win7-x64\**\*.*" SubFolder="TestHostNetFramework\" />
<FileToCopy Include="$(SourcePath)bin\testhost.x86\$(Configuration)\$(NetFrameworkMinimum)\win7-x86\**\*.*" SubFolder="netfx\TestHostNetFramework\" />
<FileToCopy Include="$(SourcePath)bin\testhost\$(Configuration)\$(NetFrameworkMinimum)\win7-x64\**\*.*" SubFolder="netfx\TestHostNetFramework\" />
<FileToCopy Include="$(SourcePath)bin\testhost.x86\$(Configuration)\net47\win7-x86\**\*.*" SubFolder="netfx\TestHostNetFramework\" />
<FileToCopy Include="$(SourcePath)bin\testhost\$(Configuration)\net47\win7-x64\**\*.*" SubFolder="netfx\TestHostNetFramework\" />
<FileToCopy Include="$(SourcePath)bin\testhost.x86\$(Configuration)\net471\win7-x86\**\*.*" SubFolder="netfx\TestHostNetFramework\" />
<FileToCopy Include="$(SourcePath)bin\testhost\$(Configuration)\net471\win7-x64\**\*.*" SubFolder="netfx\TestHostNetFramework\" />
<FileToCopy Include="$(SourcePath)bin\testhost.x86\$(Configuration)\net472\win7-x86\**\*.*" SubFolder="netfx\TestHostNetFramework\" />
<FileToCopy Include="$(SourcePath)bin\testhost\$(Configuration)\net472\win7-x64\**\*.*" SubFolder="netfx\TestHostNetFramework\" />
<FileToCopy Include="$(SourcePath)bin\testhost.x86\$(Configuration)\net48\win7-x86\**\*.*" SubFolder="netfx\TestHostNetFramework\" />
<FileToCopy Include="$(SourcePath)bin\testhost\$(Configuration)\net48\win7-x64\**\*.*" SubFolder="netfx\TestHostNetFramework\" />

<!-- copy datacollectors -->
<FileToCopy Include="$(SourcePath)bin\datacollector\$(Configuration)\net472\win7-x64\**\*.*" SubFolder="" />
<FileToCopy Include="$(SourcePath)bin\Microsoft.TestPlatform.Extensions.BlameDataCollector\$(Configuration)\net472\**\*.*" SubFolder="Extensions\" />
<FileToCopy Include="$(SourcePath)bin\DataCollectors\Microsoft.TestPlatform.Extensions.EventLogCollector\$(Configuration)\$(NetFrameworkMinimum)\**\*.*" SubFolder="Extensions\" />
<FileToCopy Include="$(SourcePath)bin\DataCollectors\DumpMinitool\$(Configuration)\$(NetFrameworkMinimum)\win7-x64\**\*.*" SubFolder="Extensions\blame\" />
<FileToCopy Include="$(SourcePath)bin\DataCollectors\DumpMinitool.x86\$(Configuration)\$(NetFrameworkMinimum)\win7-x86\**\*.*" SubFolder="Extensions\blame\" />
<FileToCopy Include="$(SourcePath)bin\DataCollectors\DumpMinitool.arm64\$(Configuration)\$(NetFrameworkMinimum)\win10-arm64\**\*.*" SubFolder="Extensions\blame\" />
<FileToCopy Include="$(SourcePath)bin\datacollector\$(Configuration)\net472\win7-x64\**\*.*" SubFolder="netfx\" />
<FileToCopy Include="$(SourcePath)bin\Microsoft.TestPlatform.Extensions.BlameDataCollector\$(Configuration)\net472\**\*.*" SubFolder="netfx\Extensions\" />
<FileToCopy Include="$(SourcePath)bin\DataCollectors\Microsoft.TestPlatform.Extensions.EventLogCollector\$(Configuration)\$(NetFrameworkMinimum)\**\*.*" SubFolder="netfx\Extensions\" />
<FileToCopy Include="$(SourcePath)bin\DataCollectors\DumpMinitool\$(Configuration)\$(NetFrameworkMinimum)\win7-x64\**\*.*" SubFolder="netfx\Extensions\blame\" />
<FileToCopy Include="$(SourcePath)bin\DataCollectors\DumpMinitool.x86\$(Configuration)\$(NetFrameworkMinimum)\win7-x86\**\*.*" SubFolder="netfx\Extensions\blame\" />
<FileToCopy Include="$(SourcePath)bin\DataCollectors\DumpMinitool.arm64\$(Configuration)\$(NetFrameworkMinimum)\win10-arm64\**\*.*" SubFolder="netfx\Extensions\blame\" />

<!-- copy loggers -->
<FileToCopy Include="$(SourcePath)bin\Microsoft.TestPlatform.Extensions.HtmlLogger\$(Configuration)\$(NetFrameworkMinimum)\Microsoft.VisualStudio.TestPlatform.Extensions.Html.TestLogger*" SubFolder="Extensions\" />
<FileToCopy Include="$(SourcePath)bin\Microsoft.TestPlatform.Extensions.HtmlLogger\$(Configuration)\$(NetFrameworkMinimum)\Microsoft.VisualStudio.TestPlatform.Extensions.Html.TestLogger*" SubFolder="netfx\Extensions\" />

<!-- .NET console -->
<FileToCopy Include="$(SourcePath)bin\vstest.console\$(Configuration)\$(NetCoreAppMinimum)\**\*.*" SubFolder="net" />
<FileToCopy Include="$(SourcePath)bin\Microsoft.TestPlatform.TestHostProvider\$(Configuration)\netstandard2.0\**\*.*" SubFolder="net\Extensions\" />

<!-- copy testhost -->
<FileToCopy Include="$(SourcePath)bin\testhost\$(Configuration)\$(NetCoreAppMinimum)\**\*.*" SubFolder="net" />

<!-- copy datacollectors --><!--
<FileToCopy Include="$(SourcePath)bin\datacollector\$(Configuration)\net472\**\*.*" SubFolder="net\" />
<FileToCopy Include="$(SourcePath)bin\Microsoft.TestPlatform.Extensions.BlameDataCollector\$(Configuration)\net472\**\*.*" SubFolder="net\Extensions\" />
<FileToCopy Include="$(SourcePath)bin\DataCollectors\Microsoft.TestPlatform.Extensions.EventLogCollector\$(Configuration)\$(NetCoreAppMinimum)\**\*.*" SubFolder="net\Extensions\" />
<FileToCopy Include="$(SourcePath)bin\DataCollectors\DumpMinitool\$(Configuration)\$(NetCoreAppMinimum)\**\*.*" SubFolder="net\Extensions\blame\" />
<FileToCopy Include="$(SourcePath)bin\DataCollectors\DumpMinitool.x86\$(Configuration)\$(NetCoreAppMinimum)\win7-x86\**\*.*" SubFolder="net\Extensions\blame\" />
<FileToCopy Include="$(SourcePath)bin\DataCollectors\DumpMinitool.arm64\$(Configuration)\$(NetCoreAppMinimum)\win10-arm64\**\*.*" SubFolder="net\Extensions\blame\" />-->

<!-- copy loggers --><!--
<FileToCopy Include="$(SourcePath)bin\Microsoft.TestPlatform.Extensions.HtmlLogger\$(Configuration)\$(NetCoreAppMinimum)\Microsoft.VisualStudio.TestPlatform.Extensions.Html.TestLogger*" SubFolder="net\Extensions\" />-->

<!-- copy test target -->
<FileToCopy Include="$(SourcePath)bin\Microsoft.TestPlatform.Build\$(Configuration)\netstandard2.0\*" SubFolder="net\" />
</ItemGroup>

<Copy SourceFiles="@(FileToCopy)" DestinationFiles="@(FileToCopy -> '$(DestinationPath)\%(SubFolder)\%(RecursiveDir)%(Filename)%(Extension)')" SkipUnchangedFiles="True" OverwriteReadOnlyFiles="True" Retries="3" RetryDelayMilliseconds="500" UseHardlinksIfPossible="False" UseSymboliclinksIfPossible="False" ErrorIfLinkFails="False" Condition="@(FileToCopy-&gt;Count()) &gt; 0">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,14 @@ Copyright (c) .NET Foundation. All rights reserved.
<CallTarget Targets="_VSTestMSBuild" Condition="$(VsTestUseMSBuildOutput)" />
</Target>

<!-- Used when called from dotnet msbuild command line: uses MSBuild logs but does not allow for console colorization -->
<!--
Used when called from dotnet msbuild command line: uses MSBuild logs but does not allow for console colorization.
We call to empty target _TestRunStart to mark start of the actual test running, in case we need to do build before
the test running. This is used in MSBuild Terminal Logger to detect that the current project will run some tests.
-->
<Target Name="_VSTestMSBuild" Condition="'$(IsTestProject)' == 'true'">
<CallTarget Condition="!$(VSTestNoBuild)" Targets="BuildProject" />
<CallTarget Targets="_TestRunStart" />

<VSTestTask2
TestFileFullPath="$(TargetPath)"
Expand Down Expand Up @@ -67,6 +72,8 @@ Copyright (c) .NET Foundation. All rights reserved.
/>
</Target>

<Target Name="_TestRunStart" />

<!-- Used when called from dotnet test command line: does not use MSBuild logs to allow for console colorization -->
<Target Name="_VSTestConsole">
<CallTarget Condition="'$(VSTestNoBuild)' != 'true' AND '$(IsTestProject)' == 'true'" Targets="BuildProject" />
Expand Down
Loading
Loading