mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-09 15:37:56 -05:00
* updating the goethereum dependency * fixing dependencies * reverting workspace * more fixes, work in progress * trying with upgraded geth version * fixing deprecated functions except for the time related ones on eth1 distance due to time issues * fixing time issues * gaz * fixing test and upgrading some dependencies and reverting others * Disable cgo in hid, delete old vendored usb library * changelog * rolling back dependencies * fixing go mod tidy * Geth v1.13.6 * fix tests * Add ping interval, set to 500ms for tests. This didnt work * Update to v1.14.8 * Spread it out to different bootnodes * Fix it * Remove Memsize * Update all out of date dependencies * Fix geth body change * Fix Test * Fix Build * Fix Tests * Fix Tests Again * Fix Tests Again * Fix Tests * Fix Test * Copy USB Package for HID * Push it up * Finally fix all tests with felix's changes * updating geth dependency * Update go-ethereum to v1.14.11 * fixing import * reverting blob change * fixing Implicit memory aliasing in for loop. * WIP changes * wip getting a little further on e2e runs * getting a little further * getting a little further * setting everything to capella * more partial fixes * more fixes but still WIP * fixing access list transactions" * some cleanup * making configs dynamic * reverting time * skip lower bound in builder * updating to geth v1.14.12 * fixing verify blob to pointer * go mod tidy * fixing linting * missed removing another terminal difficulty item * another missed update * updating more dependencies to fix cicd * fixing holiman dependency update * downgrading geth to 1.14.11 due to p2p loop issue * reverting builder middleware caused by downgrade * fixing more rollback issues * upgrading back to 1.14.12 after discussing with preston * mod tidy * gofmt * partial review feedback * trying to start e2e from bellatrix instead * reverting some changes --------- Co-authored-by: Preston Van Loon <preston@pvl.dev> Co-authored-by: nisdas <nishdas93@gmail.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 hid
|
|
|
|
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()
|
|
}
|