Skip to content

Commit dd7f401

Browse files
committed
tests: Enable EndToEnd tests, but skip in CI
The EndToEnd tests no longer deadlock under `swift test` and can now be run on macOS and Linux. The CI cannot currently run the end to end tests because SDK generator cannot use the CI HTTP proxy to download packages. This commit allows the tests on macOS, so they can be run locally, but explictly skips them in CI. Fixes: swiftlang#143
1 parent 1bcddfb commit dd7f401

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

Docker/docker-compose.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ services:
2525

2626
test:
2727
<<: *common
28+
environment:
29+
- JENKINS_URL
2830
command: /bin/bash -xcl "swift test $${WARN_AS_ERROR_ARG-} $${SANITIZER_ARG-} $${IMPORT_CHECK_ARG-}"
2931

3032
# util

Tests/SwiftSDKGeneratorTests/EndToEndTests.swift

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ final class EndToEndTests: XCTestCase {
6969
// This takes a lock on `.build`, but if the tests are being run by `swift test` the outer Swift Package Manager
7070
// instance will already hold this lock, causing the test to deadlock. We can work around this by giving
7171
// the `swift run swift-sdk-generator` instance its own scratch directory.
72-
#if !os(macOS)
7372
func buildSDK(inDirectory packageDirectory: FilePath, scratchPath: String, withArguments runArguments: String) async throws -> String {
7473
let generatorOutput = try await Shell.readStdout(
7574
"cd \(packageDirectory) && swift run --scratch-path \"\(scratchPath)\" swift-sdk-generator \(runArguments)"
@@ -97,7 +96,9 @@ final class EndToEndTests: XCTestCase {
9796
}
9897

9998
func testPackageInitExecutable() async throws {
100-
throw XCTSkip("EndToEnd tests currently deadlock under `swift test`: https://github.com/swiftlang/swift-sdk-generator/issues/143")
99+
if ProcessInfo.processInfo.environment.keys.contains("JENKINS_URL") {
100+
throw XCTSkip("EndToEnd tests cannot currently run in CI: https://github.com/swiftlang/swift-sdk-generator/issues/145")
101+
}
101102

102103
var packageDirectory = FilePath(#filePath)
103104
packageDirectory.removeLastComponent()
@@ -145,7 +146,9 @@ final class EndToEndTests: XCTestCase {
145146
}
146147

147148
func testRepeatedSDKBuilds() async throws {
148-
throw XCTSkip("EndToEnd tests currently deadlock under `swift test`: https://github.com/swiftlang/swift-sdk-generator/issues/143")
149+
if ProcessInfo.processInfo.environment.keys.contains("JENKINS_URL") {
150+
throw XCTSkip("EndToEnd tests cannot currently run in CI: https://github.com/swiftlang/swift-sdk-generator/issues/145")
151+
}
149152

150153
var packageDirectory = FilePath(#filePath)
151154
packageDirectory.removeLastComponent()
@@ -168,5 +171,4 @@ final class EndToEndTests: XCTestCase {
168171
}
169172
}
170173
}
171-
#endif
172174
}

0 commit comments

Comments
 (0)