diff --git a/go.mod b/go.mod index 65f97c0fc2a78146b514ec62f39a45b7ae17e94e..675626691b9b86a74d658d9c28aa3f7739afb217 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 8fdee5854f19a573b93126b69063e996ad3fddd2..266bbff3f8aa7d42474961ba35492b0720aaa102 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 5b987d7672c75bfa420872412cf25e85fc4a456b..1461702bd3b34597f8dbe6f9160dc41952e76117 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