mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-09 15:37:56 -05:00
* Check in go-ethereum crypto/sepc256k1 package with proper build rules
* gaz
* Add karalabe/usb
* viz improvement
* Remove bazel-go-ethereum, use vendored libraries only
* move vendor stuff to third_party so that go mod wont be mad anymore
* fix geth e2e flags
* fix geth e2e flags
* remove old rules_foreign_cc toolchain
* Update cross compile docker image to support os x
* works for geth build
* remove copy of sepc256k1
* revert changes in tools/cross-toolchain
* gaz
* Update go-ethereum to 1.10.10
* Revert "revert changes in tools/cross-toolchain"
This reverts commit 2e8128f7c3.
* revert tags changes
Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
87 lines
2.5 KiB
Go
87 lines
2.5 KiB
Go
// usb - Self contained USB and HID library for Go
|
|
// Copyright 2017 The library Authors
|
|
//
|
|
// This library is free software: you can redistribute it and/or modify it under
|
|
// the terms of the GNU Lesser General Public License as published by the Free
|
|
// Software Foundation, either version 3 of the License, or (at your option) any
|
|
// later version.
|
|
//
|
|
// The library is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
// A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU Lesser General Public License along
|
|
// with the library. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
package usb
|
|
|
|
import (
|
|
"os"
|
|
"runtime"
|
|
"sync"
|
|
"testing"
|
|
)
|
|
|
|
// Tests that HID enumeration can be called concurrently from multiple threads.
|
|
func TestThreadedEnumerateHid(t *testing.T) {
|
|
var pend sync.WaitGroup
|
|
for i := 0; i < 8; i++ {
|
|
pend.Add(1)
|
|
|
|
go func(index int) {
|
|
defer pend.Done()
|
|
for j := 0; j < 512; j++ {
|
|
if _, err := EnumerateHid(uint16(index), 0); err != nil {
|
|
t.Errorf("thread %d, iter %d: failed to enumerate: %v", index, j, err)
|
|
}
|
|
}
|
|
}(i)
|
|
}
|
|
pend.Wait()
|
|
}
|
|
|
|
// Tests that RAW enumeration can be called concurrently from multiple threads.
|
|
func TestThreadedEnumerateRaw(t *testing.T) {
|
|
// Travis does not have usbfs enabled in the Linux kernel
|
|
if os.Getenv("TRAVIS") != "" && runtime.GOOS == "linux" {
|
|
t.Skip("Linux on Travis doesn't have usbfs, skipping test")
|
|
}
|
|
// Yay, we can actually test this
|
|
var pend sync.WaitGroup
|
|
for i := 0; i < 8; i++ {
|
|
pend.Add(1)
|
|
|
|
go func(index int) {
|
|
defer pend.Done()
|
|
for j := 0; j < 512; j++ {
|
|
if _, err := EnumerateRaw(uint16(index), 0); err != nil {
|
|
t.Errorf("thread %d, iter %d: failed to enumerate: %v", index, j, err)
|
|
}
|
|
}
|
|
}(i)
|
|
}
|
|
pend.Wait()
|
|
}
|
|
|
|
// Tests that generic enumeration can be called concurrently from multiple threads.
|
|
func TestThreadedEnumerate(t *testing.T) {
|
|
// Travis does not have usbfs enabled in the Linux kernel
|
|
if os.Getenv("TRAVIS") != "" && runtime.GOOS == "linux" {
|
|
t.Skip("Linux on Travis doesn't have usbfs, skipping test")
|
|
}
|
|
var pend sync.WaitGroup
|
|
for i := 0; i < 8; i++ {
|
|
pend.Add(1)
|
|
|
|
go func(index int) {
|
|
defer pend.Done()
|
|
for j := 0; j < 512; j++ {
|
|
if _, err := Enumerate(uint16(index), 0); err != nil {
|
|
t.Errorf("thread %d, iter %d: failed to enumerate: %v", index, j, err)
|
|
}
|
|
}
|
|
}(i)
|
|
}
|
|
pend.Wait()
|
|
}
|