Skip to content

Commit

Permalink
tests: Enable EndToEnd tests, but skip in CI
Browse files Browse the repository at this point in the history
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
  • Loading branch information
euanh committed Nov 11, 2024
1 parent 1bcddfb commit dd7f401
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 2 additions & 0 deletions Docker/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ services:

test:
<<: *common
environment:
- JENKINS_URL
command: /bin/bash -xcl "swift test $${WARN_AS_ERROR_ARG-} $${SANITIZER_ARG-} $${IMPORT_CHECK_ARG-}"

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

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

var packageDirectory = FilePath(#filePath)
packageDirectory.removeLastComponent()
Expand Down Expand Up @@ -145,7 +146,9 @@ final class EndToEndTests: XCTestCase {
}

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

var packageDirectory = FilePath(#filePath)
packageDirectory.removeLastComponent()
Expand All @@ -168,5 +171,4 @@ final class EndToEndTests: XCTestCase {
}
}
}
#endif
}

0 comments on commit dd7f401

Please sign in to comment.