Parallelize tests (#17)
* Store a reference to libusb implementation in the context, transfers and some more places. Remove the global libusb variable. * Parallelize tests. * Fix the link in README.
This commit is contained in:
@@ -135,7 +135,7 @@ type libusbIntf interface {
|
||||
init() (*libusbContext, error)
|
||||
handleEvents(*libusbContext, <-chan struct{})
|
||||
getDevices(*libusbContext) ([]*libusbDevice, error)
|
||||
exit(*libusbContext)
|
||||
exit(*libusbContext) error
|
||||
setDebug(*libusbContext, int)
|
||||
|
||||
// device
|
||||
@@ -213,8 +213,9 @@ func (libusbImpl) getDevices(ctx *libusbContext) ([]*libusbDevice, error) {
|
||||
return ret, nil
|
||||
}
|
||||
|
||||
func (libusbImpl) exit(c *libusbContext) {
|
||||
func (libusbImpl) exit(c *libusbContext) error {
|
||||
C.libusb_exit((*C.libusb_context)(c))
|
||||
return nil
|
||||
}
|
||||
|
||||
func (libusbImpl) setDebug(c *libusbContext, lvl int) {
|
||||
@@ -479,9 +480,6 @@ func (libusbImpl) setIsoPacketLengths(t *libusbTransfer, length uint32) {
|
||||
C.libusb_set_iso_packet_lengths((*C.struct_libusb_transfer)(t), C.uint(length))
|
||||
}
|
||||
|
||||
// libusb is an injection point for tests
|
||||
var libusb libusbIntf = libusbImpl{}
|
||||
|
||||
// xferDoneMap keeps a map of done callback channels for all allocated transfers.
|
||||
var xferDoneMap = struct {
|
||||
m map[*libusbTransfer]chan struct{}
|
||||
|
Reference in New Issue
Block a user