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

[Tests] Update GC SegmentEvents validation #4906

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,9 @@ public async Task TestLogsAllCategoriesDefaultLevel(TestConfiguration config)
/// <summary>
/// Test that log events at the default level are collected for categories without a specified level.
/// </summary>
[SkippableTheory(Skip = "Unreliable test https://github.com/dotnet/diagnostics/issues/3143"), MemberData(nameof(Configurations))]
[SkippableTheory(Skip = "Unreliable test https://github.com/dotnet/diagnostics/issues/2541"), MemberData(nameof(Configurations))]
public async Task TestLogsAllCategoriesDefaultLevelFallback(TestConfiguration config)
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
throw new SkipTestException("https://github.com/dotnet/diagnostics/issues/2541");
}

using Stream outputStream = await GetLogsAsync(config, settings => {
settings.UseAppFilters = false;
settings.LogLevel = LogLevel.Error;
Expand Down
19 changes: 1 addition & 18 deletions src/tests/eventpipe/GCEvents.cs
Original file line number Diff line number Diff line change
Expand Up @@ -204,34 +204,17 @@ await RemoteTestExecutorHelper.RunTestCaseAsync(() => {
};

Func<EventPipeEventSource, Func<int>> _DoesTraceContainEvents = (source) => {
int GCCreateSegmentEvents = 0;
int GCFreeSegmentEvents = 0;
source.Clr.GCCreateSegment += (eventData) => GCCreateSegmentEvents += 1;
source.Clr.GCFreeSegment += (eventData) => GCFreeSegmentEvents += 1;

int GCAllocationTickEvents = 0;
source.Clr.GCAllocationTick += (eventData) => GCAllocationTickEvents += 1;

int GCCreateConcurrentThreadEvents = 0;
int GCTerminateConcurrentThreadEvents = 0;
source.Clr.GCCreateConcurrentThread += (eventData) => GCCreateConcurrentThreadEvents += 1;
source.Clr.GCTerminateConcurrentThread += (eventData) => GCTerminateConcurrentThreadEvents += 1;

return () => {
Logger.logger.Log("Event counts validation");

Logger.logger.Log("GCCreateSegmentEvents: " + GCCreateSegmentEvents);
Logger.logger.Log("GCFreeSegmentEvents: " + GCFreeSegmentEvents);

// Disable checking GCFreeSegmentEvents on .NET 7.0 issue: https://github.com/dotnet/diagnostics/issues/3143
bool GCSegmentResult = GCCreateSegmentEvents > 0 && (GCFreeSegmentEvents > 0 || Environment.Version.Major >= 7);
Logger.logger.Log("GCSegmentResult: " + GCSegmentResult);

Logger.logger.Log("GCAllocationTickEvents: " + GCAllocationTickEvents);
bool GCAllocationTickResult = GCAllocationTickEvents > 0;
Logger.logger.Log("GCAllocationTickResult: " + GCAllocationTickResult);

bool GCCollectResults = GCSegmentResult && GCAllocationTickResult;
bool GCCollectResults = GCAllocationTickResult;
Logger.logger.Log("GCCollectResults: " + GCCollectResults);

return GCCollectResults ? 100 : -1;
Expand Down