Skip to content

Commit

Permalink
Stop using XCTest in MMIOFileCheckTests (#138)
Browse files Browse the repository at this point in the history
Replaces XCTest with Swift-Testing and drops direct use of Dispatch in
MMIOFileCheckTests. This hopefully resolves whatever issue was causing
Dispatch to crash.
  • Loading branch information
rauhul authored Dec 15, 2024
1 parent 08e0b24 commit 0584c0d
Show file tree
Hide file tree
Showing 6 changed files with 145 additions and 166 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/swift.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ jobs:
- name: jammy
version: "22.04"
swift:
- repo: swift
version: "6.0"
- repo: swiftlang/swift
version: "nightly-6.1"
- repo: swiftlang/swift
version: "nightly-main"
container: ${{ matrix.swift.repo }}:${{ matrix.swift.version }}-${{ matrix.os.name }}
Expand Down
2 changes: 1 addition & 1 deletion Sources/MMIOUtilities/ShellCommand.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public func sh(
_ command: String,
collectStandardOutput: Bool = true,
collectStandardError: Bool = true
) throws -> String {
) throws(ShellCommandError) -> String {
let process = Process()
process.executableURL = URL(fileURLWithPath: "/bin/sh")
process.arguments = ["-c", "export PATH=$PATH:~/bin; \(command)"]
Expand Down
12 changes: 6 additions & 6 deletions Tests/MMIOFileCheckTests/FileCheck/SimpleFileCheck.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@ import MMIOUtilities
///
/// SimpleFileCheck is not intended for general use.
struct SimpleFileCheck {
var inputFileURL: URL
var outputFileURL: URL
var inputFile: URL
var outputFile: URL
}

extension SimpleFileCheck {
func run() -> [LLVMDiagnostic] {
// Load the input file and split it into lines. If we can't load the file,
// return and report diagnostics.
let inputPath = self.inputFileURL.path
let inputPath = self.inputFile.path
let input: String
do {
input = try String(contentsOf: self.inputFileURL, encoding: .utf8)
input = try String(contentsOf: self.inputFile, encoding: .utf8)
} catch {
return [.failedToLoadFile(at: inputPath, error: error)]
}
Expand All @@ -37,10 +37,10 @@ extension SimpleFileCheck {

// Load the output file and split it into lines. If we can't load the file,
// return and report diagnostics.
let outputPath = self.outputFileURL.path
let outputPath = self.outputFile.path
let output: String
do {
output = try String(contentsOf: self.outputFileURL, encoding: .utf8)
output = try String(contentsOf: self.outputFile, encoding: .utf8)
} catch {
return [.failedToLoadFile(at: outputPath, error: error)]
}
Expand Down
Loading

0 comments on commit 0584c0d

Please sign in to comment.