test: add coverage flush helper
This commit is contained in:
18
apps/macos/Tests/ClawdisIPCTests/CoverageDumpTests.swift
Normal file
18
apps/macos/Tests/ClawdisIPCTests/CoverageDumpTests.swift
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
import Darwin
|
||||||
|
import Foundation
|
||||||
|
import Testing
|
||||||
|
|
||||||
|
@Suite(.serialized)
|
||||||
|
struct CoverageDumpTests {
|
||||||
|
@Test func periodicallyFlushCoverage() async {
|
||||||
|
guard ProcessInfo.processInfo.environment["LLVM_PROFILE_FILE"] != nil else { return }
|
||||||
|
let deadline = Date().addingTimeInterval(4)
|
||||||
|
while Date() < deadline {
|
||||||
|
_ = llvmProfileWriteFile()
|
||||||
|
try? await Task.sleep(nanoseconds: 250_000_000)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@_silgen_name("__llvm_profile_write_file")
|
||||||
|
private func llvmProfileWriteFile() -> Int32
|
||||||
Reference in New Issue
Block a user