aboutsummaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorJakob Unterwurzacher2023-09-15 23:11:58 +0200
committerJakob Unterwurzacher2023-09-15 23:19:02 +0200
commit3a65627316cb4d1c360ece87ec9a33e4c330d1aa (patch)
tree6a35d9b9d2b7fa6cf3f97ba28b9785e3eca00838 /internal
parent7fff33a1e2560c8f4eb1f477c1e220eeb14291ab (diff)
gocryptfs -speed: call testing.Init() to not panic
Looks like I should have been calling testing.Init() all along. From https://pkg.go.dev/testing#Init : > Init is only needed when calling functions such as > Benchmark without using "go test". Panic only affected without_openssl builds and looks like this: $ ./gocryptfs -speed gocryptfs v2.4.0-2-g8b1c4b0-dirty without_openssl; go-fuse v2.3.0; 2023-09-15 go1.21.1 linux/amd64 cpu: Intel(R) Core(TM) i5-6500 CPU @ 3.20GHz; with AES acceleration AES-GCM-256-OpenSSL panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x5a5d20] goroutine 7 [running]: testing.(*common).decorate(0x40d625?, {0xc00001c150, 0x2a}, 0x830601?) testing/testing.go:772 +0xa0 [...] Fixes: https://github.com/rfjakob/gocryptfs/issues/789 Relates-to: https://github.com/golang/go/issues/62666
Diffstat (limited to 'internal')
-rw-r--r--internal/speed/speed.go1
1 files changed, 1 insertions, 0 deletions
diff --git a/internal/speed/speed.go b/internal/speed/speed.go
index 47fe8c9..a361cf5 100644
--- a/internal/speed/speed.go
+++ b/internal/speed/speed.go
@@ -48,6 +48,7 @@ func Run() {
{name: cryptocore.BackendXChaCha20Poly1305OpenSSL.String(), f: bStupidXchacha, preferred: stupidgcm.PreferOpenSSLXchacha20poly1305()},
{name: cryptocore.BackendXChaCha20Poly1305.String(), f: bXchacha20poly1305, preferred: !stupidgcm.PreferOpenSSLXchacha20poly1305()},
}
+ testing.Init()
for _, b := range bTable {
fmt.Printf("%-26s\t", b.name)
mbs := mbPerSec(testing.Benchmark(b.f))