@@ -123,8 +123,6 @@ final class BuildSystemTests: XCTestCase {
123
123
// MARK: - Tests
124
124
125
125
func testClangdDocumentUpdatedBuildSettings( ) async throws {
126
- try XCTSkipIf ( true , " rdar://115435598 - crashing on rebranch " )
127
-
128
126
guard haveClangd else { return }
129
127
130
128
let doc = DocumentURI . for ( . objective_c)
@@ -155,14 +153,17 @@ final class BuildSystemTests: XCTestCase {
155
153
let newSettings = FileBuildSettings ( compilerArguments: args + [ " -DFOO " ] )
156
154
buildSystem. buildSettingsByFile [ doc] = newSettings
157
155
158
- let expectation = XCTestExpectation ( description: " refresh " )
159
- let refreshedDiags = try await testClient. nextDiagnosticsNotification ( )
160
- XCTAssertEqual ( refreshedDiags. diagnostics. count, 0 )
161
- XCTAssertEqual ( text, documentManager. latestSnapshot ( doc) !. text)
162
-
163
156
await buildSystem. delegate? . fileBuildSettingsChanged ( [ doc] )
164
157
165
- try await fulfillmentOfOrThrow ( [ expectation] )
158
+ var receivedCorrectDiagnostic = false
159
+ for _ in 0 ..< Int ( defaultTimeout) {
160
+ let refreshedDiags = try await testClient. nextDiagnosticsNotification ( timeout: 1 )
161
+ if refreshedDiags. diagnostics. count == 0 , text == documentManager. latestSnapshot ( doc) !. text {
162
+ receivedCorrectDiagnostic = true
163
+ break
164
+ }
165
+ }
166
+ XCTAssert ( receivedCorrectDiagnostic)
166
167
}
167
168
168
169
func testSwiftDocumentUpdatedBuildSettings( ) async throws {
@@ -269,18 +270,16 @@ final class BuildSystemTests: XCTestCase {
269
270
}
270
271
271
272
func testMainFilesChanged( ) async throws {
272
- try XCTSkipIf ( true , " rdar://115176405 - failing on rebranch due to extra published diagnostic " )
273
-
274
273
let ws = try await mutableSourceKitTibsTestWorkspace ( name: " MainFiles " ) !
275
274
let unique_h = ws. testLoc ( " unique " ) . docIdentifier. uri
276
275
277
276
try ws. openDocument ( unique_h. fileURL!, language: . cpp)
278
277
279
- let openDiags = try await testClient. nextDiagnosticsNotification ( )
278
+ let openDiags = try await ws . testClient. nextDiagnosticsNotification ( )
280
279
XCTAssertEqual ( openDiags. diagnostics. count, 0 )
281
280
282
281
try ws. buildAndIndex ( )
283
- let diagsFromD = try await testClient. nextDiagnosticsNotification ( )
282
+ let diagsFromD = try await ws . testClient. nextDiagnosticsNotification ( )
284
283
XCTAssertEqual ( diagsFromD. diagnostics. count, 1 )
285
284
let diagFromD = try XCTUnwrap ( diagsFromD. diagnostics. first)
286
285
XCTAssertEqual ( diagFromD. severity, . warning)
@@ -301,11 +300,19 @@ final class BuildSystemTests: XCTestCase {
301
300
)
302
301
}
303
302
304
- let diagsFromC = try await testClient. nextDiagnosticsNotification ( )
305
- XCTAssertEqual ( diagsFromC. diagnostics. count, 1 )
306
- let diagFromC = try XCTUnwrap ( diagsFromC. diagnostics. first)
307
- XCTAssertEqual ( diagFromC. severity, . warning)
308
- XCTAssertEqual ( diagFromC. message, " UNIQUE_INCLUDED_FROM_C " )
303
+ var receivedCorrectDiagnostic = false
304
+ for _ in 0 ..< Int ( defaultTimeout) {
305
+ let diagsFromC = try await ws. testClient. nextDiagnosticsNotification ( timeout: 1 )
306
+ guard diagsFromC. diagnostics. count == 1 , let diagFromC = diagsFromC. diagnostics. first else {
307
+ continue
308
+ }
309
+ guard diagFromC. severity == . warning, diagFromC. message == " UNIQUE_INCLUDED_FROM_C " else {
310
+ continue
311
+ }
312
+ receivedCorrectDiagnostic = true
313
+ break
314
+ }
315
+ XCTAssert ( receivedCorrectDiagnostic)
309
316
}
310
317
311
318
private func clangBuildSettings( for uri: DocumentURI ) -> FileBuildSettings {
0 commit comments