Skip to content

Commit

Permalink
[tests] Segment Microsoft.Diagnostics.NETCore.Client relevant tests f…
Browse files Browse the repository at this point in the history
…or Linux arm coreclr
  • Loading branch information
mdh1418 committed Feb 22, 2022
1 parent 01ea71d commit dc29676
Show file tree
Hide file tree
Showing 18 changed files with 556 additions and 18 deletions.
1 change: 1 addition & 0 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@
<NETStandardLibraryRefVersion>2.1.0</NETStandardLibraryRefVersion>
<NetStandardLibraryVersion>2.0.3</NetStandardLibraryVersion>
<MicrosoftDiagnosticsToolsRuntimeClientVersion>1.0.4-preview6.19326.1</MicrosoftDiagnosticsToolsRuntimeClientVersion>
<MicrosoftDiagnosticsNETCoreClientVersion>0.2.61701</MicrosoftDiagnosticsNETCoreClientVersion>
<DNNEVersion>1.0.27</DNNEVersion>
<MicrosoftBuildVersion>16.10.0</MicrosoftBuildVersion>
<MicrosoftBuildTasksCoreVersion>$(MicrosoftBuildVersion)</MicrosoftBuildTasksCoreVersion>
Expand Down
7 changes: 7 additions & 0 deletions src/tests/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -194,5 +194,12 @@
<TestFramework>GeneratedRunner</TestFramework>
</PropertyGroup>

<PropertyGroup>
<!-- On Linux arm coreclr, the updated tracing/eventpipe/common/Microsoft.Diagnostics.NETCore.Client/Microsoft.Diagnostics.NETCore.Client.csproj project
does not yet work for several eventpipe runtime tests. We segment those tests with the following property and symbol -->
<UseUpdatedNETCoreClient Condition="!('$(TargetOS)' == 'Linux' And '$(TargetArchitecture)' == 'arm' And '$(RuntimeFlavor)' == 'coreclr')">true</UseUpdatedNETCoreClient>
<DefineConstants Condition="'$(UseUpdatedNETCoreClient)' == 'true'">$(DefineConstants);UPDATED_NETCORE_CLIENT</DefineConstants>
</PropertyGroup>

<Import Project="$(RepositoryEngineeringDir)testing\tests.props" Condition="'$(IsTestsCommonProject)' != 'true'" />
</Project>
20 changes: 20 additions & 0 deletions src/tests/JIT/Directed/debugging/debuginfo/tester.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
#if UPDATED_NETCORE_CLIENT
using Microsoft.Diagnostics.NETCore.Client;
#else
using Microsoft.Diagnostics.Tools.RuntimeClient;
#endif
using Microsoft.Diagnostics.Tracing;
using Microsoft.Diagnostics.Tracing.Parsers;
using Microsoft.Diagnostics.Tracing.Parsers.Clr;
Expand All @@ -23,6 +27,7 @@ public static unsafe int Main()
var keywords =
ClrTraceEventParser.Keywords.Jit | ClrTraceEventParser.Keywords.JittedMethodILToNativeMap;

#if UPDATED_NETCORE_CLIENT
var dotnetRuntimeProvider = new List<EventPipeProvider>
{
new EventPipeProvider("Microsoft-Windows-DotNETRuntime", eventLevel: EventLevel.Verbose, keywords: (long)keywords)
Expand All @@ -35,6 +40,21 @@ public static unsafe int Main()
dotnetRuntimeProvider,
1024,
ValidateMappings);
#else
var dotnetRuntimeProvider = new List<Provider>
{
new Provider("Microsoft-Windows-DotNETRuntime", eventLevel: EventLevel.Verbose, keywords: (ulong)keywords)
};

var config = new SessionConfiguration(1024, EventPipeSerializationFormat.NetTrace, dotnetRuntimeProvider);

return
IpcTraceTest.RunAndValidateEventCounts(
new Dictionary<string, ExpectedEventCount>(),
JitMethods,
config,
ValidateMappings);
#endif
}

private static void JitMethods()
Expand Down
2 changes: 1 addition & 1 deletion src/tests/JIT/Directed/debugging/debuginfo/tester.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<ProjectReference Include="tests_r.ilproj" Aliases="tests_r" />
<ProjectReference Include="attribute.csproj" />
<ProjectReference Include="../../../../tracing/eventpipe/common/common.csproj" />
<ProjectReference Include="../../../../tracing/eventpipe/common/Microsoft.Diagnostics.NETCore.Client/Microsoft.Diagnostics.NETCore.Client.csproj" />
<ProjectReference Condition="'$(UseUpdatedNETCoreClient)' == 'true'" Include="../../../../tracing/eventpipe/common/Microsoft.Diagnostics.NETCore.Client/Microsoft.Diagnostics.NETCore.Client.csproj" />
<Compile Include="$(MSBuildProjectName).cs" />
</ItemGroup>
</Project>
16 changes: 15 additions & 1 deletion src/tests/tracing/eventpipe/bigevent/bigevent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@
using Microsoft.Diagnostics.Tracing;
using Tracing.Tests.Common;
using Microsoft.Diagnostics.Tracing.Parsers.Clr;
using Microsoft.Diagnostics.NETCore.Client;
#if (UPDATED_NETCORE_CLIENT == true)
using Microsoft.Diagnostics.NETCore.Client;
#else
using Microsoft.Diagnostics.Tools.RuntimeClient;
#endif

