diff --git a/.travis.yml b/.travis.yml index 85549e7d07a277b11fa7bc21ab5ee2ec46b08edb..23775ec6e5ed1e5575784be1df10f7790fc62301 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,31 @@ +os: + - linux + language: go + go: - - 1.11.x - - 1.12.x - - 1.13.x - - tip -before_install: - - travis_retry go get github.com/mattn/goveralls + - 1.14.x + - 1.15.x + +env: + global: + - GOTFLAGS="-race" + matrix: + - BUILD_DEPTYPE=gomod + + +# disable travis install +install: + - true + script: - - go test -v -covermode=count -coverprofile=coverage.out ./... - - travis_retry $HOME/gopath/bin/goveralls -coverprofile=coverage.out -service=travis-ci + - bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh) + + +cache: + directories: + - $GOPATH/pkg/mod + - $HOME/.cache/go-build + +notifications: + email: false diff --git a/cidranger_test.go b/cidranger_test.go index 6873bc5247fb6651a33da73413784259f7dd1f8e..e727b95b5def70b31185ce86b78143f900ac6880 100644 --- a/cidranger_test.go +++ b/cidranger_test.go @@ -8,8 +8,8 @@ import ( "testing" "time" - "github.com/stretchr/testify/assert" rnet "github.com/libp2p/go-cidranger/net" + "github.com/stretchr/testify/assert" ) /* diff --git a/go.mod b/go.mod index 7399cf576f0bc2cd68cafc3f1deb8cf08948a87a..675626691b9b86a74d658d9c28aa3f7739afb217 100644 --- a/go.mod +++ b/go.mod @@ -1,5 +1,8 @@ module github.com/libp2p/go-cidranger -go 1.13 +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 b459ab081fbdc9c8319903dc48db41d9f6d38bf2..1461702bd3b34597f8dbe6f9160dc41952e76117 100644 --- a/trie_test.go +++ b/trie_test.go @@ -2,14 +2,15 @@ package cidranger import ( "encoding/binary" + detectrace "github.com/ipfs/go-detect-race" "math/rand" "net" "runtime" "testing" "time" - "github.com/stretchr/testify/assert" rnet "github.com/libp2p/go-cidranger/net" + "github.com/stretchr/testify/assert" ) func getAllByVersion(version rnet.IPVersion) *net.IPNet { @@ -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