1. Miki Tebeka
  2. go2xunit

Commits

Miki Tebeka  committed d010b70 Merge

Merge pull request #9 from ivaxer/master

handle build/setup failed in go test output

  • Participants
  • Parent commits 5c223ac, d0d152e
  • Branches default

Comments (0)

Files changed (3)

File data/gotest-buildfailed.out

View file
  • Ignore whitespace
+=== RUN TestUrlJoin
+--- PASS: TestUrlJoin (0.00 seconds)
+PASS
+ok      common  0.002s
+FAIL    node/config [build failed]

File go2xunit.go

View file
  • Ignore whitespace
 
 	// ?       alipay  [no test files]
 	gt_noFiles = "^\\?.*\\[no test files\\]$"
+	// FAIL    node/config [build failed]
+	gt_buildFailed = `^FAIL.*\[(build|setup) failed\]$`
 
 	// gocheck regular expressions
 
 	find_end := regexp.MustCompile(gt_endRE).FindStringSubmatch
 	find_suite := regexp.MustCompile(gt_suiteRE).FindStringSubmatch
 	is_nofiles := regexp.MustCompile(gt_noFiles).MatchString
+	is_buildFailed := regexp.MustCompile(gt_buildFailed).MatchString
 	is_exit := regexp.MustCompile("^exit status -?\\d+").MatchString
 
 	suites := []*Suite{}
 			continue
 		}
 
+		if is_buildFailed(line) {
+			return nil, fmt.Errorf("%d: package build failed: %s", lnum, line)
+		}
+
 		tokens := find_start(line)
 		if tokens != nil {
 			if curTest != nil {

File go2xunit_test.go

View file
  • Ignore whitespace
 		}
 	}
 }
+
+func Test_parseBuildFailed(t *testing.T) {
+	_, err := loadGotest("data/gotest-buildfailed.out", t)
+	if err == nil {
+		t.Fatalf("expected error when at least one package failed to build")
+	}
+}