From fa10554843cf84a25a2c76658a8e6d6c0f05cb7a Mon Sep 17 00:00:00 2001 From: Adin Schmahmann Date: Mon, 24 Aug 2020 19:35:37 -0400 Subject: [PATCH] test: skip trie memory usage test when the race detector is enabled --- go.mod | 5 ++++- go.sum | 2 ++ trie_test.go | 6 ++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 65f97c0..6756266 100644 --- a/go.mod +++ b/go.mod @@ -2,4 +2,7 @@ module github.com/libp2p/go-cidranger go 1.14 -require github.com/stretchr/testify v1.4.0 +require ( + github.com/ipfs/go-detect-race v0.0.1 + github.com/stretchr/testify v1.4.0 +) diff --git a/go.sum b/go.sum index 8fdee58..266bbff 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,7 @@ github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/ipfs/go-detect-race v0.0.1 h1:qX/xay2W3E4Q1U7d9lNs1sU9nvguX0a7319XbyQ6cOk= +github.com/ipfs/go-detect-race v0.0.1/go.mod h1:8BNT7shDZPo99Q74BpGMK+4D8Mn4j46UU0LZ723meps= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= diff --git a/trie_test.go b/trie_test.go index 5b987d7..1461702 100644 --- a/trie_test.go +++ b/trie_test.go @@ -2,6 +2,7 @@ package cidranger import ( "encoding/binary" + detectrace "github.com/ipfs/go-detect-race" "math/rand" "net" "runtime" @@ -486,6 +487,11 @@ func TestTrieMemUsage(t *testing.T) { if testing.Short() { t.Skip("Skipping memory test in `-short` mode") } + + if detectrace.WithRace() { + t.Skip("Skipping memory test in `-race` mode") + } + numIPs := 100000 runs := 10 -- GitLab