aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/manager
diff options
context:
space:
mode:
authorTaras Madan <tarasmadan@google.com>2025-02-14 17:15:00 +0100
committerTaras Madan <tarasmadan@google.com>2025-02-28 13:35:55 +0000
commita37f70eacae01881d3ed517cdf93f59b5a0156e1 (patch)
tree9b8855a70ce53d27a63c385ae40b431eb9de9df7 /pkg/manager
parenta32cfd24f5f44c6c4ad9960549b824ee6b5a75f6 (diff)
pkg/manager: export programs + coverage jsonl
The export is quite big but is generated fast. Every line is a valid json object representing the single program coverage.
Diffstat (limited to 'pkg/manager')
-rw-r--r--pkg/manager/http.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/pkg/manager/http.go b/pkg/manager/http.go
index 99af2c0ed..50f672207 100644
--- a/pkg/manager/http.go
+++ b/pkg/manager/http.go
@@ -86,6 +86,7 @@ func (serv *HTTPServer) Serve(ctx context.Context) error {
handle("/corpus", serv.httpCorpus)
handle("/corpus.db", serv.httpDownloadCorpus)
handle("/cover", serv.httpCover)
+ handle("/coverprogs", serv.httpPrograms)
handle("/debuginput", serv.httpDebugInput)
handle("/file", serv.httpFile)
handle("/filecover", serv.httpFileCover)
@@ -444,6 +445,7 @@ const (
DoRawCover
DoFilterPCs
DoCoverJSONL
+ DoCoverPrograms
)
func (serv *HTTPServer) httpCover(w http.ResponseWriter, r *http.Request) {
@@ -458,6 +460,18 @@ func (serv *HTTPServer) httpCover(w http.ResponseWriter, r *http.Request) {
serv.httpCoverCover(w, r, DoHTML)
}
+func (serv *HTTPServer) httpPrograms(w http.ResponseWriter, r *http.Request) {
+ if !serv.Cfg.Cover {
+ http.Error(w, "coverage is not enabled", http.StatusInternalServerError)
+ return
+ }
+ if r.FormValue("jsonl") != "1" {
+ http.Error(w, "only ?jsonl=1 param is supported", http.StatusBadRequest)
+ return
+ }
+ serv.httpCoverCover(w, r, DoCoverPrograms)
+}
+
func (serv *HTTPServer) httpSubsystemCover(w http.ResponseWriter, r *http.Request) {
if !serv.Cfg.Cover {
serv.httpCoverFallback(w, r)
@@ -577,6 +591,7 @@ func (serv *HTTPServer) httpCoverCover(w http.ResponseWriter, r *http.Request, f
DoRawCover: {rg.DoRawCover, ctTextPlain},
DoFilterPCs: {rg.DoFilterPCs, ctTextPlain},
DoCoverJSONL: {rg.DoCoverJSONL, ctApplicationJSON},
+ DoCoverPrograms: {rg.DoCoverPrograms, ctApplicationJSON},
}
if ct := flagToFunc[funcFlag].contentType; ct != "" {