Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Tests/IncrementalTestFramework/Source.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ public struct Source: Hashable, Comparable {
public init?(named name: String,
at relativePath: RelativePath,
on fileSystem: FileSystem = localFileSystem) throws {
guard let absPath = Fixture.fixturePath(at: relativePath,
for: "\(name).swift",
on: fileSystem)
guard let absPath = try Fixture.fixturePath(at: relativePath,
for: "\(name).swift",
on: fileSystem)
else {
return nil
}
Expand Down
20 changes: 10 additions & 10 deletions Tests/SwiftDriverTests/APIDigesterTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class APIDigesterTests: XCTestCase {
"-output-file-map", ofmPath.pathString,
])
let digesterJob = try XCTUnwrap(driver.planBuild().first { $0.kind == .generateABIBaseline })
XCTAssertTrue(digesterJob.commandLine.contains(subsequence: ["-o", .path(.absolute(.init("/path/to/baseline.abi.json")))]))
try XCTAssertTrue(digesterJob.commandLine.contains(subsequence: ["-o", .path(.absolute(.init(validating: "/path/to/baseline.abi.json")))]))
}
}
do {
Expand All @@ -136,7 +136,7 @@ class APIDigesterTests: XCTestCase {
"-output-file-map", ofmPath.pathString,
])
let digesterJob = try XCTUnwrap(driver.planBuild().first { $0.kind == .generateABIBaseline })
XCTAssertTrue(digesterJob.commandLine.contains(subsequence: ["-o", .path(.absolute(.init("/path/to/sourceinfo.abi.json")))]))
try XCTAssertTrue(digesterJob.commandLine.contains(subsequence: ["-o", .path(.absolute(.init(validating: "/path/to/sourceinfo.abi.json")))]))
}
}
}
Expand All @@ -149,8 +149,8 @@ class APIDigesterTests: XCTestCase {
XCTAssertTrue(digesterJob.commandLine.contains("-dump-sdk"))
XCTAssertTrue(digesterJob.commandLine.contains(subsequence: ["-module", "foo"]))
XCTAssertTrue(digesterJob.commandLine.contains(subsequence: ["-I", .path(.relative(.init(".")))]))
XCTAssertTrue(digesterJob.commandLine.contains(subsequence: ["-sdk", .path(.absolute(.init("/path/to/sdk")))]))
XCTAssertTrue(digesterJob.commandLine.contains(subsequence: ["-I", .path(.absolute(.init("/some/path")))]))
try XCTAssertTrue(digesterJob.commandLine.contains(subsequence: ["-sdk", .path(.absolute(.init(validating: "/path/to/sdk")))]))
try XCTAssertTrue(digesterJob.commandLine.contains(subsequence: ["-I", .path(.absolute(.init(validating: "/some/path")))]))
XCTAssertTrue(digesterJob.commandLine.contains(subsequence: ["-F", .path(.relative(.init("framework/path")))]))
XCTAssertTrue(digesterJob.commandLine.contains(subsequence: ["-o", .path(.relative(.init("foo.api.json")))]))

Expand All @@ -165,8 +165,8 @@ class APIDigesterTests: XCTestCase {
XCTAssertTrue(digesterJob.commandLine.contains("-dump-sdk"))
XCTAssertTrue(digesterJob.commandLine.contains(subsequence: ["-module", "foo"]))
XCTAssertTrue(digesterJob.commandLine.contains(subsequence: ["-I", .path(.relative(.init(".")))]))
XCTAssertTrue(digesterJob.commandLine.contains(subsequence: ["-sdk", .path(.absolute(.init("/path/to/sdk")))]))
XCTAssertTrue(digesterJob.commandLine.contains(subsequence: ["-I", .path(.absolute(.init("/some/path")))]))
try XCTAssertTrue(digesterJob.commandLine.contains(subsequence: ["-sdk", .path(.absolute(.init(validating: "/path/to/sdk")))]))
try XCTAssertTrue(digesterJob.commandLine.contains(subsequence: ["-I", .path(.absolute(.init(validating: "/some/path")))]))
XCTAssertTrue(digesterJob.commandLine.contains(subsequence: ["-F", .path(.relative(.init("framework/path")))]))
XCTAssertTrue(digesterJob.commandLine.contains(subsequence: ["-o", .path(.relative(.init("foo.abi.json")))]))

Expand Down Expand Up @@ -238,10 +238,10 @@ class APIDigesterTests: XCTestCase {
let digesterJob = try XCTUnwrap(driver.planBuild().first { $0.kind == .compareAPIBaseline })
XCTAssertTrue(digesterJob.commandLine.contains("-diagnose-sdk"))
XCTAssertTrue(digesterJob.commandLine.contains(subsequence: ["-module", "foo"]))
XCTAssertTrue(digesterJob.commandLine.contains(subsequence: ["-baseline-path", .path(.absolute(.init("/baseline/path")))]))
try XCTAssertTrue(digesterJob.commandLine.contains(subsequence: ["-baseline-path", .path(.absolute(.init(validating: "/baseline/path")))]))
XCTAssertTrue(digesterJob.commandLine.contains(subsequence: ["-I", .path(.relative(.init(".")))]))
XCTAssertTrue(digesterJob.commandLine.contains(subsequence: ["-sdk", .path(.absolute(.init("/path/to/sdk")))]))
XCTAssertTrue(digesterJob.commandLine.contains(subsequence: ["-I", .path(.absolute(.init("/some/path")))]))
try XCTAssertTrue(digesterJob.commandLine.contains(subsequence: ["-sdk", .path(.absolute(.init(validating: "/path/to/sdk")))]))
try XCTAssertTrue(digesterJob.commandLine.contains(subsequence: ["-I", .path(.absolute(.init(validating: "/some/path")))]))
XCTAssertTrue(digesterJob.commandLine.contains(subsequence: ["-F", .path(.relative(.init("framework/path")))]))
XCTAssertTrue(digesterJob.commandLine.contains(subsequence: ["-breakage-allowlist-path",
.path(.relative(.init("allowlist/path")))]))
Expand All @@ -257,7 +257,7 @@ class APIDigesterTests: XCTestCase {
"-digester-breakage-allowlist-path", "allowlist/path"])
let digesterJob = try XCTUnwrap(driver.planBuild().first { $0.kind == .compareABIBaseline })
XCTAssertTrue(digesterJob.commandLine.contains("-diagnose-sdk"))
XCTAssertTrue(digesterJob.commandLine.contains(subsequence: ["-input-paths", .path(.absolute(.init("/baseline/path")))]))
try XCTAssertTrue(digesterJob.commandLine.contains(subsequence: ["-input-paths", .path(.absolute(.init(validating: "/baseline/path")))]))
XCTAssertTrue(digesterJob.commandLine.contains(subsequence: ["-breakage-allowlist-path",
.path(.relative(.init("allowlist/path")))]))
XCTAssertTrue(digesterJob.commandLine.contains("-abi"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class DependencyGraphSerializationTests: XCTestCase, ModuleDependencyGraphMocker
///
/// Ensure that a round-trip fails when the minor version number changes
func testSerializedVersionChangeDetection() throws {
let mockPath = VirtualPath.absolute(AbsolutePath("/module-dependency-graph"))
let mockPath = try VirtualPath.absolute(AbsolutePath(validating: "/module-dependency-graph"))
let fs = InMemoryFileSystem()
let graph = Self.mockGraphCreator.mockUpAGraph()
let currentVersion = ModuleDependencyGraph.serializedGraphVersion
Expand Down Expand Up @@ -54,7 +54,7 @@ class DependencyGraphSerializationTests: XCTestCase, ModuleDependencyGraphMocker
}

func roundTrip(_ originalGraph: ModuleDependencyGraph) throws {
let mockPath = VirtualPath.absolute(AbsolutePath("/module-dependency-graph"))
let mockPath = try VirtualPath.absolute(AbsolutePath(validating: "/module-dependency-graph"))
let fs = InMemoryFileSystem()
try originalGraph.blockingConcurrentMutation {
try originalGraph.write(to: mockPath, on: fs, compilerVersion: "Swift 99")
Expand Down
6 changes: 3 additions & 3 deletions Tests/SwiftDriverTests/ExplicitModuleBuildTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import XCTest
import TestUtilities

private var testInputsPath: AbsolutePath = {
var root: AbsolutePath = AbsolutePath(#file)
var root: AbsolutePath = try! AbsolutePath(validating: #file)
while root.basename != "Tests" {
root = root.parentDirectory
}
Expand Down Expand Up @@ -244,7 +244,7 @@ final class ExplicitModuleBuildTests: XCTestCase {
func testModuleDependencyBuildCommandGenerationWithExternalFramework() throws {
do {
let externalDetails: ExternalTargetModuleDetailsMap =
[.swiftPrebuiltExternal("A"): ExternalTargetModuleDetails(path: AbsolutePath("/tmp/A.swiftmodule"),
[.swiftPrebuiltExternal("A"): ExternalTargetModuleDetails(path: try AbsolutePath(validating: "/tmp/A.swiftmodule"),
isFramework: true)]
var driver = try Driver(args: ["swiftc", "-explicit-module-build",
"-module-name", "testModuleDependencyBuildCommandGenerationWithExternalFramework",
Expand Down Expand Up @@ -946,7 +946,7 @@ final class ExplicitModuleBuildTests: XCTestCase {
env: ProcessEnv.vars)
let sdkPath = try executor.checkNonZeroExit(
args: "xcrun", "-sdk", "macosx", "--show-sdk-path").spm_chomp()
let stdLibPath = AbsolutePath(sdkPath).appending(component: "usr")
let stdLibPath = try AbsolutePath(validating: sdkPath).appending(component: "usr")
.appending(component: "lib")
.appending(component: "swift")
return (stdLibPath, stdLibPath.appending(component: "shims"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class IncrementalBuildPerformanceTests: XCTestCase {
throw XCTSkip()
#else

let packageRootPath = AbsolutePath(#file)
let packageRootPath = try AbsolutePath(validating: #file)
.parentDirectory
.parentDirectory
.parentDirectory
Expand Down
2 changes: 1 addition & 1 deletion Tests/SwiftDriverTests/IncrementalCompilationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import TestUtilities
// MARK: - Instance variables and initialization
final class IncrementalCompilationTests: XCTestCase {

var tempDir: AbsolutePath = AbsolutePath("/tmp")
var tempDir = try! AbsolutePath(validating: "/tmp")

var derivedDataDir: AbsolutePath {
tempDir.appending(component: "derivedData")
Expand Down
10 changes: 5 additions & 5 deletions Tests/SwiftDriverTests/IntegrationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ import TSCBasic
#if os(macOS)
internal func bundleRoot() -> AbsolutePath {
for bundle in Bundle.allBundles where bundle.bundlePath.hasSuffix(".xctest") {
return AbsolutePath(bundle.bundlePath).parentDirectory
return try! AbsolutePath(validating: bundle.bundlePath).parentDirectory
}
fatalError()
}

private let packageDirectory = AbsolutePath(#file).parentDirectory.parentDirectory.parentDirectory
private let packageDirectory = try! AbsolutePath(validating: #file).parentDirectory.parentDirectory.parentDirectory

// The "default" here means lit.py will be invoked as an executable, while otherwise let's use
// python 3 explicitly.
Expand Down Expand Up @@ -95,7 +95,7 @@ final class IntegrationTests: IntegrationTestCase {
environment: ProcessEnv.vars.merging(extraEnv) { $1 }
)

XCTAssertTrue(localFileSystem.isExecutableFile(AbsolutePath("debug/swift-driver", relativeTo: buildPath)), result)
try XCTAssertTrue(localFileSystem.isExecutableFile(AbsolutePath(validating: "debug/swift-driver", relativeTo: buildPath)), result)
}
#endif
}
Expand Down Expand Up @@ -173,8 +173,8 @@ final class IntegrationTests: IntegrationTestCase {
// you've cloned this package into a Swift compiler working directory,
// that means it'll be the directory with build/, llvm/, swift/, and
// swift-driver/ in it.
let litConfigDir = AbsolutePath(
litConfigPathString,
let litConfigDir = try AbsolutePath(
validating: litConfigPathString,
relativeTo: swiftRootDir
)

Expand Down
Loading