Commits

Anonymous committed d0d152e

handle build/setup failed in go test output

  • Participants
  • Parent commits 5c223ac

Comments (0)

Files changed (3)

File data/gotest-buildfailed.out

+=== RUN TestUrlJoin
+--- PASS: TestUrlJoin (0.00 seconds)
+PASS
+ok      common  0.002s
+FAIL    node/config [build failed]
 
 	// ?       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

 		}
 	}
 }
+
+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")
+	}
+}