Skip to content

Commit ccb2a9b

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: #143
1 parent 1d92dfc commit ccb2a9b

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
@@ -73,7 +73,6 @@ final class EndToEndTests: XCTestCase {
7373
// This takes a lock on `.build`, but if the tests are being run by `swift test` the outer Swift Package Manager
7474
// instance will already hold this lock, causing the test to deadlock. We can work around this by giving
7575
// the `swift run swift-sdk-generator` instance its own scratch directory.
76-
#if !os(macOS)
7776
func buildSDK(inDirectory packageDirectory: FilePath, scratchPath: String, withArguments runArguments: String) async throws -> String {
7877
let generatorOutput = try await Shell.readStdout(
7978
"cd \(packageDirectory) && swift run --scratch-path \"\(scratchPath)\" swift-sdk-generator \(runArguments)"
@@ -101,7 +100,9 @@ final class EndToEndTests: XCTestCase {
101100
}
102101

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

106107
var packageDirectory = FilePath(#filePath)
107108
packageDirectory.removeLastComponent()
@@ -149,7 +150,9 @@ final class EndToEndTests: XCTestCase {
149150
}
150151

151152
func testRepeatedSDKBuilds() async throws {
152-
throw XCTSkip("EndToEnd tests currently deadlock under `swift test`: https://github.com/swiftlang/swift-sdk-generator/issues/143")
153+
if ProcessInfo.processInfo.environment.keys.contains("JENKINS_URL") {
154+
throw XCTSkip("EndToEnd tests cannot currently run in CI: https://github.com/swiftlang/swift-sdk-generator/issues/145")
155+
}
153156

154157
var packageDirectory = FilePath(#filePath)
155158
packageDirectory.removeLastComponent()
@@ -172,5 +175,4 @@ final class EndToEndTests: XCTestCase {
172175
}
173176
}
174177
}
175-
#endif
176178
}

0 commit comments

Comments
 (0)