-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-process.swift
More file actions
executable file
·46 lines (37 loc) · 1.24 KB
/
test-process.swift
File metadata and controls
executable file
·46 lines (37 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env swift
import Foundation
// Simple test script to process tiff-samples
// Usage: swift test-process.swift
print("Starting HeyFoS test with tiff-samples/")
let startTime = Date()
// Build and run
let task = Process()
task.executableURL = URL(fileURLWithPath: "/usr/bin/swift")
task.arguments = [
"run", "heyfos-cli",
"--input", "tiff-samples/",
"--output", "result.tiff",
"--method", "laplacian",
"--pyramid-blending",
"--verbose"
]
task.currentDirectoryURL = URL(fileURLWithPath: FileManager.default.currentDirectoryPath)
do {
try task.run()
task.waitUntilExit()
let elapsed = Date().timeIntervalSince(startTime)
if task.terminationStatus == 0 {
print("\n✓ Success!")
print("⏱ Processing time: \(String(format: "%.1f", elapsed))s")
// Check result file
if FileManager.default.fileExists(atPath: "result.tiff") {
let attrs = try FileManager.default.attributesOfItem(atPath: "result.tiff")
let size = attrs[.size] as? UInt64 ?? 0
print("📁 Result size: \(size / 1024 / 1024)MB")
}
} else {
print("❌ Failed with code \(task.terminationStatus)")
}
} catch {
print("❌ Error: \(error)")
}