@@ -34,14 +34,12 @@ extension FileManager {
34
34
try createDirectory ( at: temporaryDirectory, withIntermediateDirectories: false )
35
35
defer {
36
36
// Best effort cleanup.
37
- do {
38
- if cleanup {
39
- try removeItem ( at: temporaryDirectory)
40
- logger. info ( " Removed temporary directory " )
41
- } else {
42
- logger. info ( " Keeping temporary directory " )
43
- }
44
- } catch { }
37
+ if cleanup {
38
+ try ? removeItem ( at: temporaryDirectory)
39
+ logger. info ( " Removed temporary directory " )
40
+ } else {
41
+ logger. info ( " Keeping temporary directory " )
42
+ }
45
43
}
46
44
47
45
logger. info ( " Created temporary directory " )
@@ -274,6 +272,8 @@ func buildTestcase(_ logger: Logger, testcase: String, bundleName: String, tempD
274
272
}
275
273
276
274
func buildTestcases( config: SDKConfiguration ) async throws {
275
+ try skipSlow ( )
276
+
277
277
var logger = Logger ( label: " EndToEndTests " )
278
278
logger [ metadataKey: " testcase " ] = " testPackageInitExecutable "
279
279
@@ -293,17 +293,26 @@ func buildTestcases(config: SDKConfiguration) async throws {
293
293
try await buildSDK ( logger, scratchPath: tempDir. path, withArguments: config. sdkGeneratorArguments)
294
294
}
295
295
296
- logger. info ( " Built SDK " )
296
+ logger. info ( " Built Swift SDK " )
297
+
298
+ // Cleanup
299
+ let cleanupSdk : ( ) async -> Void = {
300
+ logger. info ( " Removing Swift SDK to cleanup... " )
301
+ try ? await Shell . run ( " swift experimental-sdk remove \( bundleName) " )
302
+ }
297
303
298
304
for testcase in testcases {
299
- try await FileManager . default. withTemporaryDirectory ( logger: logger) { tempDir in
300
- try await buildTestcase ( logger, testcase: testcase, bundleName: bundleName, tempDir: tempDir)
305
+ do {
306
+ try await FileManager . default. withTemporaryDirectory ( logger: logger) { tempDir in
307
+ try await buildTestcase ( logger, testcase: testcase, bundleName: bundleName, tempDir: tempDir)
308
+ }
309
+ } catch {
310
+ await cleanupSdk ( )
311
+ throw error
301
312
}
302
313
}
303
314
304
- // Cleanup
305
- logger. info ( " Removing SDK to cleanup... " )
306
- try await Shell . run ( " swift experimental-sdk remove \( bundleName) " )
315
+ await cleanupSdk ( )
307
316
}
308
317
309
318
final class Swift59_UbuntuEndToEndTests : XCTestCase {
@@ -316,22 +325,18 @@ final class Swift59_UbuntuEndToEndTests: XCTestCase {
316
325
)
317
326
318
327
func testAarch64Direct( ) async throws {
319
- try skipSlow ( )
320
328
try await buildTestcases ( config: config. withArchitecture ( " aarch64 " ) )
321
329
}
322
330
323
331
func testX86_64Direct( ) async throws {
324
- try skipSlow ( )
325
332
try await buildTestcases ( config: config. withArchitecture ( " x86_64 " ) )
326
333
}
327
334
328
335
func testAarch64FromContainer( ) async throws {
329
- try skipSlow ( )
330
336
try await buildTestcases ( config: config. withArchitecture ( " aarch64 " ) . withDocker ( ) )
331
337
}
332
338
333
339
func testX86_64FromContainer( ) async throws {
334
- try skipSlow ( )
335
340
try await buildTestcases ( config: config. withArchitecture ( " x86_64 " ) . withDocker ( ) )
336
341
}
337
342
}
@@ -346,22 +351,18 @@ final class Swift510_UbuntuEndToEndTests: XCTestCase {
346
351
)
347
352
348
353
func testAarch64Direct( ) async throws {
349
- try skipSlow ( )
350
354
try await buildTestcases ( config: config. withArchitecture ( " aarch64 " ) )
351
355
}
352
356
353
357
func testX86_64Direct( ) async throws {
354
- try skipSlow ( )
355
358
try await buildTestcases ( config: config. withArchitecture ( " x86_64 " ) )
356
359
}
357
360
358
361
func testAarch64FromContainer( ) async throws {
359
- try skipSlow ( )
360
362
try await buildTestcases ( config: config. withArchitecture ( " aarch64 " ) . withDocker ( ) )
361
363
}
362
364
363
365
func testX86_64FromContainer( ) async throws {
364
- try skipSlow ( )
365
366
try await buildTestcases ( config: config. withArchitecture ( " x86_64 " ) . withDocker ( ) )
366
367
}
367
368
}
@@ -376,22 +377,18 @@ final class Swift60_UbuntuEndToEndTests: XCTestCase {
376
377
)
377
378
378
379
func testAarch64Direct( ) async throws {
379
- try skipSlow ( )
380
380
try await buildTestcases ( config: config. withArchitecture ( " aarch64 " ) )
381
381
}
382
382
383
383
func testX86_64Direct( ) async throws {
384
- try skipSlow ( )
385
384
try await buildTestcases ( config: config. withArchitecture ( " x86_64 " ) )
386
385
}
387
386
388
387
func testAarch64FromContainer( ) async throws {
389
- try skipSlow ( )
390
388
try await buildTestcases ( config: config. withArchitecture ( " aarch64 " ) . withDocker ( ) )
391
389
}
392
390
393
391
func testX86_64FromContainer( ) async throws {
394
- try skipSlow ( )
395
392
try await buildTestcases ( config: config. withArchitecture ( " x86_64 " ) . withDocker ( ) )
396
393
}
397
394
}
@@ -406,12 +403,10 @@ final class Swift59_RHELEndToEndTests: XCTestCase {
406
403
)
407
404
408
405
func testAarch64FromContainer( ) async throws {
409
- try skipSlow ( )
410
406
try await buildTestcases ( config: config. withArchitecture ( " aarch64 " ) . withDocker ( ) )
411
407
}
412
408
413
409
func testX86_64FromContainer( ) async throws {
414
- try skipSlow ( )
415
410
try await buildTestcases ( config: config. withArchitecture ( " x86_64 " ) . withDocker ( ) )
416
411
}
417
412
}
@@ -426,12 +421,10 @@ final class Swift510_RHELEndToEndTests: XCTestCase {
426
421
)
427
422
428
423
func testAarch64FromContainer( ) async throws {
429
- try skipSlow ( )
430
424
try await buildTestcases ( config: config. withArchitecture ( " aarch64 " ) . withDocker ( ) )
431
425
}
432
426
433
427
func testX86_64FromContainer( ) async throws {
434
- try skipSlow ( )
435
428
try await buildTestcases ( config: config. withArchitecture ( " x86_64 " ) . withDocker ( ) )
436
429
}
437
430
}
@@ -446,12 +439,10 @@ final class Swift60_RHELEndToEndTests: XCTestCase {
446
439
)
447
440
448
441
func testAarch64FromContainer( ) async throws {
449
- try skipSlow ( )
450
442
try await buildTestcases ( config: config. withArchitecture ( " aarch64 " ) . withDocker ( ) )
451
443
}
452
444
453
445
func testX86_64FromContainer( ) async throws {
454
- try skipSlow ( )
455
446
try await buildTestcases ( config: config. withArchitecture ( " x86_64 " ) . withDocker ( ) )
456
447
}
457
448
}
0 commit comments