@@ -38,7 +38,7 @@ public ExecutionLogTests(ITestOutputHelper output)
3838 [ Fact ]
3939 public void TestRoundTripExecutionLog ( )
4040 {
41- TestExecutionLogHelper ( ExpectProcessMonitoringEventData ) ;
41+ TestExecutionLogHelper ( verifier => ExpectProcessMonitoringEventData ( verifier ) ) ;
4242 }
4343
4444 [ Fact ]
@@ -78,155 +78,22 @@ public void TestPipCacheMissEventData()
7878 public void TestPipExecutionDirectoryOutputs ( )
7979 {
8080 TestExecutionLogHelper ( verifier =>
81- {
82- verifier . Expect ( new PipExecutionDirectoryOutputs
83- {
84- PipId = new PipId ( 123 ) ,
85- DirectoryOutputs = ReadOnlyArray < ( DirectoryArtifact , ReadOnlyArray < FileArtifact > ) > . FromWithoutCopy (
86- (
87- CreateDirectory ( ) ,
88- ReadOnlyArray < FileArtifact > . FromWithoutCopy ( CreateSourceFile ( ) , CreateOutputFile ( ) )
89- ) ,
90- (
91- CreateDirectory ( ) ,
92- ReadOnlyArray < FileArtifact > . FromWithoutCopy ( CreateOutputFile ( ) , CreateSourceFile ( ) )
93- )
94- )
95- } ) ;
96- } ) ;
97- }
98-
99- [ Fact ]
100- public void TestCustomEvent ( )
101- {
102- TestExecutionLogHelper ( verifier =>
103- {
104- var pipId = new PipId ( 123 ) ;
105- var sourceFile = CreateSourceFile ( ) ;
106- var outputFile = CreateOutputFile ( ) ;
107-
108- TestCustomEventData . SerializeFunc = writer =>
109- {
110- pipId . Serialize ( writer ) ;
111- writer . Write ( sourceFile ) ;
112- writer . Write ( outputFile ) ;
113- } ;
114-
115- TestCustomEventData . DeserializeAndUpdateFunc = reader =>
116- {
117- var dPipId = PipId . Deserialize ( reader ) ;
118- var dSourceFile = reader . ReadFileArtifact ( ) ;
119- var dOutputFile = reader . ReadFileArtifact ( ) ;
120- XAssert . AreEqual ( pipId , dPipId ) ;
121- XAssert . AreEqual ( sourceFile , dSourceFile ) ;
122- XAssert . AreEqual ( outputFile , dOutputFile ) ;
123- } ;
124-
125- verifier . Expect ( new TestCustomEventData ( ) ) ;
126- } ) ;
127- }
128-
129- [ Fact ]
130- public void TestSkipEventDueToFailedSerialization ( )
131- {
132- TestExecutionLogHelper ( verifier =>
133- {
134- var outputFile1 = CreateOutputFile ( ) ;
135- var outputFile2 = CreateOutputFile ( ) ;
136- var outputFile3 = CreateOutputFile ( ) ;
137- var outputFile4 = CreateOutputFile ( ) ;
138-
139- verifier . Expect ( new PipExecutionDirectoryOutputs
140- {
141- PipId = new PipId ( 123 ) ,
142- DirectoryOutputs = ReadOnlyArray < ( DirectoryArtifact , ReadOnlyArray < FileArtifact > ) > . FromWithoutCopy (
143- (
144- CreateDirectory ( ) ,
145- ReadOnlyArray < FileArtifact > . FromWithoutCopy ( outputFile1 , outputFile2 )
146- ) )
147- } ) ;
148-
149- TestCustomEventData . SerializeFunc = writer =>
150- {
151- writer . Write ( outputFile2 ) ;
152- writer . Write ( outputFile3 ) ;
153- throw new OutOfMemoryException ( "Fake OOM exception" ) ;
154- } ;
155-
156- TestCustomEventData . DeserializeAndUpdateFunc = reader =>
157- {
158- XAssert . Fail ( "Deserialization should never be called due to failed serialization" ) ;
159- } ;
160-
161- verifier . LogUnexpectedExpect ( new TestCustomEventData ( ) ) ;
162-
163- verifier . Expect ( new PipExecutionDirectoryOutputs
164- {
165- PipId = new PipId ( 234 ) ,
166- DirectoryOutputs = ReadOnlyArray < ( DirectoryArtifact , ReadOnlyArray < FileArtifact > ) > . FromWithoutCopy (
167- (
168- CreateDirectory ( ) ,
169- // Although outputFile2 was not serialized by the test custom event, it should still be
170- // serialized by this event, and so the deserialization should succeed.
171- ReadOnlyArray < FileArtifact > . FromWithoutCopy ( outputFile2 , outputFile3 , outputFile4 )
172- ) )
173- } ) ;
174- } ) ;
175- }
176-
177- [ Fact ]
178- [ Trait ( "Category" , "LongRunningTest" ) ]
179- public void TestSkipEventDueToTooLargeSerialization ( )
180- {
181- TestExecutionLogHelper ( verifier =>
182- {
183- var outputFile1 = CreateOutputFile ( ) ;
184- var outputFile2 = CreateOutputFile ( ) ;
185- var outputFile3 = CreateOutputFile ( ) ;
186- var outputFile4 = CreateOutputFile ( ) ;
187- var dummyFile = CreateOutputFile ( ) ;
188-
189- verifier . Expect ( new PipExecutionDirectoryOutputs
190- {
191- PipId = new PipId ( 123 ) ,
192- DirectoryOutputs = ReadOnlyArray < ( DirectoryArtifact , ReadOnlyArray < FileArtifact > ) > . FromWithoutCopy (
193- (
194- CreateDirectory ( ) ,
195- ReadOnlyArray < FileArtifact > . FromWithoutCopy ( outputFile1 , outputFile2 )
196- ) )
197- } ) ;
198-
199- TestCustomEventData . SerializeFunc = writer =>
200- {
201- writer . Write ( outputFile2 ) ;
202- writer . Write ( outputFile3 ) ;
203-
204- // The following should cause OutOfMemory exception on the underlying MemoryStream.
205- while ( true )
206- {
207- writer . Write ( dummyFile ) ;
208- }
209- } ;
210-
211- TestCustomEventData . DeserializeAndUpdateFunc = reader =>
212- {
213- XAssert . Fail ( "Deserialization should never be called due to failed serialization" ) ;
214- } ;
215-
216- verifier . LogUnexpectedExpect ( new TestCustomEventData ( ) ) ;
217-
218- verifier . Expect ( new PipExecutionDirectoryOutputs
219- {
220- PipId = new PipId ( 234 ) ,
221- DirectoryOutputs = ReadOnlyArray < ( DirectoryArtifact , ReadOnlyArray < FileArtifact > ) > . FromWithoutCopy (
222- (
223- CreateDirectory ( ) ,
224- // Although outputFile2 was not serialized by the test custom event, it should still be
225- // serialized by this event, and so the deserialization should succeed.
226- ReadOnlyArray < FileArtifact > . FromWithoutCopy ( outputFile2 , outputFile3 , outputFile4 )
227- ) )
228- } ) ;
229- } ) ;
81+ {
82+ verifier . Expect ( new PipExecutionDirectoryOutputs
83+ {
84+ PipId = new PipId ( 123 ) ,
85+ DirectoryOutputs = ReadOnlyArray < ( DirectoryArtifact , ReadOnlyArray < FileArtifact > ) > . FromWithoutCopy (
86+ (
87+ CreateDirectory ( ) ,
88+ ReadOnlyArray < FileArtifact > . FromWithoutCopy ( CreateSourceFile ( ) , CreateOutputFile ( ) )
89+ ) ,
90+ (
91+ CreateDirectory ( ) ,
92+ ReadOnlyArray < FileArtifact > . FromWithoutCopy ( CreateOutputFile ( ) , CreateSourceFile ( ) )
93+ )
94+ )
95+ } ) ;
96+ } ) ;
23097 }
23198
23299 [ Fact ]
@@ -447,8 +314,7 @@ private class ExecutionLogVerifier : ExecutionLogTargetBase,
447314 IEqualityVerifier < ProcessFingerprintComputationEventData > ,
448315 IEqualityVerifier < ObservedInputsEventData > ,
449316 IEqualityVerifier < PipCacheMissEventData > ,
450- IEqualityVerifier < PipExecutionDirectoryOutputs > ,
451- IEqualityVerifier < TestCustomEventData >
317+ IEqualityVerifier < PipExecutionDirectoryOutputs >
452318 {
453319 private readonly Queue < object > m_expectedData = new Queue < object > ( ) ;
454320 private readonly ExecutionLogTests m_parent ;
@@ -493,11 +359,6 @@ public override void PipExecutionDirectoryOutputs(PipExecutionDirectoryOutputs d
493359 VerifyEvent ( data ) ;
494360 }
495361
496- public override void TestCustom ( TestCustomEventData data )
497- {
498- VerifyEvent ( data ) ;
499- }
500-
501362 public virtual void Expect < TEventData > ( TEventData data )
502363 where TEventData : struct , IExecutionLogEventData < TEventData >
503364 {
@@ -659,8 +520,6 @@ public bool VerifyEquals(PipExecutionDirectoryOutputs expected, PipExecutionDire
659520 return true ;
660521 }
661522
662- public bool VerifyEquals ( TestCustomEventData expected , TestCustomEventData actual ) => true ;
663-
664523 private class DirectoryOutputComparer : IEqualityComparer < ( DirectoryArtifact directoryArtifact , ReadOnlyArray < FileArtifact > contents ) >
665524 {
666525 public static readonly DirectoryOutputComparer Instance = new DirectoryOutputComparer ( ) ;
0 commit comments