import XCTest @testable import CodeBurnMenubar final class DataClientProcessTests: XCTestCase { /// Concurrency + timeout smoke test: launch more hung subprocesses than /// there are cooperative threads, all at once, with a short timeout, and /// assert every call returns once the timeout kills its sleep. /// /// NOTE: this does NOT reproduce the production permanent deadlock (16/16 /// cooperative threads parked in waitUntilExit). In a short-lived unit-test /// process libdispatch spins up replacement threads for blocked workers, so /// even the old blocking-on-the-pool code completes here. The real deadlock /// built up over ~2 days under the @MainActor refresh loop and is confirmed /// by the live `sample`, not by this test. Kept as a guard that the /// off-pool wait + timeout path stays correct under concurrency. func testConcurrentTimedOutProcessesAllComplete() { let count = ProcessInfo.processInfo.activeProcessorCount * 2 + 4 let done = DispatchSemaphore(value: 0) Task { await withTaskGroup(of: Void.self) { group in for _ in 0.. [Int32?] in for _ in 0..