瀏覽代碼

Add XUnit compatible test output

Jakob Borg 9 年之前
父節點
當前提交
837fde70ae
共有 3 個文件被更改,包括 10 次插入12 次删除
  1. 1 0
      build.go
  2. 9 0
      build.sh
  3. 0 12
      lib/protocol/protocol_test.go

+ 1 - 0
build.go

@@ -182,6 +182,7 @@ func setup() {
 	runPrint("go", "get", "-v", "github.com/tools/godep")
 	runPrint("go", "get", "-v", "github.com/axw/gocov/gocov")
 	runPrint("go", "get", "-v", "github.com/AlekSi/gocov-xml")
+	runPrint("go", "get", "-v", "bitbucket.org/tebeka/go2xunit")
 }
 
 func test(pkg string) {

+ 9 - 0
build.sh

@@ -125,6 +125,15 @@ case "${1:-default}" in
 		fi
 		;;
 
+	test-xunit)
+		ulimit -t 600 &>/dev/null || true
+		ulimit -d 512000 &>/dev/null || true
+		ulimit -m 512000 &>/dev/null || true
+
+		(GOPATH="$(pwd)/Godeps/_workspace:$GOPATH" go test -v -race ./lib/... ./cmd/... || true) > tests.out
+		go2xunit -output tests.xml -fail < tests.out
+		;;
+
 	docker-all)
 		img=${DOCKERIMG:-syncthing/build:latest}
 		docker run --rm -h syncthing-builder -u $(id -u) -t \

+ 0 - 12
lib/protocol/protocol_test.go

@@ -34,7 +34,6 @@ func TestMain(m *testing.M) {
 }
 
 func TestHeaderFunctions(t *testing.T) {
-	t.Parallel()
 	f := func(ver, id, typ int) bool {
 		ver = int(uint(ver) % 16)
 		id = int(uint(id) % 4096)
@@ -49,7 +48,6 @@ func TestHeaderFunctions(t *testing.T) {
 }
 
 func TestHeaderLayout(t *testing.T) {
-	t.Parallel()
 	var e, a uint32
 
 	// Version are the first four bits
@@ -75,7 +73,6 @@ func TestHeaderLayout(t *testing.T) {
 }
 
 func TestPing(t *testing.T) {
-	t.Parallel()
 	ar, aw := io.Pipe()
 	br, bw := io.Pipe()
 
@@ -95,7 +92,6 @@ func TestPing(t *testing.T) {
 }
 
 func TestVersionErr(t *testing.T) {
-	t.Parallel()
 	m0 := newTestModel()
 	m1 := newTestModel()
 
@@ -123,7 +119,6 @@ func TestVersionErr(t *testing.T) {
 }
 
 func TestTypeErr(t *testing.T) {
-	t.Parallel()
 	m0 := newTestModel()
 	m1 := newTestModel()
 
@@ -151,7 +146,6 @@ func TestTypeErr(t *testing.T) {
 }
 
 func TestClose(t *testing.T) {
-	t.Parallel()
 	m0 := newTestModel()
 	m1 := newTestModel()
 
@@ -187,7 +181,6 @@ func TestClose(t *testing.T) {
 }
 
 func TestElementSizeExceededNested(t *testing.T) {
-	t.Parallel()
 	m := ClusterConfigMessage{
 		ClientName: "longstringlongstringlongstringinglongstringlongstringlonlongstringlongstringlon",
 	}
@@ -198,7 +191,6 @@ func TestElementSizeExceededNested(t *testing.T) {
 }
 
 func TestMarshalIndexMessage(t *testing.T) {
-	t.Parallel()
 	f := func(m1 IndexMessage) bool {
 		for i, f := range m1.Files {
 			m1.Files[i].CachedSize = 0
@@ -219,7 +211,6 @@ func TestMarshalIndexMessage(t *testing.T) {
 }
 
 func TestMarshalRequestMessage(t *testing.T) {
-	t.Parallel()
 	f := func(m1 RequestMessage) bool {
 		return testMarshal(t, "request", &m1, &RequestMessage{})
 	}
@@ -230,7 +221,6 @@ func TestMarshalRequestMessage(t *testing.T) {
 }
 
 func TestMarshalResponseMessage(t *testing.T) {
-	t.Parallel()
 	f := func(m1 ResponseMessage) bool {
 		if len(m1.Data) == 0 {
 			m1.Data = nil
@@ -244,7 +234,6 @@ func TestMarshalResponseMessage(t *testing.T) {
 }
 
 func TestMarshalClusterConfigMessage(t *testing.T) {
-	t.Parallel()
 	f := func(m1 ClusterConfigMessage) bool {
 		return testMarshal(t, "clusterconfig", &m1, &ClusterConfigMessage{})
 	}
@@ -255,7 +244,6 @@ func TestMarshalClusterConfigMessage(t *testing.T) {
 }
 
 func TestMarshalCloseMessage(t *testing.T) {
-	t.Parallel()
 	f := func(m1 CloseMessage) bool {
 		return testMarshal(t, "close", &m1, &CloseMessage{})
 	}