@@ -133,7 +133,11 @@ struct APIDiffTests {
133
133
}
134
134
}
135
135
136
- @Test ( . requiresAPIDigester, arguments: SupportedBuildSystemOnAllPlatforms)
136
+ @Test (
137
+ . requiresAPIDigester,
138
+ . issue( " https://github.com/swiftlang/swift-package-manager/issues/8926 " , relationship: . defect) ,
139
+ arguments: SupportedBuildSystemOnAllPlatforms,
140
+ )
137
141
func testBreakageAllowlist( buildSystem: BuildSystemProvider . Kind ) async throws {
138
142
try await fixture ( name: " Miscellaneous/APIDiff/ " ) { fixturePath in
139
143
let packageRoot = fixturePath. appending ( " Bar " )
@@ -154,11 +158,15 @@ struct APIDiffTests {
154
158
try await execute ( [ " diagnose-api-breaking-changes " , " 1.2.3 " , " --breakage-allowlist-path " , customAllowlistPath. pathString] ,
155
159
packagePath: packageRoot, buildSystem: buildSystem)
156
160
) { error in
157
- #expect( error. stdout. contains ( " 1 breaking change detected in Qux " ) )
158
161
#expect( !error. stdout. contains ( " 💔 API breakage: class Qux has generic signature change from <T> to <T, U> " ) )
159
- #expect( error. stdout. contains ( " 💔 API breakage: var Qux.x has been removed " ) )
160
- #expect( error. stdout. contains ( " 1 breaking change detected in Baz " ) )
161
- #expect( error. stdout. contains ( " 💔 API breakage: func bar() has been removed " ) )
162
+ withKnownIssue {
163
+ #expect( error. stdout. contains ( " 1 breaking change detected in Qux " ) )
164
+ #expect( error. stdout. contains ( " 💔 API breakage: var Qux.x has been removed " ) )
165
+ #expect( error. stdout. contains ( " 1 breaking change detected in Baz " ) )
166
+ #expect( error. stdout. contains ( " 💔 API breakage: func bar() has been removed " ) )
167
+ } when: {
168
+ buildSystem == . swiftbuild && ProcessInfo . isHostAmazonLinux2 ( )
169
+ }
162
170
}
163
171
164
172
}
@@ -205,7 +213,11 @@ struct APIDiffTests {
205
213
}
206
214
}
207
215
208
- @Test ( . requiresAPIDigester, arguments: SupportedBuildSystemOnAllPlatforms)
216
+ @Test (
217
+ . requiresAPIDigester,
218
+ . issue( " https://github.com/swiftlang/swift-package-manager/issues/8926 " , relationship: . defect) ,
219
+ arguments: SupportedBuildSystemOnAllPlatforms,
220
+ )
209
221
func testFilters( buildSystem: BuildSystemProvider . Kind ) async throws {
210
222
try await fixture ( name: " Miscellaneous/APIDiff/ " ) { fixturePath in
211
223
let packageRoot = fixturePath. appending ( " NonAPILibraryTargets " )
@@ -228,10 +240,18 @@ struct APIDiffTests {
228
240
try await expectThrowsCommandExecutionError (
229
241
try await execute ( [ " diagnose-api-breaking-changes " , " 1.2.3 " , " --products " , " One " , " --targets " , " Bar " ] , packagePath: packageRoot, buildSystem: buildSystem)
230
242
) { error in
231
- #expect( error. stdout. contains ( " 💔 API breakage " ) )
243
+ withKnownIssue {
244
+ #expect( error. stdout. contains ( " 💔 API breakage " ) )
245
+ } when: {
246
+ buildSystem == . swiftbuild && ProcessInfo . isHostAmazonLinux2 ( )
247
+ }
232
248
let regex = try Regex ( " \\ d+ breaking change(s?) detected in Foo " )
233
- #expect( error. stdout. contains ( regex) )
234
- #expect( error. stdout. contains ( regex) )
249
+
250
+ withKnownIssue {
251
+ #expect( error. stdout. contains ( regex) )
252
+ } when: {
253
+ buildSystem == . swiftbuild && ProcessInfo . isHostAmazonLinux2 ( )
254
+ }
235
255
236
256
// Baz and Qux are not included in the filter, so any API changes should be ignored.
237
257
#expect( !error. stdout. contains ( " Baz " ) )
@@ -242,9 +262,13 @@ struct APIDiffTests {
242
262
try await expectThrowsCommandExecutionError (
243
263
try await execute ( [ " diagnose-api-breaking-changes " , " 1.2.3 " , " --targets " , " Baz " ] , packagePath: packageRoot, buildSystem: buildSystem)
244
264
) { error in
245
- #expect( error. stdout. contains ( " 💔 API breakage " ) )
246
- let regex = try Regex ( " \\ d+ breaking change(s?) detected in Baz " )
247
- #expect( error. stdout. contains ( regex) )
265
+ try withKnownIssue {
266
+ #expect( error. stdout. contains ( " 💔 API breakage " ) )
267
+ let regex = try Regex ( " \\ d+ breaking change(s?) detected in Baz " )
268
+ #expect( error. stdout. contains ( regex) )
269
+ } when: {
270
+ buildSystem == . swiftbuild && ProcessInfo . isHostAmazonLinux2 ( )
271
+ }
248
272
249
273
// Only Baz is included, we should not see any other API changes.
250
274
#expect( !error. stdout. contains ( " Foo " ) )
@@ -310,53 +334,69 @@ struct APIDiffTests {
310
334
}
311
335
}
312
336
313
- @Test ( . requiresAPIDigester, arguments: SupportedBuildSystemOnAllPlatforms)
337
+ @Test (
338
+ . requiresAPIDigester,
339
+ . issue( " https://github.com/swiftlang/swift-package-manager/issues/8926 " , relationship: . defect) ,
340
+ arguments: SupportedBuildSystemOnAllPlatforms,
341
+ )
314
342
func testNoBreakingChanges( buildSystem: BuildSystemProvider . Kind ) async throws {
315
- try await fixture ( name: " Miscellaneous/APIDiff/ " ) { fixturePath in
316
- let packageRoot = fixturePath. appending ( " Bar " )
317
- // Introduce an API-compatible change
318
- try localFileSystem. writeFileContents (
319
- packageRoot. appending ( components: " Sources " , " Baz " , " Baz.swift " ) ,
320
- string: " public func bar() -> Int { 100 } "
321
- )
322
- let ( output, _) = try await execute ( [ " diagnose-api-breaking-changes " , " 1.2.3 " ] , packagePath: packageRoot, buildSystem: buildSystem)
323
- #expect( output. contains ( " No breaking changes detected in Baz " ) )
324
- #expect( output. contains ( " No breaking changes detected in Qux " ) )
343
+ try await withKnownIssue {
344
+ try await fixture ( name: " Miscellaneous/APIDiff/ " ) { fixturePath in
345
+ let packageRoot = fixturePath. appending ( " Bar " )
346
+ // Introduce an API-compatible change
347
+ try localFileSystem. writeFileContents (
348
+ packageRoot. appending ( components: " Sources " , " Baz " , " Baz.swift " ) ,
349
+ string: " public func bar() -> Int { 100 } "
350
+ )
351
+ let ( output, _) = try await execute ( [ " diagnose-api-breaking-changes " , " 1.2.3 " ] , packagePath: packageRoot, buildSystem: buildSystem)
352
+ #expect( output. contains ( " No breaking changes detected in Baz " ) )
353
+ #expect( output. contains ( " No breaking changes detected in Qux " ) )
354
+ }
355
+ } when : {
356
+ buildSystem == . swiftbuild && ProcessInfo . isHostAmazonLinux2 ( )
325
357
}
326
358
}
327
359
328
- @Test ( . requiresAPIDigester, arguments: SupportedBuildSystemOnAllPlatforms)
360
+ @Test (
361
+ . requiresAPIDigester,
362
+ . issue( " https://github.com/swiftlang/swift-package-manager/issues/8926 " , relationship: . defect) ,
363
+ arguments: SupportedBuildSystemOnAllPlatforms,
364
+ )
329
365
func testAPIDiffAfterAddingNewTarget( buildSystem: BuildSystemProvider . Kind ) async throws {
330
- try await fixture ( name: " Miscellaneous/APIDiff/ " ) { fixturePath in
331
- let packageRoot = fixturePath. appending ( " Bar " )
332
- try localFileSystem. createDirectory ( packageRoot. appending ( components: " Sources " , " Foo " ) )
333
- try localFileSystem. writeFileContents (
334
- packageRoot. appending ( components: " Sources " , " Foo " , " Foo.swift " ) ,
335
- string: #"public let foo = "All new module!""#
336
- )
337
- try localFileSystem. writeFileContents ( packageRoot. appending ( " Package.swift " ) , string:
338
- """
339
- // swift-tools-version:4.2
340
- import PackageDescription
341
-
342
- let package = Package(
343
- name: " Bar " ,
344
- products: [
345
- .library(name: " Baz " , targets: [ " Baz " ]),
346
- .library(name: " Qux " , targets: [ " Qux " , " Foo " ]),
347
- ],
348
- targets: [
349
- .target(name: " Baz " ),
350
- .target(name: " Qux " ),
351
- .target(name: " Foo " )
352
- ]
366
+ try await withKnownIssue ( isIntermittent: true ) {
367
+ try await fixture ( name: " Miscellaneous/APIDiff/ " ) { fixturePath in
368
+ let packageRoot = fixturePath. appending ( " Bar " )
369
+ try localFileSystem. createDirectory ( packageRoot. appending ( components: " Sources " , " Foo " ) )
370
+ try localFileSystem. writeFileContents (
371
+ packageRoot. appending ( components: " Sources " , " Foo " , " Foo.swift " ) ,
372
+ string: #"public let foo = "All new module!""#
353
373
)
354
- """
355
- )
356
- let ( output, _) = try await execute ( [ " diagnose-api-breaking-changes " , " 1.2.3 " ] , packagePath: packageRoot, buildSystem: buildSystem)
357
- #expect( output. contains ( " No breaking changes detected in Baz " ) )
358
- #expect( output. contains ( " No breaking changes detected in Qux " ) )
359
- #expect( output. contains ( " Skipping Foo because it does not exist in the baseline " ) )
374
+ try localFileSystem. writeFileContents ( packageRoot. appending ( " Package.swift " ) , string:
375
+ """
376
+ // swift-tools-version:4.2
377
+ import PackageDescription
378
+
379
+ let package = Package(
380
+ name: " Bar " ,
381
+ products: [
382
+ .library(name: " Baz " , targets: [ " Baz " ]),
383
+ .library(name: " Qux " , targets: [ " Qux " , " Foo " ]),
384
+ ],
385
+ targets: [
386
+ .target(name: " Baz " ),
387
+ .target(name: " Qux " ),
388
+ .target(name: " Foo " )
389
+ ]
390
+ )
391
+ """
392
+ )
393
+ let ( output, _) = try await execute ( [ " diagnose-api-breaking-changes " , " 1.2.3 " ] , packagePath: packageRoot, buildSystem: buildSystem)
394
+ #expect( output. contains ( " No breaking changes detected in Baz " ) )
395
+ #expect( output. contains ( " No breaking changes detected in Qux " ) )
396
+ #expect( output. contains ( " Skipping Foo because it does not exist in the baseline " ) )
397
+ }
398
+ } when: {
399
+ buildSystem == . swiftbuild && ProcessInfo . isHostAmazonLinux2 ( )
360
400
}
361
401
}
362
402
0 commit comments