namespace Tracing.Tests.BigEventsValidation
{
Expand Down Expand Up @@ -45,12 +49,22 @@ public static int Main(string[] args)
{
// This test tries to send a big event (>100KB) and checks that the app does not crash
// See https://github.com/dotnet/runtime/issues/50515 for the regression issue
#if (UPDATED_NETCORE_CLIENT == true)
var providers = new List<EventPipeProvider>()
{
new EventPipeProvider("BigEventSource", EventLevel.Verbose)
};

return IpcTraceTest.RunAndValidateEventCounts(_expectedEventCounts, _eventGeneratingAction, providers, 1024, _Verify);
#else
var providers = new List<Provider>()
{
new Provider("BigEventSource")
};

var configuration = new SessionConfiguration(circularBufferSizeMB: 1024, format: EventPipeSerializationFormat.NetTrace, providers: providers);
return IpcTraceTest.RunAndValidateEventCounts(_expectedEventCounts, _eventGeneratingAction, configuration, _Verify);
#endif
}

private static Dictionary<string, ExpectedEventCount> _expectedEventCounts = new Dictionary<string, ExpectedEventCount>()
Expand Down
2 changes: 1 addition & 1 deletion src/tests/tracing/eventpipe/bigevent/bigevent.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
<ItemGroup>
<Compile Include="$(MSBuildProjectName).cs" />
<ProjectReference Include="../common/common.csproj" />
<ProjectReference Include="../common/Microsoft.Diagnostics.NETCore.Client/Microsoft.Diagnostics.NETCore.Client.csproj" />
<ProjectReference Condition="'$(UseUpdatedNETCoreClient)' == 'true'" Include="../common/Microsoft.Diagnostics.NETCore.Client/Microsoft.Diagnostics.NETCore.Client.csproj" />
</ItemGroup>
</Project>
26 changes: 25 additions & 1 deletion src/tests/tracing/eventpipe/buffersize/buffersize.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@
using System.Collections.Generic;
using System.Text.RegularExpressions;
using Tracing.Tests.Common;
#if (UPDATED_NETCORE_CLIENT == true)
using Microsoft.Diagnostics.NETCore.Client;
#else
using Microsoft.Diagnostics.Tools.RuntimeClient;
#endif

namespace Tracing.Tests.BufferValidation
{
Expand All @@ -27,7 +31,7 @@ public static int Main(string[] args)
{
// This tests the resilience of message sending with
// smaller buffers, specifically 1MB and 4MB

#if (UPDATED_NETCORE_CLIENT == true)
var providers = new List<EventPipeProvider>()
{
new EventPipeProvider("MyEventSource", EventLevel.Verbose)
Expand All @@ -44,6 +48,26 @@ public static int Main(string[] args)
}

return 100;
#else
var providers = new List<Provider>()
{
new Provider("MyEventSource")
};

var tests = new int[] { 0, 2 }
.Select(x => (uint)Math.Pow(2, x))
.Select(bufferSize => new SessionConfiguration(circularBufferSizeMB: bufferSize, format: EventPipeSerializationFormat.NetTrace, providers: providers))
.Select<SessionConfiguration, Func<int>>(configuration => () => IpcTraceTest.RunAndValidateEventCounts(_expectedEventCounts, _eventGeneratingAction, configuration));

foreach (var test in tests)
{
var ret = test();
if (ret < 0)
return ret;
}

return 100;
#endif
}

private static Dictionary<string, ExpectedEventCount> _expectedEventCounts = new Dictionary<string, ExpectedEventCount>()
Expand Down
2 changes: 1 addition & 1 deletion src/tests/tracing/eventpipe/buffersize/buffersize.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
<ItemGroup>
<Compile Include="$(MSBuildProjectName).cs" />
<ProjectReference Include="../common/common.csproj" />
<ProjectReference Include="../common/Microsoft.Diagnostics.NETCore.Client/Microsoft.Diagnostics.NETCore.Client.csproj" />
<ProjectReference Condition="'$(UseUpdatedNETCoreClient)' == 'true'" Include="../common/Microsoft.Diagnostics.NETCore.Client/Microsoft.Diagnostics.NETCore.Client.csproj" />
</ItemGroup>
</Project>
Loading

0 comments on commit dc29676

Please sign in to comment.