@@ -96,6 +96,7 @@ fileprivate struct SwiftCompilationCachingTests: CoreBasedTests {
96
96
results. checkTask ( . matchTargetName( " Application " ) , . matchRule( [ " SwiftCompile " , " normal " , " arm64 " , " Compiling App.swift " , " \( tmpDirPath. str) /Test/aProject/App.swift " ] ) ) { task in
97
97
task. checkCommandLineMatches ( [ . suffix( " swift-frontend " ) , . anySequence, " -cache-compile-job " , . anySequence] )
98
98
numCompile += 1
99
+ results. checkKeyQueryCacheMiss ( task)
99
100
}
100
101
results. checkTask ( . matchTargetName( " Application " ) , . matchRule( [ " SwiftEmitModule " , " normal " , " arm64 " , " Emitting module for Application " ] ) ) { _ in }
101
102
@@ -121,6 +122,10 @@ fileprivate struct SwiftCompilationCachingTests: CoreBasedTests {
121
122
122
123
tester. userInfo = rawUserInfo. withAdditionalEnvironment ( environment: metricsEnv ( " two " ) )
123
124
try await tester. checkBuild ( runDestination: . anyiOSDevice, persistent: true ) { results in
125
+ results. checkTask ( . matchRule( [ " SwiftCompile " , " normal " , " arm64 " , " Compiling App.swift " , " \( tmpDirPath. str) /Test/aProject/App.swift " ] ) ) { task in
126
+ results. checkKeyQueryCacheHit ( task)
127
+ }
128
+
124
129
results. checkNote ( " 4 hits (100%), 0 misses " )
125
130
}
126
131
#expect( try readMetrics ( " two " ) . contains ( " \" swiftCacheHits \" : \( numCompile) , \" swiftCacheMisses \" :0 " ) )
@@ -206,6 +211,7 @@ extension BuildOperationTester.BuildResults {
206
211
Issue . record ( " Unable to find cache miss diagnostic for task \( task) " , sourceLocation: sourceLocation)
207
212
return
208
213
}
214
+ check ( contains: . taskHadEvent( task, event: . hadOutput( contents: " Cache miss \n " ) ) , sourceLocation: sourceLocation)
209
215
}
210
216
211
217
fileprivate func checkKeyQueryCacheHit( _ task: Task , sourceLocation: SourceLocation = #_sourceLocation) {
@@ -214,5 +220,6 @@ extension BuildOperationTester.BuildResults {
214
220
Issue . record ( " Unable to find cache hit diagnostic for task \( task) " , sourceLocation: sourceLocation)
215
221
return
216
222
}
223
+ check ( contains: . taskHadEvent( task, event: . hadOutput( contents: " Cache hit \n " ) ) , sourceLocation: sourceLocation)
217
224
}
218
225
}
0 commit comments