From ca37ed781645c685b7fc2ca83e6d8ed977a693ca Mon Sep 17 00:00:00 2001 From: mdh1418 Date: Wed, 4 Sep 2024 16:31:02 -0400 Subject: [PATCH 1/6] [tests] Remove unused ConcurrentThreadEvents validation The *ConcurrentThreadEvents count validation was removed as part of https://github.com/dotnet/diagnostics/pull/689 due to reported flakiness of the event being fired before observing the first runtime event. --- src/tests/eventpipe/GCEvents.cs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/tests/eventpipe/GCEvents.cs b/src/tests/eventpipe/GCEvents.cs index c4374ff0a5..e32d93fda6 100644 --- a/src/tests/eventpipe/GCEvents.cs +++ b/src/tests/eventpipe/GCEvents.cs @@ -212,11 +212,6 @@ await RemoteTestExecutorHelper.RunTestCaseAsync(() => { 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"); From 23fd33d24e3364fa20aa763915018bcd72a53c55 Mon Sep 17 00:00:00 2001 From: mdh1418 Date: Wed, 4 Sep 2024 16:34:28 -0400 Subject: [PATCH 2/6] [Tests] Skip GC SegmentEvents validation post NET 7 The new GC, supposedly introduced in .NET 7, stopped emitting GCFreeSegment events as it transition from performing virtual_free to virtual_decommit. As such, GCFreeSegments are no longer expected. --- src/tests/eventpipe/GCEvents.cs | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/tests/eventpipe/GCEvents.cs b/src/tests/eventpipe/GCEvents.cs index e32d93fda6..f5f68f255e 100644 --- a/src/tests/eventpipe/GCEvents.cs +++ b/src/tests/eventpipe/GCEvents.cs @@ -206,8 +206,11 @@ await RemoteTestExecutorHelper.RunTestCaseAsync(() => { Func> _DoesTraceContainEvents = (source) => { int GCCreateSegmentEvents = 0; int GCFreeSegmentEvents = 0; - source.Clr.GCCreateSegment += (eventData) => GCCreateSegmentEvents += 1; - source.Clr.GCFreeSegment += (eventData) => GCFreeSegmentEvents += 1; + if (Environment.Version.Major < 7) + { + source.Clr.GCCreateSegment += (eventData) => GCCreateSegmentEvents += 1; + source.Clr.GCFreeSegment += (eventData) => GCFreeSegmentEvents += 1; + } int GCAllocationTickEvents = 0; source.Clr.GCAllocationTick += (eventData) => GCAllocationTickEvents += 1; @@ -215,12 +218,15 @@ await RemoteTestExecutorHelper.RunTestCaseAsync(() => { return () => { Logger.logger.Log("Event counts validation"); - Logger.logger.Log("GCCreateSegmentEvents: " + GCCreateSegmentEvents); - Logger.logger.Log("GCFreeSegmentEvents: " + GCFreeSegmentEvents); + bool GCSegmentResult = true; + if (Environment.Version.Major < 7) + { + 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); + GCSegmentResult = GCCreateSegmentEvents > 0 && GCFreeSegmentEvents > 0; + Logger.logger.Log("GCSegmentResult: " + GCSegmentResult); + } Logger.logger.Log("GCAllocationTickEvents: " + GCAllocationTickEvents); bool GCAllocationTickResult = GCAllocationTickEvents > 0; From 403bd0e3c894fcf6d95f842e1d348d8858f1df13 Mon Sep 17 00:00:00 2001 From: mdh1418 Date: Wed, 4 Sep 2024 16:54:19 -0400 Subject: [PATCH 3/6] [tests] Update issue reference --- .../EventLogsPipelineUnitTests.cs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/tests/Microsoft.Diagnostics.Monitoring.EventPipe/EventLogsPipelineUnitTests.cs b/src/tests/Microsoft.Diagnostics.Monitoring.EventPipe/EventLogsPipelineUnitTests.cs index 7cc92be71c..d76277c1ca 100644 --- a/src/tests/Microsoft.Diagnostics.Monitoring.EventPipe/EventLogsPipelineUnitTests.cs +++ b/src/tests/Microsoft.Diagnostics.Monitoring.EventPipe/EventLogsPipelineUnitTests.cs @@ -95,14 +95,9 @@ public async Task TestLogsAllCategoriesDefaultLevel(TestConfiguration config) /// /// Test that log events at the default level are collected for categories without a specified level. /// - [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; From 4d5f719e9d05d58840b50aa231a87d78846b8a30 Mon Sep 17 00:00:00 2001 From: mdh1418 Date: Mon, 9 Sep 2024 12:07:12 -0400 Subject: [PATCH 4/6] [Tests] Remove GCSegment validation --- src/tests/eventpipe/GCEvents.cs | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/src/tests/eventpipe/GCEvents.cs b/src/tests/eventpipe/GCEvents.cs index f5f68f255e..68bd728c70 100644 --- a/src/tests/eventpipe/GCEvents.cs +++ b/src/tests/eventpipe/GCEvents.cs @@ -204,35 +204,17 @@ await RemoteTestExecutorHelper.RunTestCaseAsync(() => { }; Func> _DoesTraceContainEvents = (source) => { - int GCCreateSegmentEvents = 0; - int GCFreeSegmentEvents = 0; - if (Environment.Version.Major < 7) - { - source.Clr.GCCreateSegment += (eventData) => GCCreateSegmentEvents += 1; - source.Clr.GCFreeSegment += (eventData) => GCFreeSegmentEvents += 1; - } - int GCAllocationTickEvents = 0; source.Clr.GCAllocationTick += (eventData) => GCAllocationTickEvents += 1; return () => { Logger.logger.Log("Event counts validation"); - bool GCSegmentResult = true; - if (Environment.Version.Major < 7) - { - Logger.logger.Log("GCCreateSegmentEvents: " + GCCreateSegmentEvents); - Logger.logger.Log("GCFreeSegmentEvents: " + GCFreeSegmentEvents); - - GCSegmentResult = GCCreateSegmentEvents > 0 && GCFreeSegmentEvents > 0; - 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; From d18b2afb756b73c19de9a2ffa5d79e7b8be622ce Mon Sep 17 00:00:00 2001 From: mdh1418 Date: Mon, 9 Sep 2024 12:11:19 -0400 Subject: [PATCH 5/6] Bump TraceEventVersion to add CommittedUsage validation --- eng/Versions.props | 2 +- src/tests/eventpipe/GCEvents.cs | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/eng/Versions.props b/eng/Versions.props index 131f70642c..42013ddcec 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -37,7 +37,7 @@ 6.0.0 4.0.0-beta.24413.1 17.10.0-beta1.24272.1 - 3.0.7 + 3.1.15 6.0.0 6.0.4 6.0.0 diff --git a/src/tests/eventpipe/GCEvents.cs b/src/tests/eventpipe/GCEvents.cs index 68bd728c70..92d52a5126 100644 --- a/src/tests/eventpipe/GCEvents.cs +++ b/src/tests/eventpipe/GCEvents.cs @@ -204,17 +204,23 @@ await RemoteTestExecutorHelper.RunTestCaseAsync(() => { }; Func> _DoesTraceContainEvents = (source) => { + int GCCommittedUsageEvents = 0; + source.Clr.GCDynamicEvent.GCCommittedUsage += (eventData) => GCCommittedUsageEvents += 1; + int GCAllocationTickEvents = 0; source.Clr.GCAllocationTick += (eventData) => GCAllocationTickEvents += 1; return () => { Logger.logger.Log("Event counts validation"); + bool GCCommittedUsageResult = GCCommittedUsageEvents > 0; + Logger.logger.Log("GCCommittedUsageResult: " + GCCommittedUsageEvents); + Logger.logger.Log("GCAllocationTickEvents: " + GCAllocationTickEvents); bool GCAllocationTickResult = GCAllocationTickEvents > 0; Logger.logger.Log("GCAllocationTickResult: " + GCAllocationTickResult); - bool GCCollectResults = GCAllocationTickResult; + bool GCCollectResults = GCCommittedUsageResult && GCAllocationTickResult; Logger.logger.Log("GCCollectResults: " + GCCollectResults); return GCCollectResults ? 100 : -1; From 1adc52915ab44835f4935c6c92d9e867e1bfdbec Mon Sep 17 00:00:00 2001 From: mdh1418 Date: Mon, 9 Sep 2024 14:04:16 -0400 Subject: [PATCH 6/6] Revert "Bump TraceEventVersion to add CommittedUsage validation" This reverts commit d18b2afb756b73c19de9a2ffa5d79e7b8be622ce. --- eng/Versions.props | 2 +- src/tests/eventpipe/GCEvents.cs | 8 +------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/eng/Versions.props b/eng/Versions.props index 42013ddcec..131f70642c 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -37,7 +37,7 @@ 6.0.0 4.0.0-beta.24413.1 17.10.0-beta1.24272.1 - 3.1.15 + 3.0.7 6.0.0 6.0.4 6.0.0 diff --git a/src/tests/eventpipe/GCEvents.cs b/src/tests/eventpipe/GCEvents.cs index 92d52a5126..68bd728c70 100644 --- a/src/tests/eventpipe/GCEvents.cs +++ b/src/tests/eventpipe/GCEvents.cs @@ -204,23 +204,17 @@ await RemoteTestExecutorHelper.RunTestCaseAsync(() => { }; Func> _DoesTraceContainEvents = (source) => { - int GCCommittedUsageEvents = 0; - source.Clr.GCDynamicEvent.GCCommittedUsage += (eventData) => GCCommittedUsageEvents += 1; - int GCAllocationTickEvents = 0; source.Clr.GCAllocationTick += (eventData) => GCAllocationTickEvents += 1; return () => { Logger.logger.Log("Event counts validation"); - bool GCCommittedUsageResult = GCCommittedUsageEvents > 0; - Logger.logger.Log("GCCommittedUsageResult: " + GCCommittedUsageEvents); - Logger.logger.Log("GCAllocationTickEvents: " + GCAllocationTickEvents); bool GCAllocationTickResult = GCAllocationTickEvents > 0; Logger.logger.Log("GCAllocationTickResult: " + GCAllocationTickResult); - bool GCCollectResults = GCCommittedUsageResult && GCAllocationTickResult; + bool GCCollectResults = GCAllocationTickResult; Logger.logger.Log("GCCollectResults: " + GCCollectResults); return GCCollectResults ? 100 : -1;