-
Notifications
You must be signed in to change notification settings - Fork 9
/
compile.go
53 lines (47 loc) · 978 Bytes
/
compile.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package testruns
import (
"fmt"
"github.com/mit-dci/opencbdc-tctl/common"
)
func (t *TestRunManager) CompileBinaries(
tr *common.TestRun,
seeder bool,
) error {
// Compile the binaries if needed. Needed means: the binaries for the test
// run's requested commit hash do not exist in our binaries archive.
seederTitle := "seeder "
if !seeder {
seederTitle = ""
}
t.UpdateStatus(
tr,
common.TestRunStatusRunning,
fmt.Sprintf("Compiling %sbinaries", seederTitle),
)
compileProgress := make(chan float64, 1)
done := make(chan bool, 1)
go func() {
for p := range compileProgress {
t.UpdateStatus(
tr,
common.TestRunStatusRunning,
fmt.Sprintf("Compiling %sbinaries (%.1f%%)", seederTitle, p),
)
}
done <- true
}()
hash := tr.CommitHash
if seeder {
hash = tr.SeederHash
}
err := t.src.CompileIfNeeded(
hash,
(tr.RunPerf || tr.Debug) && !seeder,
compileProgress,
)
<-done
if err != nil {
return err
}
return nil
}