diff options
Diffstat (limited to 'cmd/mbf/internal')
| -rw-r--r-- | cmd/mbf/internal/ci/ci.go | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/cmd/mbf/internal/ci/ci.go b/cmd/mbf/internal/ci/ci.go index 5c993a1b..b1ee6a8c 100644 --- a/cmd/mbf/internal/ci/ci.go +++ b/cmd/mbf/internal/ci/ci.go @@ -450,6 +450,10 @@ const ( // endpointDist accepts a Path.writeSource stream and produces a // distribution for the submitted source. endpointDist = "/dist" + + // endpointRace is like endpointDist, but the resulting distribution is + // instrumented with the data race detector. + endpointRace = "/race" ) // MakeDist creates a hakurei distribution using the CI service. @@ -465,6 +469,19 @@ func (p Path) MakeDist( return p.fetch(ctx, id, output) } +// MakeDistRace creates a hakurei distribution (race) using the CI service. +func (p Path) MakeDistRace( + ctx context.Context, + w io.Writer, + output, source, version string, +) error { + id, err := p.writeSource(ctx, w, endpointRace, source, version) + if err != nil { + return err + } + return p.fetch(ctx, id, output) +} + // Serve services CI workload dispatched to c. func Serve(ctx context.Context, msg message.Msg, c *pkg.Cache) error { const shutdownTimeout = 15 * time.Second @@ -495,6 +512,26 @@ func Serve(ctx context.Context, msg message.Msg, c *pkg.Cache) error { ) } }) + mux.HandleFunc("POST "+endpointRace, func(w http.ResponseWriter, r *http.Request) { + s, err := readSource(w, r) + if err != nil { + msg.Verbose(err) + return + } + defer putS(s) + + _, a := s.Std().MustLoad(rosa.H("hakurei-dist-race")) + if err = cure(c, a, w); err != nil { + msg.Verbose(err) + return + } + if msg.IsVerbose() { + msg.Verbosef( + "satisfied distribution %s (race)", + pkg.Encode(c.Ident(a).Value()), + ) + } + }) if r, err := os.OpenRoot(p.String()); err != nil { return err |
