Commit 26312afd authored by Dave Cheney's avatar Dave Cheney

misc/dashboard/builder: add -race builder support

If the build key contains -race, the builder will invoke to the race.{bat,bash} build command. This allows {darwin,linux,windows}-amd64 builders to do race and non race builds in sequence.

R=adg, dvyukov, fullung
CC=golang-dev
https://golang.org/cl/8266046
parent c8b2b725
......@@ -64,6 +64,7 @@ var (
binaryTagRe = regexp.MustCompile(`^(release\.r|weekly\.)[0-9\-.]+`)
releaseRe = regexp.MustCompile(`^release\.r[0-9\-.]+`)
allCmd = "all" + suffix
raceCmd = "race" + suffix
cleanCmd = "clean" + suffix
suffix = defaultSuffix()
)
......@@ -211,6 +212,16 @@ func NewBuilder(goroot *Repo, name string) (*Builder, error) {
return b, nil
}
// buildCmd returns the build command to invoke.
// Builders which contain the string '-race' in their
// name will override *buildCmd and return raceCmd.
func (b *Builder) buildCmd() string {
if strings.Contains(b.name, "-race") {
return raceCmd
}
return *buildCmd
}
// build checks for a new commit for this builder
// and builds it if one is found.
// It returns true if a build was attempted.
......@@ -262,7 +273,7 @@ func (b *Builder) buildHash(hash string) error {
defer f.Close()
w := io.MultiWriter(f, &buildlog)
cmd := *buildCmd
cmd := b.buildCmd()
if !filepath.IsAbs(cmd) {
cmd = filepath.Join(srcDir, cmd)
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment