aboutsummaryrefslogtreecommitdiffstats
path: root/device/device_test.go
diff options
context:
space:
mode:
authorJosh Bleecher Snyder <josh@tailscale.com>2021-01-05 16:04:38 -0800
committerJason A. Donenfeld <Jason@zx2c4.com>2021-01-07 14:49:44 +0100
commit8a304155554a16285b5334ae4a02e09adfb0bde1 (patch)
tree33122e57ff5346be5e07ee73e41ac0d0e88360df /device/device_test.go
parentdevice: make test infrastructure usable with benchmarks (diff)
downloadwireguard-go-8a304155554a16285b5334ae4a02e09adfb0bde1.tar.xz
wireguard-go-8a304155554a16285b5334ae4a02e09adfb0bde1.zip
device: use LogLevelError for benchmarking
This keeps the output minimal and focused on the benchmark results. Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
Diffstat (limited to 'device/device_test.go')
-rw-r--r--device/device_test.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/device/device_test.go b/device/device_test.go
index 6cfe22f..09b5152 100644
--- a/device/device_test.go
+++ b/device/device_test.go
@@ -146,7 +146,11 @@ NextAttempt:
} else {
p.ip = net.ParseIP("1.0.0.2")
}
- p.dev = NewDevice(p.tun.TUN(), NewLogger(LogLevelDebug, fmt.Sprintf("dev%d: ", i)))
+ level := LogLevelDebug
+ if _, ok := tb.(*testing.B); ok && !testing.Verbose() {
+ level = LogLevelError
+ }
+ p.dev = NewDevice(p.tun.TUN(), NewLogger(level, fmt.Sprintf("dev%d: ", i)))
p.dev.Up()
if err := p.dev.IpcSetOperation(cfg[i]); err != nil {
// genConfigs attempted to pick ports that were free.