-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Add EventPipe EventSource serialization testing #120887
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
Conversation
|
fyi @lateralusX |
|
Tagging subscribers to this area: @tarekgh, @tommcdon, @steveisok |
mdh1418
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we only want to test DynamicConfigChange on particular tests? Or would it be valuable to have both DynamicConfigChange and non DynamicConfigChange for all EventSource tests? Just curious when to test Start -> EventSourceCommand vs EventSourceCommand -> Start like how TestsUserErrors.cs uses the former in Test_BadTypes_Manifest_UserClass but uses the latter in Test_BadEventSource_MismatchedIds.
nit: inconsistency of one-line if blocks using/not-using curly braces + if( -> if (
src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/Harness/Listeners.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestsWriteEvent.cs
Show resolved
Hide resolved
I think there are a few parts to this and I believe they are still getting tested:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds EventPipe as a third event listener target alongside the existing EventListener and ETW implementations in the EventSource serialization tests. Previously, EventPipe was not tested through this framework, which allowed serialization discrepancies between EventPipe and ETW to go unnoticed.
Key Changes:
- Added EventPipeListener implementation using DiagnosticsClient
- Refactored test infrastructure to support multiple listener configurations via xunit Theory
- Added capability flags for listener-specific serialization behaviors
- Fixed several existing test issues and removed closed ActiveIssue attributes
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| System.Diagnostics.Tracing.Tests.csproj | Added EventPipeListener.cs and Microsoft.Diagnostics.NetCore.Client package reference |
| TestsWriteEventToListener.cs | Added listener.Start() calls to enable proper listener initialization |
| TestsWriteEvent.cs | Converted individual test methods to Theory-based approach using GetListenerConfigurations(), added conditional test execution based on listener capabilities |
| TestsWriteEvent.Etw.cs | Updated method signatures and removed ActiveIssue attributes for resolved issue #88305 |
| TestsWrite.cs | Converted to Theory-based tests, fixed Array.Equals/Assert.Equal bug, added listener capability checks |
| TestsWrite.Etw.cs | Removed ActiveIssue attribute for resolved issue #88305 |
| TestsUserErrors.cs | Added listener.Start() calls for proper initialization |
| Listeners.cs | Added Start() method, capability flags, pending command queue, and fixed IDictionary iteration bug |
| EventTestHarness.cs | Updated to use new Start() pattern and fixed swapped Assert.Equal arguments |
| EventPipeListener.cs | New EventPipeListener implementation for EventPipe event collection |
| EtwListener.cs | Refactored to support pending command queue and added Start() method |
| Versions.props | Added MicrosoftDiagnosticsNetCoreClientVersion property |
cb628f6 to
e83aebc
Compare
src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestsWrite.cs
Outdated
Show resolved
Hide resolved
|
/ba-g: Builds are timing out on arm64. This appears to be a problem across many PRs and this PR should have no arm64 specific behavior. |
63a3fa0 to
6ae708d
Compare
f6524cc to
e8878d3
Compare
e8878d3 to
172ee01
Compare
|
@mdh1418 or @lateralusX - can one of you re-approve this? I think something reset the approval. |
We've had EventSource serialization tests for a long time but EventPipe never got added to it. Unforetunately not testing EventPipe in this way previously meant that quite a few discrepancies between EventPipe and ETW went unnoticed. As a first step to documenting and/or resolving the problems I wanted to get EventPipe running in the same set of tests. I also did several other small fixes and improvements while doing the work. - EventPipeListener added as a new 3rd target for EventSource (in addition to EventListener and ETW which are there now) - Modified the Listener test abstraction so that EventPipe could also work - Removed assumption that providers can changed after the listener starts running - Added capability flags to indicate whether listeners supported certain kinds of serialization behavior - Worked around incomplete implementation of IDictionary for payloads in TraceEvent - Leveraged xunit theory attribute to avoid needing different top-level APIs for every listener configuration - Fixed EventTestHarness assert which had actual and expected values swapped - TestsWrite: Fixed mistaken call to Array.Equals with Assert.Equal so the test actually validates what it was supposed to - Removed ActiveIssue 88305 attribute which was already closed in the past. - Moved some test cases from TestsWriteEvent.Etw.cs to TestsWriteEvent.cs so that they can run for other listeners when supported.
- Wait for event processing before disconnecting the EventPipe stream
172ee01 to
984a5c4
Compare
|
/ba-g this was already green before the rebase. No need to do it again. |
We've had EventSource serialization tests for a long time but EventPipe never got added to it. Unforetunately not testing EventPipe in this way previously meant that quite a few discrepancies between EventPipe and ETW went unnoticed. As a first step to documenting and/or resolving the problems I wanted to get EventPipe running in the same set of tests. I also did several other small fixes and improvements while doing the work.