Skip to content

Commit a14657f

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 explicitly skips the tests when running under CI. The tests can be run under macOS and Linux for local testing. Fixes: #143
1 parent 1d92dfc commit a14657f

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-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: 18 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()
@@ -118,6 +119,12 @@ final class EndToEndTests: XCTestCase {
118119
}
119120

120121
for runArguments in possibleArguments {
122+
if runArguments.contains("rhel") {
123+
// Temporarily skip the RHEL-based SDK. XCTSkip() is not suitable as it would skipping the entire test case
124+
logger.warning("RHEL-based SDKs currently do not work with Swift 6.0: https://github.com/swiftlang/swift-sdk-generator/issues/138")
125+
continue
126+
}
127+
121128
let bundleName = try await FileManager.default.withTemporaryDirectory(logger: logger) { tempDir in
122129
try await buildSDK(inDirectory: packageDirectory, scratchPath: tempDir.path, withArguments: runArguments)
123130
}
@@ -149,7 +156,9 @@ final class EndToEndTests: XCTestCase {
149156
}
150157

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

154163
var packageDirectory = FilePath(#filePath)
155164
packageDirectory.removeLastComponent()
@@ -166,11 +175,16 @@ final class EndToEndTests: XCTestCase {
166175
}
167176

168177
for runArguments in possibleArguments {
178+
if runArguments.contains("rhel") {
179+
// Temporarily skip the RHEL-based SDK. XCTSkip() is not suitable as it would skipping the entire test case
180+
logger.warning("RHEL-based SDKs currently do not work with Swift 6.0: https://github.com/swiftlang/swift-sdk-generator/issues/138")
181+
continue
182+
}
183+
169184
try await FileManager.default.withTemporaryDirectory(logger: logger) { tempDir in
170185
let _ = try await buildSDK(inDirectory: packageDirectory, scratchPath: tempDir.path, withArguments: runArguments)
171186
let _ = try await buildSDK(inDirectory: packageDirectory, scratchPath: tempDir.path, withArguments: runArguments)
172187
}
173188
}
174189
}
175-
#endif
176190
}

0 commit comments

Comments
 (0)