mirror of
https://github.com/ipfs/kubo.git
synced 2025-06-30 01:52:26 +08:00
Merge pull request #4686 from ipfs/extract/detect-race
Extract go-detect-race from Godeps
This commit is contained in:
4
Godeps/Godeps.json
generated
4
Godeps/Godeps.json
generated
@ -29,10 +29,6 @@
|
|||||||
"ImportPath": "github.com/hashicorp/golang-lru",
|
"ImportPath": "github.com/hashicorp/golang-lru",
|
||||||
"Rev": "253b2dc1ca8bae42c3b5b6e53dd2eab1a7551116"
|
"Rev": "253b2dc1ca8bae42c3b5b6e53dd2eab1a7551116"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"ImportPath": "github.com/jbenet/go-detect-race",
|
|
||||||
"Rev": "3463798d9574bd0b7eca275dccc530804ff5216f"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/jbenet/go-os-rename",
|
"ImportPath": "github.com/jbenet/go-os-rename",
|
||||||
"Rev": "3ac97f61ef67a6b87b95c1282f6c317ed0e693c2"
|
"Rev": "3ac97f61ef67a6b87b95c1282f6c317ed0e693c2"
|
||||||
|
21
Godeps/_workspace/src/github.com/jbenet/go-detect-race/LICENSE
generated
vendored
21
Godeps/_workspace/src/github.com/jbenet/go-detect-race/LICENSE
generated
vendored
@ -1,21 +0,0 @@
|
|||||||
The MIT License (MIT)
|
|
||||||
|
|
||||||
Copyright (c) 2014 Juan Batiz-Benet
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
|
||||||
all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
THE SOFTWARE.
|
|
33
Godeps/_workspace/src/github.com/jbenet/go-detect-race/README.md
generated
vendored
33
Godeps/_workspace/src/github.com/jbenet/go-detect-race/README.md
generated
vendored
@ -1,33 +0,0 @@
|
|||||||
# go-detect-race
|
|
||||||
|
|
||||||
Check if the race detector is running.
|
|
||||||
|
|
||||||
I didnt find a variable to check quickly enough so I made this.
|
|
||||||
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
```go
|
|
||||||
import (
|
|
||||||
detectrace "github.com/jbenet/go-detect-race"
|
|
||||||
)
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
if detectrace.WithRace() {
|
|
||||||
// running with -race
|
|
||||||
} else {
|
|
||||||
// running without -race
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Why?
|
|
||||||
|
|
||||||
Because the race detector doesnt like massive stress tests. Example:
|
|
||||||
https://groups.google.com/forum/#!topic/golang-nuts/XDPHUt2LE70
|
|
||||||
|
|
||||||
## Why didn't you just use...
|
|
||||||
|
|
||||||
Please tell me about a better way of doing this. It wasn't
|
|
||||||
readily apparent to me, so I made this. But i would much prefer
|
|
||||||
an env var or some already existing var from the stdlib :)
|
|
7
Godeps/_workspace/src/github.com/jbenet/go-detect-race/race.go
generated
vendored
7
Godeps/_workspace/src/github.com/jbenet/go-detect-race/race.go
generated
vendored
@ -1,7 +0,0 @@
|
|||||||
package detectrace
|
|
||||||
|
|
||||||
// WithRace returns whether the binary was compiled
|
|
||||||
// with the race flag on.
|
|
||||||
func WithRace() bool {
|
|
||||||
return withRace
|
|
||||||
}
|
|
9
Godeps/_workspace/src/github.com/jbenet/go-detect-race/race_test.go
generated
vendored
9
Godeps/_workspace/src/github.com/jbenet/go-detect-race/race_test.go
generated
vendored
@ -1,9 +0,0 @@
|
|||||||
package detectrace
|
|
||||||
|
|
||||||
import (
|
|
||||||
"testing"
|
|
||||||
)
|
|
||||||
|
|
||||||
func TestWithRace(t *testing.T) {
|
|
||||||
t.Logf("WithRace() is %v\n", WithRace())
|
|
||||||
}
|
|
5
Godeps/_workspace/src/github.com/jbenet/go-detect-race/withoutrace.go
generated
vendored
5
Godeps/_workspace/src/github.com/jbenet/go-detect-race/withoutrace.go
generated
vendored
@ -1,5 +0,0 @@
|
|||||||
// +build !race
|
|
||||||
|
|
||||||
package detectrace
|
|
||||||
|
|
||||||
const withRace = false
|
|
5
Godeps/_workspace/src/github.com/jbenet/go-detect-race/withrace.go
generated
vendored
5
Godeps/_workspace/src/github.com/jbenet/go-detect-race/withrace.go
generated
vendored
@ -1,5 +0,0 @@
|
|||||||
// +build race
|
|
||||||
|
|
||||||
package detectrace
|
|
||||||
|
|
||||||
const withRace = true
|
|
@ -15,13 +15,12 @@ import (
|
|||||||
mockrouting "github.com/ipfs/go-ipfs/routing/mock"
|
mockrouting "github.com/ipfs/go-ipfs/routing/mock"
|
||||||
delay "github.com/ipfs/go-ipfs/thirdparty/delay"
|
delay "github.com/ipfs/go-ipfs/thirdparty/delay"
|
||||||
|
|
||||||
detectrace "github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-detect-race"
|
|
||||||
|
|
||||||
tu "gx/ipfs/QmVvkK7s5imCiq3JVbL3pGfnhcCnf3LrFJPF4GE2sAoGZf/go-testutil"
|
tu "gx/ipfs/QmVvkK7s5imCiq3JVbL3pGfnhcCnf3LrFJPF4GE2sAoGZf/go-testutil"
|
||||||
travis "gx/ipfs/QmVvkK7s5imCiq3JVbL3pGfnhcCnf3LrFJPF4GE2sAoGZf/go-testutil/ci/travis"
|
travis "gx/ipfs/QmVvkK7s5imCiq3JVbL3pGfnhcCnf3LrFJPF4GE2sAoGZf/go-testutil/ci/travis"
|
||||||
p2ptestutil "gx/ipfs/QmYVR3C8DWPHdHxvLtNFYfjsXgaRAdh6hPMNH3KiwCgu4o/go-libp2p-netutil"
|
p2ptestutil "gx/ipfs/QmYVR3C8DWPHdHxvLtNFYfjsXgaRAdh6hPMNH3KiwCgu4o/go-libp2p-netutil"
|
||||||
cid "gx/ipfs/QmcZfnkapfECQGcLZaf9B79NRg7cRa9EnZh4LSbkCzwNvY/go-cid"
|
cid "gx/ipfs/QmcZfnkapfECQGcLZaf9B79NRg7cRa9EnZh4LSbkCzwNvY/go-cid"
|
||||||
blocks "gx/ipfs/Qmej7nf81hi2x2tvjRBF3mcp74sQyuDH4VMYDGd1YtXjb2/go-block-format"
|
blocks "gx/ipfs/Qmej7nf81hi2x2tvjRBF3mcp74sQyuDH4VMYDGd1YtXjb2/go-block-format"
|
||||||
|
detectrace "gx/ipfs/Qmf7HqcW7LtCi1W8y2bdx2eJpze74jkbKqpByxgXikdbLF/go-detect-race"
|
||||||
)
|
)
|
||||||
|
|
||||||
// FIXME the tests are really sensitive to the network delay. fix them to work
|
// FIXME the tests are really sensitive to the network delay. fix them to work
|
||||||
|
@ -527,6 +527,12 @@
|
|||||||
"hash": "QmWo8jYc19ppG7YoTsrr2kEtLRbARTJho5oNXFTR6B7Peq",
|
"hash": "QmWo8jYc19ppG7YoTsrr2kEtLRbARTJho5oNXFTR6B7Peq",
|
||||||
"name": "go-ipfs-chunker",
|
"name": "go-ipfs-chunker",
|
||||||
"version": "0.0.2"
|
"version": "0.0.2"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"author": "jbenet",
|
||||||
|
"hash": "Qmf7HqcW7LtCi1W8y2bdx2eJpze74jkbKqpByxgXikdbLF",
|
||||||
|
"name": "go-detect-race",
|
||||||
|
"version": "1.0.1"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"gxVersion": "0.10.0",
|
"gxVersion": "0.10.0",
|
||||||
|
Reference in New Issue
Block a user