| 123456789101112131415161718192021222324 |
- //go:build linux
- package serialtransport
- import "sync/atomic"
- // Test-only write fault injection. Zero cap means unlimited.
- var testWriteCap atomic.Int32
- var testForceErr atomic.Bool
- var testIgnoreContext atomic.Bool
- func SetTestWriteCap(n int) {
- testWriteCap.Store(int32(n))
- }
- func SetTestForceWriteError(v bool) {
- testForceErr.Store(v)
- }
- // SetTestIgnoreContext makes ReadFrame ignore ctx cancellation until the FD
- // is closed. Production code never enables this; it models a stuck driver.
- func SetTestIgnoreContext(v bool) {
- testIgnoreContext.Store(v)
- }
|