Skip to content

Commit

Permalink
tests: Run tests on Linux CI (#146)
Browse files Browse the repository at this point in the history
* QueryEngine: Calculate stable hashes for Foundation.URL and FoundationEssentials.URL

Until Swift 6.0, the fully-qualified name of the URL type was
`Foundation.URL`.  After the adoption of FoundationEssentials, the
name changed to `FoundationEssentials.URL`.  This difference causes
the hashes to change, so for backwards compatibility we pin the
type name to `Foundation.URL`.

Fixes #45

* tests: Run tests on Linux CI

The EndToEnd tests cannot currently be run:

* they deadlock when run under `swift test` (#143)
* the CI requires the use of an HTTP proxy to download from the
  Internet, but SDK generator does not support proxies (#145)

The tests are not compiled on macOS, but this commit marks
them with `XCTSkip` so they are not run on Linux either.

Future commits will loosen these restrictions.

Fixes #45
  • Loading branch information
euanh authored Nov 8, 2024
1 parent bde8791 commit 71e2d79
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 22 deletions.
2 changes: 1 addition & 1 deletion Docker/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ services:

test:
<<: *common
command: /bin/bash -xcl "./Utilities/test.sh $${WARN_AS_ERROR_ARG-} $${SANITIZER_ARG-} $${IMPORT_CHECK_ARG-}"
command: /bin/bash -xcl "swift test $${WARN_AS_ERROR_ARG-} $${SANITIZER_ARG-} $${IMPORT_CHECK_ARG-}"

# util

Expand Down
6 changes: 5 additions & 1 deletion Sources/Helpers/Vendor/QueryEngine/CacheKey.swift
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,11 @@ extension FilePath.Component: LeafCacheKey {

extension URL: LeafCacheKey {
func hash(with hashFunction: inout some HashFunction) {
String(reflecting: Self.self).hash(with: &hashFunction)
// Until Swift 6.0, the fully-qualified name of the URL type was `Foundation.URL`.
// After the adoption of FoundationEssentials, the name changed to `FoundationEssentials.URL`.
// This difference causes the hashes to change, so for backwards compatibility we pin the
// type name to `Foundation.URL`.
"Foundation.URL".hash(with: &hashFunction)
self.description.hash(with: &hashFunction)
}
}
4 changes: 4 additions & 0 deletions Tests/SwiftSDKGeneratorTests/EndToEndTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ final class EndToEndTests: XCTestCase {

#if !os(macOS)
func testPackageInitExecutable() async throws {
throw XCTSkip("EndToEnd tests currently deadlock under `swift test`: https://github.com/swiftlang/swift-sdk-generator/issues/143")

let fm = FileManager.default

var packageDirectory = FilePath(#filePath)
Expand Down Expand Up @@ -102,6 +104,8 @@ 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")

let fm = FileManager.default

var packageDirectory = FilePath(#filePath)
Expand Down
20 changes: 0 additions & 20 deletions Utilities/test.sh

This file was deleted.

0 comments on commit 71e2d79

Please sign in to comment.