package xturbo import "time" // SetMaxReqWords exposes the Conn-owned BIG-REQUESTS limit setter to external tests. var SetMaxReqWords = (*Buf).setMaxReqWords // testTimeouts bounds every blocking call in tests so a broken script fails // fast instead of hanging until the go test timeout; tests of the deadlines // shorten them further with shortTimeouts. func init() { connectTimeout = 3 * time.Second syncTimeout = 3 * time.Second } // shortTimeouts sets d as both bounds for the test's duration. func shortTimeouts(t interface{ Cleanup(func()) }, d time.Duration) { c, s := connectTimeout, syncTimeout connectTimeout, syncTimeout = d, d t.Cleanup(func() { connectTimeout, syncTimeout = c, s }) } // ExhaustXIDs empties the setup range and the free list so the next NewXID // refills through XC-MISC. func ExhaustXIDs(c *Conn) { c.xids, c.xidFreeN = xidRange{}, 0 } // Root's own encoders of the requests it issues, compared with the generated // ones and the goldens by external tests. var ( EncodeQueryExtension = encodeQueryExtension EncodeInternAtom = encodeInternAtom EncodeGetInputFocus = encodeGetInputFocus EncodeBigreqEnable = func(b *Buf) Seq { return encodeExtRequest(b, ExtBigRequests, 0) } EncodeGetXIDRange = func(b *Buf) Seq { return encodeExtRequest(b, ExtXCMisc, minorGetXIDRange) } )