]> Cypherpunks repositories - gostls13.git/commitdiff
misc/dashboard/builder: add -race builder support
authorDave Cheney <dave@cheney.net>
Tue, 9 Apr 2013 02:48:04 +0000 (12:48 +1000)
committerDave Cheney <dave@cheney.net>
Tue, 9 Apr 2013 02:48:04 +0000 (12:48 +1000)
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

misc/dashboard/builder/main.go

index b2b8f43a6f8b4d15a1299887aed7efe09e3944af..dfaba66c5c1343f5f696e474eaa7ae2166dc5026 100644 (file)
@@ -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)
        }