Skip to content
This repository has been archived by the owner on Dec 7, 2019. It is now read-only.

Commit

Permalink
Merge pull request #24 from libp2p/ci/fix
Browse files Browse the repository at this point in the history
ci: fix
  • Loading branch information
Stebalien authored Jun 11, 2018
2 parents 6ebe3f5 + 0b77558 commit 43d0077
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 80 deletions.
25 changes: 17 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
os:
- linux

sudo: false

language: go

go:
- tip
- 1.6
- 1.9.x

install:
- make deps

script:
- go get github.com/whyrusleeping/gx
- go get github.com/whyrusleeping/gx-go
- gx --verbose install
- gx-go rewrite
- go test ./...
# - go test -race -cpu=5 ./...
- bash <(curl -s https://raw.githubusercontent.com/ipfs/ci-helpers/master/travis-ci/run-standard-tests.sh)

cache:
directories:
- $GOPATH/src/gx

notifications:
email: false
17 changes: 5 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
all: deps

build: deps
go build ./...

test: deps
go test ./...

test_race: deps
go test -race -cpu 5 ./...

gx-bins:
gx:
go get github.com/whyrusleeping/gx
go get github.com/whyrusleeping/gx-go

deps: gx-bins
deps: gx
gx --verbose install --global
gx-go rewrite

clean: gx-bins
publish:
gx-go rewrite --undo

3 changes: 3 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
coverage:
range: "50...100"
comment: off
35 changes: 0 additions & 35 deletions suite/suite_test.go

This file was deleted.

50 changes: 25 additions & 25 deletions test/ttest.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func SubtestSimpleWrite(t *testing.T, tr smux.Transport) {
checkErr(t, err)

if string(buf2) != string(buf1) {
t.Error("buf1 and buf2 not equal: %s != %s", string(buf1), string(buf2))
t.Errorf("buf1 and buf2 not equal: %s != %s", string(buf1), string(buf2))
}
log("done")
}
Expand Down Expand Up @@ -508,33 +508,33 @@ func SubtestStress1Conn100Stream100Msg10MB(t *testing.T, tr smux.Transport) {
})
}

func SubtestAll(t *testing.T, tr smux.Transport) {
// Subtests are all the subtests run by SubtestAll
var Subtests = []TransportTest{
SubtestSimpleWrite,
SubtestWriteAfterClose,
SubtestStress1Conn1Stream1Msg,
SubtestStress1Conn1Stream100Msg,
SubtestStress1Conn100Stream100Msg,
SubtestStress50Conn10Stream50Msg,
SubtestStress1Conn1000Stream10Msg,
SubtestStress1Conn100Stream100Msg10MB,
SubtestStreamOpenStress,
SubtestStreamReset,
}

tests := []TransportTest{
SubtestSimpleWrite,
SubtestWriteAfterClose,
SubtestStress1Conn1Stream1Msg,
SubtestStress1Conn1Stream100Msg,
SubtestStress1Conn100Stream100Msg,
SubtestStress50Conn10Stream50Msg,
SubtestStress1Conn1000Stream10Msg,
SubtestStress1Conn100Stream100Msg10MB,
SubtestStreamOpenStress,
SubtestStreamReset,
}
func getFunctionName(i interface{}) string {
return runtime.FuncForPC(reflect.ValueOf(i).Pointer()).Name()
}

for _, f := range tests {
if testing.Verbose() {
fmt.Fprintf(os.Stderr, "==== RUN %s\n", GetFunctionName(f))
}
f(t, tr)
// SubtestAll runs all the stream multiplexer tests against the target
// transport.
func SubtestAll(t *testing.T, tr smux.Transport) {
for _, f := range Subtests {
t.Run(getFunctionName(f), func(t *testing.T) {
f(t, tr)
})
}
}

// TransportTest is a stream multiplex transport test case
type TransportTest func(t *testing.T, tr smux.Transport)

func TestNoOp(t *testing.T) {}

func GetFunctionName(i interface{}) string {
return runtime.FuncForPC(reflect.ValueOf(i).Pointer()).Name()
}

0 comments on commit 43d0077

Please sign in to comment.