device: run fewer trials in TestWaitPool when race detector enabled
On a many-core machine with the race detector enabled, this test can take several minutes to complete. Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
This commit is contained in:
parent
ecceaadd16
commit
d117d42ae7
|
@ -17,6 +17,10 @@ import (
|
||||||
func TestWaitPool(t *testing.T) {
|
func TestWaitPool(t *testing.T) {
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
trials := int32(100000)
|
trials := int32(100000)
|
||||||
|
if raceEnabled {
|
||||||
|
// This test can be very slow with -race.
|
||||||
|
trials /= 10
|
||||||
|
}
|
||||||
workers := runtime.NumCPU() + 2
|
workers := runtime.NumCPU() + 2
|
||||||
if workers-4 <= 0 {
|
if workers-4 <= 0 {
|
||||||
t.Skip("Not enough cores")
|
t.Skip("Not enough cores")
|
||||||
|
|
10
device/race_disabled_test.go
Normal file
10
device/race_disabled_test.go
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
//+build !race
|
||||||
|
|
||||||
|
/* SPDX-License-Identifier: MIT
|
||||||
|
*
|
||||||
|
* Copyright (C) 2017-2021 WireGuard LLC. All Rights Reserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package device
|
||||||
|
|
||||||
|
const raceEnabled = false
|
10
device/race_enabled_test.go
Normal file
10
device/race_enabled_test.go
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
//+build race
|
||||||
|
|
||||||
|
/* SPDX-License-Identifier: MIT
|
||||||
|
*
|
||||||
|
* Copyright (C) 2017-2021 WireGuard LLC. All Rights Reserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package device
|
||||||
|
|
||||||
|
const raceEnabled = true
|
Loading…
Reference in a new issue