]> git.ipfire.org Git - thirdparty/wireguard-go.git/commitdiff
device: use LogLevelError for benchmarking
authorJosh Bleecher Snyder <josh@tailscale.com>
Wed, 6 Jan 2021 00:04:38 +0000 (16:04 -0800)
committerJason A. Donenfeld <Jason@zx2c4.com>
Thu, 7 Jan 2021 13:49:44 +0000 (14:49 +0100)
This keeps the output minimal and focused on the benchmark results.

Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
device/device_test.go

index 6cfe22f27bfe3199564eab796d1d74981144ed34..09b5152b9f0f3519a595cd5bda41aaff2a9b067f 100644 (file)
@@ -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.